The Bundler documentation says, that in order to install all necessary bundles when deploying via Capistrano, one need only insert
require 'bundler/capistrano' # siehe http://gembundler.com/deploying.html
in his deploy.rb. Then, upon deployment, Capistrano calls
* executing "bundle install --gemfile .../releases/20110403085518/Gemfile \
--path .../shared/bundle --deployment --quiet --without development test"
This works fine.
However, we have a staging setup on our production server, isolated from the real live site, where we test a new app release with (cloned and firewalled) live production data. There, we need test and development gems to be installed.
How do I specify the capistrano command line here? Are there parameters I can use, or do I need to set up my own capistrano task to overwrite Bundler's?
Thank you!
In Rails, bundler provides a constant environment for Ruby projects by tracking and installing suitable gems that are needed. It manages an application's dependencies through its entire life, across many machines, systematically and repeatably.
As a rule, the installed Ruby interpreter comes with Bundler installed. If not, you can install Bundler to the project SDK in one of the following ways: Select Tools | Bundler | Install Bundler from the main menu.
Rails comes with baked in support with bundler.
The executables bundle & bundler have the same functionality and therefore can be used interchangeably. You can see in the bundler/exe directory that the bundler executable just loads the bundle executable. It seems to me that the bundle command is more commonly used than the bundler command.
Writing different tasks would certainly keep it 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 could switch on the supplied value:
cap deploy target=staging
And inside your deploy.rb file you could use the option value as:
if target == "staging"
set :bundle_without, [:test]
# do other stuff here
end
There's also a more 'proper' configuration object that you can use. I've found a reference to it here: http://ryandaigle.com/articles/2007/6/22/using-command-line-parameters-w-rake-and-capistrano
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With