使用 capistrano 3 部署,每当 gem

Deploying with capistrano 3 and whenever gem

我正在尝试使用 capistrano 3.

whenever gem 部署我的应用程序

我添加了:require "whenever/capistrano" 到 Capfile,并且:

set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" } 至 config/deploy.rb.

部署时出现错误:

01 bundler: failed to load command: whenever (/home/deploy/www/laptophits/shared/bundle/ruby/2.2.0/bin/whenever)

NameError: undefined local variable or method `extract' for #<Whenever::JobList:0x00000002edf6c8>
      config/schedule.rb:9:in `block in initialize'

当我通过 ssh 连接到生产机器并尝试 运行 时手动使用:/home/deploy/www/laptophits/shared/bundle/ruby/2.2.0/bin/whenever

我收到错误:

/home/deploy/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems.rb:271:in `find_spec_for_exe': can't find gem whenever (>= 0.a) (Gem::GemNotFoundException)
        from /home/deploy/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems.rb:299:in `activate_bin_path'

知道如何解决吗?

关键错误在

NameError: undefined local variable or method `extract' for #<Whenever::JobList:0x00000002edf6c8>
  config/schedule.rb:9:in `block in initialize'

config/schedule.rb 的第 9 行可能存在代码错误。可能使用的方法 extract 在对象上或您使用它的上下文中不存在。