【问题标题】:Rails 4.2 set bundle_command for different environmentRails 4.2 为不同环境设置 bundle_command
【发布时间】:2015-10-16 08:58:40
【问题描述】:

我在 schedule.rb 文件中使用了set :bundle_command 来告诉 cron 在哪里寻找捆绑包。看起来是这样的:

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

我正在使用 Arch Linux 进行开发,但我想将它部署到 Ubuntu 服务器。路径略有不同。 我怎样才能使这个环境独立?

在任何环境文件中的这个语句都会给我set method not founderror.g

【问题讨论】:

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


    【解决方案1】:

    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
    

    【讨论】:

      猜你喜欢
      • 2014-03-17
      • 2018-10-03
      • 2013-04-26
      • 2019-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-16
      相关资源
      最近更新 更多