27.02.2013 Views

Rails%203%20In%20Action

Rails%203%20In%20Action

Rails%203%20In%20Action

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Deploy away!<br />

Figure 14.2 Paste in the key, and add a title.<br />

If there is a ticketee directory at the current location of the server that contains the<br />

directories your application should contain, then this works. You can delete this<br />

directory now; you’ll be putting the code on the server at another location using<br />

Capistrano.<br />

Before that happens, you’ll need to configure Capistrano.<br />

14.5.2 Configuring Capistrano<br />

To begin with, add the capistrano gem to your application’s Gemfile using this code:<br />

group :development do<br />

gem 'capistrano'<br />

end<br />

To install this gem, you (and other developers of your application) are able to run<br />

bundle install, which will keep those other developers up-to-date with all gems. Running<br />

gem install capistrano would only update them with Capistrano, and even<br />

then it may be a version that is incompatible with the one that you’ve developed.<br />

When the gem is installed, you can set it up inside a Rails application by running<br />

this command from the root of the application:<br />

capify .<br />

This will create two files: Capfile and config/deploy.rb. The Capfile is a file containing<br />

setup for Capistrano in the application and the following default code that will be<br />

used to load your Capistrano configuration:<br />

load 'deploy' if respond_to?(:namespace) # cap2 differentiator<br />

Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }<br />

load 'config/deploy' # remove this line to skip loading any ...<br />

397

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!