Discussion Forums
- Topic List
- Most Recent Posts
- Sign In for more options
Hi
iam very new to ruby on rail. my requirement is to schedule a job using rufus-scheduler. my code is like this. this is a simple programme that add two numbers in a specific period of time.
require 'rubygems' require 'rufus/scheduler'
scheduler =Rufus::Scheduler.new scheduler.start scheduler.schedule_every('5s')do
a=1
b=4
c=a+b
puts c
end
my error is
C:/Aptana/Aptana Studio/plugins/org.jruby_1.1.0.5965_RC2p1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require': no such file to load -- rufus/scheduler (LoadError)
from logon.rb:4
from logon.rb:1
actually i have download rufus-scheduler 1.0.5 version, and install it manuall successfully. i install this from the (C:/Aptana/Aptana Studio/plugins/org.jruby_1.1.0.5965_RC2p1/lib/ruby/site_ruby/1.8/rubygems)in command prompt.
so i do not know why the error is comming ,please help me in this regard.
The problem is that your application can't find the file "rufus/scheduler.rb". This is either because you do not have a directory called "rufus" in the same directory as your script and subsequently no file called "scheduler.rb". Alternatively, you have not placed it in your lib directory as defined by the Aptana Studio IDE. Lastly, you may need to install a gem to provide this functionality. I am not an Aptana Studio user, but perhaps it has the facility to install gems into your development environment, and if so, you need to install the rufus/scheduler.
I hope this helps. Let me know how it works out for you!
-Kevin Elliott "WeLikeFood Beta":http://www.welikefood.com/ Discover great restaurants. Discover great food enthusiasts with your taste.
thanks for your suggestion .it is working
Great to hear that Bishnu!
Kevin Elliott "WeLikeFood Beta":http://www.welikefood.com
Hi kevin, Though i am successfully run a simple example mentioned by above. now when i try to deploy in my rail application . i am quite unsuccessful.my application requires a login page which automatically runs with in a regular interval of time,and for a specific period of time. i am using instant rail 1.7.0 and ruby version-1.8.6.rails 1.2.3 version. actually i am confused how to start and how to deploy.please guide me in this regard.
Hi All,
I am also using 'rufus-scheduler' gem to schedule periodic task.
I have created a folder called rufus in my lib directory, in that I have created a file name 'scheduler.rb'. Now in that scheduler.rb I am writing my code like this:
require 'rubygems' require 'rufus/scheduler'
scheduler = Rufus::Scheduler.new
scheduler.in("10s") do generate_output end
My generate_output method is written in app/controllers/dashboard_controller.rb When I start the server to see the output nothing appears.
Apart from that If I write same code in environment.rb like this:
require 'rubygems' require 'rufus/scheduler'
scheduler = Rufus::Scheduler.new
scheduler.in("10s") do puts("Scheduler is working") end
This Time I can see the output in command prompt. I want to run generate_output method. How can I?
Thanks and Advance
