ruby - Whenever gem 'failed to load command: rake' -


looking help.

i running rails app (v3.2.5) whenever gem (v0.9.7) , rake (v11.2.2). doing in docker container image ruby:2.3 (cron installed , bundle install ran)

here schedule.rb

set :environment, env['rails_env']  every '*/2 9,10,11,12,13,14,15,16 * * 1-5'     rake "import_csv", output: {:error => 'log/import_csv_errors.log', :standard => 'log/import_csv.log'}' end 

note rails_env set @ container launch development

here cron job on container after build (crontab -l):

# begin whenever generated tasks for: /usr/src/app/config/schedule.rb */2 9,10,11,12,13,14,15,16 * * 1-5 /bin/bash -l -c 'cd /usr/src/app && rails_env=development bundle exec rake import_csv --silent >> log/import_csv.log 2>> log/import_csv_errors.log'  # end whenever generated tasks for: /usr/src/app/config/schedule.rb 

when cron job runs, logs return:

import_csv_errors.log

bundler::gemnotfound: not find rake-11.2.2 in of sources   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:95:in `block in materialize'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `map!'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `materialize'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in `specs'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:185:in `specs_for'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:174:in `requested_specs'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/environment.rb:19:in `requested_specs'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:14:in `setup'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:95:in `setup'   /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/setup.rb:19:in `<top (required)>'   /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'   /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' 

import_csv.log

bundler: failed load command: rake (/usr/local/bin/rake) 

now here odd thing. if copy cron job command:

/bin/bash -l -c 'cd /usr/src/app && rails_env=development bundle exec rake import_csv --silent >> log/import_csv.log 2>> log/import_csv_errors.log' 

and run in container, works fine, if cron job runs it, thos errors in logs!!! @ lost here...

i've tried adding

env :path, env['path'] env :gem_path, '/usr/local/bundle' 

to top of schedule.rb , tried doing

command 'cd /usr/src/app && rails_env=development bundle exec rake import_csv --silent >> log/import_csv.log 2>> log/import_csv_errors.log' 

instead of using rake in task , same errors..

any appriciated

i have updated rake version , worked me. below steps followed:

sudo bundle update rake sudo bundle install 

open rakefile , replace line rake/rdoctask require 'rdoc/task'.


Comments