module Orchestrate::Rails::Tutorial::SettingUpRails

Setting up the rails environment

Gem orchestrate-rails has been tested with rails 4.0 and ruby 2.0

Generating the rails application

$ cd <rails-projects-dir>
$ rails new orchio-rails-demo
$ cd orchio-rails-demo

Adding the orchestrate.io configuration file

Copy the configuration file into the lib directory.

$ cp <path>/orchestrate_config.json ./lib/orchestrate_config.json

Add the following line to <rails-root>/config/application.rb

Orchestrate::Application::Connect.config "./lib/orchestrate_config.json"

Updating the Gemfile

Add the following lines to your Gemfile:

# Orchestrate.io gems depend on httparty
gem "httparty"
gem "orchestrate-api"
gem "orchestrate-rails"

Add these lines since we'll be using Bootstrap and HAML for the example:

# Use Bootstrap
gem 'bootstrap-sass'

# Use HAML instead of ERB
gem 'haml-rails', '>= 0.3.4'

Run bundler to install the gems.

$ bundle install

Setting up Bootstrap

We'll be using Bootstrap for some basic styling, and to take advantage of its grid system and list-group capability.

Create <rails-root>/app/assets/stylesheets/custom.css.scss as shown:

@import "bootstrap";

.films {
  max-width: 800px;
  margin: 0 auto;
}

.film-heading {
  font-weight: bold;
}

.film-comment {
  padding-bottom: 10px;
}

$grayLight: #999;

html {
  overflow-y: scroll;
}

body {
  padding-top: 60px;
  padding-bottom: 40px;
  background-color: #eee;
}

h3 {
  font-size: 1.4em;
  letter-spacing: -1px;
  margin-bottom: 30px;
  text-align: center;
  font-weight: normal;
  color: $grayLight;
}

Next

Building the rails application