Ruby on Rails: Bundler & Capistrano: specify which groups (development, test) should be excluded during deployment

The Bundler documentation says that to install all the necessary packages when deploying through Capistrano you only need to insert

require 'bundler/capistrano' # siehe http://gembundler.com/deploying.html 

in your deploy.rb. Then, after deployment, Capistrano calls

  * executing "bundle install --gemfile .../releases/20110403085518/Gemfile \ --path .../shared/bundle --deployment --quiet --without development test" 

This works great.

However, we have an intermediate installation on our production server, isolated from a real live site, where we are testing a new version of the application with (cloned and firewalls) in real time. There we need test and development that need to be installed.

How to specify capistrano command line here? Are there any options that I can use, or do I need to configure my own capistrano task to overwrite the Bundler?

Thanks!

+8
ruby-on-rails production staging bundler capistrano
source share
3 answers

Writing different tasks will certainly be simple:

 task :production do # These are default settings set :bundle_without, [:development, :test] end task :staging do set :bundle_without, [:test] # set :rails_env, 'staging' end 

However, if you want to use command line options, you can include the supplied value:

 cap deploy target=staging 

And inside the deploy.rb file, you can use the parameter value as:

 if target == "staging" set :bundle_without, [:test] # do other stuff here end 

There is also a more β€œcorrect” configuration object that you can use. I found a link to it here: http://ryandaigle.com/articles/2007/6/22/using-command-line-parameters-w-rake-and-capistrano

+18
source share

I think the cleanest way is to simply add set: bundle_without to the deployment environment files using this:

https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension

+2
source share

I do not have a setting for independent verification, but does RAILS_ENV = 'development' do it?

0
source share

All Articles