Skip to content

RAILS_ROOT not accessible by whenever #81

Closed
brunetton opened this Issue Sep 20, 2010 · 4 comments

3 participants

@brunetton

Hi all,

I've a problem after upgrading from 0.4.1 to 0.5.2 :
/home/bduye/.gem/ruby/1.8/gems/whenever-0.5.2/lib/whenever/job_list.rb:24:in initialize': /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:inconst_missing': uninitialized constant Whenever::JobList::RAILS_ROOT (NameError)
from (eval):8:in initialize'
from /home/bduye/.gem/ruby/1.8/gems/whenever-0.5.2/lib/whenever/base.rb:4:in
eval'
from /home/bduye/.gem/ruby/1.8/gems/whenever-0.5.2/lib/whenever/job_list.rb:24:in initialize'
from /home/bduye/.gem/ruby/1.8/gems/whenever-0.5.2/lib/whenever/base.rb:4:in
new'
from /home/bduye/.gem/ruby/1.8/gems/whenever-0.5.2/lib/whenever/base.rb:4:in cron'
from /home/bduye/.gem/ruby/1.8/gems/whenever-0.5.2/lib/whenever/command_line.rb:42:in
run'
from /home/bduye/.gem/ruby/1.8/gems/whenever-0.5.2/lib/whenever/command_line.rb:8:in execute'
from /home/bduye/.gem/ruby/1.8/gems/whenever-0.5.2/bin/whenever:35
from /opt/ruby-enterprise/bin/whenever:19:in
load'
from /opt/ruby-enterprise/bin/whenever:19

My schedule file containts :
set :output, "#{RAILS_ROOT}/log/cron.log"

Isn't it possible to access to RAILS_ROOT constant inside whenever ?
If not why ?

Thanks to all

@javan
Owner
javan commented Sep 20, 2010

Whenever no longer attempts to load your Rails environment. However, it does automatically set a path variable to the directory whenever was executed from. This should work just the same:

set :output, "#{path}/log/cron.log"

@brunetton

Thanks for your answer.
I also tried to access to the #{path} variable without success. I didn't took time to look precisely why, but when I put this line in my schedule.rb; i get that arror :

/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/whenever-0.4.1/lib/whenever/job_list.rb:20:in initialize': undefined local variable or methodpath' for # (NameError)
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/whenever-0.4.1/lib/whenever/base.rb:4:in eval'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/whenever-0.4.1/lib/whenever/job_list.rb:20:in
initialize'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/whenever-0.4.1/lib/whenever/base.rb:4:in new'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/whenever-0.4.1/lib/whenever/base.rb:4:in
cron'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/whenever-0.4.1/lib/whenever/command_line.rb:31:in run'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/whenever-0.4.1/lib/whenever/command_line.rb:5:in
execute'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/whenever-0.4.1/bin/whenever:30
from /opt/ruby-enterprise-1.8.7-2009.10/bin/whenever:19:in `load'
from /opt/ruby-enterprise-1.8.7-2009.10/bin/whenever:19

Note that I'm using Ruby Enterprise edition. Maybe there is a link ?

@javan
Owner
javan commented Sep 21, 2010

From your backtrace it looks like you've got relics from whenever-0.4.1 in there. Maybe try uninstalling all old versions and reinstalling.

@tsailipu
tsailipu commented Oct 9, 2010

I have only 0.5.3 but also ran into the same problem. What works, though, is to put #{Whenever.path} instead of just #{path} in 'set :output' line.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.