Ruby on Rails:Bundler& Capistrano:指定在部署时排除哪些组(开发,测试)

Bundler文档说,为了在通过Capistrano部署时安装所有必需的bundle,只需插入即可
require 'bundler/capistrano' # siehe http://gembundler.com/deploying.html
在他的deploy.rb中。然后,在部署时,Capistrano打电话
  * executing "bundle install --gemfile .../releases/20110403085518/Gemfile 
    --path .../shared/bundle --deployment --quiet --without development test"
这很好用。 但是,我们的生产服务器上有一个分段设置,与真实的实时站点隔离,我们在那里测试带有(克隆和防火墙)实时生产数据的新应用程序版本。在那里,我们需要安装测试和开发宝石。 如何在此处指定capistrano命令行?是否有我可以使用的参数,或者我是否需要设置自己的capistrano任务来覆盖Bundler? 谢谢!     
已邀请:
编写不同的任务肯定会保持简单:
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
但是,如果要使用命令行选项,可以打开提供的值:
cap deploy target=staging
在deploy.rb文件中,您可以使用选项值:
if target == "staging"
  set :bundle_without, [:test]
  # do other stuff here
end
您还可以使用更“正确”的配置对象。我在这里找到了它的参考:http://ryandaigle.com/articles/2007/6/22/using-command-line-parameters-w-rake-and-capistrano     
我认为最简单的方法是使用以下方法在部署环境文件中添加set:bundle_without: https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension     
我没有独立确认的设置,但RAILS_ENV ='开发'是否得到它?     

要回复问题请先登录注册