javan/whenever

whenever command is not working

Chrisgo-75 opened this issue · 1 comments

On my development VM and on the server, running whenever command $ bundle exec whenever is not working. I get back the following:

$ bundle exec whenever
bundler: failed to load command: whenever (/home/cgarndt/.rbenv/versions/3.0.0/bin/whenever)
config/schedule.rb:35:in `initialize': uninitialized constant #<Class:#<Whenever::JobList:0x0000555d07619838>>::Rails (NameError)
    from /home/cgarndt/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/whenever-1.0.0/lib/whenever/job_list.rb:25:in `instance_eval'
    ... ... ...

On my development machine I am running:
Ubuntu 22.04 LTS
rbenv
Ruby 3.0
Rails 7.0.4
whenever (1.0.0)

I have ran $ bundle exec wheneverize . which ran successfully and created schedule.rb file.

Any help would be appreciated.
Thank you
Chris

The issue was in my schedule.rb file. I was trying to have different times set for staging vs production using Rails.env which doesn't work. I removed Rails.env blocks and this fixed the error.