Rails 4.2为不同的环境设置bundle_command

时间:2015-10-16 08:58:41

标签: ruby-on-rails ruby-on-rails-4 whenever

我在schedule.rb文件中使用了set :bundle_command告诉cron在哪里查找bundle。这就是它的样子:

 set :bundle_command, "/home/user/.gem/ruby/2.2.0/bin/bundle exec"

我正在使用Arch Linux进行开发,但我想将其部署到Ubuntu Server。路径略有不同。 我如何使这个环境独立?

任何环境文件中的此语句都会给我set method not found error.g

1 个答案:

答案 0 :(得分:0)

whenever的最新版本中,@environment保留当前环境。

case @environment
when 'production'
  set :bundle_command, "/other_path/bundle exec"
else
  set :bundle_command, "/home/user/.gem/ruby/2.2.0/bin/bundle exec"
end