Quick question, undefined local variable "every"

31 views
Skip to first unread message

viatropos

unread,
Sep 15, 2009, 9:55:40 PM9/15/09
to Whenever Gem
Hey,

I have a simple one-file sample project that's just rake tasks:

require 'rubygems'
require 'whenever'

task :my_task do |t|
every 1.min do
rake "another_task"
end
end

But when I do that I get this error:

undefined local variable or method `every' for main:Object

If I add this to the file:

set :path, File.dirname(__FILE__)

I get the same error for that "set" method. It looks like its not
being registered in the project, but I do have the gems installed.

Any ideas?

Thanks for your help,
Lance

Javan Makhmali

unread,
Sep 16, 2009, 10:53:07 AM9/16/09
to whenev...@googlegroups.com
Lance,

Whenever's 'every' wasn't designed to use inside of a rake task like
that. It belongs in it's own file, the default being config/schedule.rb.

Take a look at the README file for an overview: http://github.com/javan/whenever/

Javan

viatropos

unread,
Sep 30, 2009, 8:13:48 AM9/30/09
to Whenever Gem
Thanks for getting back to me.

All of the examples use Rails as a base, so I don't see how you can
use Whenever without it. Could you provide a quick snippet/example
showing how to use it without Rails?

Thanks again,
Lance

Roger Ertesvåg

unread,
Oct 2, 2009, 5:12:55 AM10/2/09
to Whenever Gem
Whenever does not really rely on Rails, just Ruby. So as long as you
run whenever from a location that has a subdirectory named 'config'
with schedule.rb in it you should be fine.

viatropos

unread,
Oct 5, 2009, 5:46:20 AM10/5/09
to Whenever Gem
great! got it working, thanks!
Reply all
Reply to author
Forward
0 new messages