0

我試圖部署我的應用whenever寶石使用capistrano 3部署與capistrano 3和每當寶石

我添加: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' 

任何想法如何解決它?

回答

1

關鍵的錯誤是在

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

有可能對config/schedule.rb 9號線的一個代碼錯誤。可能使用方法extract,該方法不存在於對象或您正在使用它的上下文中。

+0

我忘記了rake任務名稱中的引號。 –