【问题标题】:Mina's Whenever integration. How do you set the "whenever_name"?Mina 的每当集成。你如何设置“whenever_name”?
【发布时间】:2016-02-11 17:51:39
【问题描述】:

根据this file,看起来我应该能够设置“whenever_name”来为我的 cron 作业创建自定义命名空间。我在任何时候都阅读了 mina 的文档here。它没有提到如何为我的工作设置自定义命名空间,也就是“whenever_name”。

他们的文档概述了 rake 任务的基本用法:

require 'mina/whenever'
task :deploy => :environment do
  deploy do
    ...
  to :launch do
    invoke :'whenever:update'
  end
end

那么,当我调用 rake 任务时,我该如何指定whence_name?我需要在某处进行一些配置吗?

when.rb 有一些关于如何设置when_name 的内容,但提供的文档不足以让我进行所需的更改。注释告诉我,我可以覆盖 deploy.rb 或 schedule.rb 中的域变量。覆盖该变量的语法是什么?

# ## Settings
# Any and all of these settings can be overriden in your `deploy.rb`.

# ### whenever_name
# Override the default name used by Whenever when clearing,
# updating or writing the crontab file.

namespace :whenever do
  # NOTE: setting this as a lambda to allow the user to override
  # the domain variable at any time in their schedule.rb file
  name = lambda { whenever_name || "#{domain}_#{rails_env}" }

【问题讨论】:

    标签: ruby-on-rails whenever mina


    【解决方案1】:

    想通了。在 deploy.rb 中添加以下行:

    set :whenever_name, 'production'
    

    只需要后退一步使用我被赋予的大脑。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-10
      • 1970-01-01
      • 1970-01-01
      • 2010-09-21
      • 1970-01-01
      • 2014-03-26
      • 2021-06-03
      • 1970-01-01
      相关资源
      最近更新 更多