Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `new' for Guard::Rake:Module when I run "guard start" #1

Closed
dougireton opened this issue Sep 21, 2011 · 17 comments
Closed

Comments

@dougireton
Copy link

I have installed guard-rake using bundler and I've created a guard file to run rake, but when I run "guard start" I get this error:

ERROR: Invalid Guardfile, original error is:
undefined method `new' for Guard::Rake:Module

Any ideas?

@dougireton
Copy link
Author

Here's the output of the bundle command:

Using rake (0.9.2) 
Using rb-appscript (0.6.1) 
Using growl_notify (0.0.1) 
Using thor (0.14.6) 
Using guard (0.7.0) 
Using guard-rake (0.0.1) 
Using rb-fsevent (0.4.3.1) 
Using bundler (1.0.18)

@rubyist
Copy link
Owner

rubyist commented Sep 26, 2011

What version of ruby are you using?

@lukaszkorecki
Copy link

Hi

I had the same issue, but because I had to get stuff done, I just fixed it in my fork by renaming the guard-rake class. I didn't have time to properly dig in and fix this issue, but from the looks of things it's a naming conflict.
One thing to keep in mind that in my fork you define new task with:

guard 'raketask', :task => 'doit' do
  watch(%r{^some_files/.+$})
end

not with guard 'rake', :task => ...

Looking at the code now, it might be as easy as removing the include from here and calling Rake's methods explicitly.

@rubyist
Copy link
Owner

rubyist commented Sep 26, 2011

@dougireton Does using lukaszkorecki's fork fix the problem for you? I've been unable to reproduce, but if his fork works for you I'll be happy to merge the changes in.

@dougireton
Copy link
Author

Scott,

I'm at work now, but I can try his fork tonight.

Thanks,

Doug Ireton

On Mon, Sep 26, 2011 at 8:56 AM, Scott Barron <
reply@reply.github.com>wrote:

@dougireton Does using lukaszkorecki's fork fix the problem for you? I've
been unable to reproduce, but if his fork works for you I'll be happy to
merge the changes in.

Reply to this email directly or view it on GitHub:
#1 (comment)

@dougireton
Copy link
Author

I'm running
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]

@dougireton
Copy link
Author

I tried @lukaszkorecki's fork. I get further. When I run guard start I get this:

Guard is now watching at '/Users/doug/src/ruby_koans'
Starting guard-rake walk_the_path

But after the rake task runs once, I get this error:

ERROR: Guard::Raketask failed to achieve its <run_all>, exception was:
Errno::ENOENT: No such file or directory - koans
/Users/doug/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:121:in `chdir'
/Users/doug/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:121:in `cd'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `cd'
Rakefile:85:in `block in <top (required)>'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-rake-0.0.1/lib/guard/raketask.rb:41:in `run_rake_task'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-rake-0.0.1/lib/guard/raketask.rb:31:in `run_all'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard.rb:106:in `supervised_task'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard.rb:63:in `block (2 levels) in run_all'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard.rb:63:in `each'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard.rb:63:in `block in run_all'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard.rb:95:in `run'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard.rb:62:in `run_all'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard/interactor.rb:24:in `block (2 levels) in start'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard/interactor.rb:13:in `loop'
/Users/doug/.rvm/gems/ruby-1.9.2-p290@koans/gems/guard-0.7.0/lib/guard/interactor.rb:13:in `block in start'

Guard::Raketask has just been fired

Here is my Guardfile:

guard 'raketask', :task => :walk_the_path do
  watch(%r{~/src/ruby-koans/koans/.+$})
end

@lukaszkorecki
Copy link

@dougireton - there's an error in your Guardfile,

it should be placed in ruby_koans directory (using Guard from your home dir isn't recommended), and should look like this:

guard 'raketask', :task => 'walk_the_path' do
  watch(%r{ koans/.*\.rb$ } )
end

(tested with ruby-1.9.2-p290 and ruby-1.8.7-p320.

@wkrsz
Copy link
Contributor

wkrsz commented Nov 4, 2011

Same issue here:

/Users/wojtek/.rvm/gems/ruby-1.8.7-p352/gems/guard-0.8.8/lib/guard.rb:42:in `initialize_template': undefined method `init' for Guard::Rake:Module (NoMethodError)
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/gems/guard-0.8.8/lib/guard/cli.rb:103:in `init'
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/gems/guard-0.8.8/bin/guard:6
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/bin/guard:19:in `load'
    from /Users/wojtek/.rvm/gems/ruby-1.8.7-p352/bin/guard:19

Wojteks-MacBook-Pro:geepivo wojtek$ bundle exec guard start
ERROR: Invalid Guardfile, original error is:
undefined method `new' for Guard::Rake:Module

@lukaszkorecki, your fork did not resolve the issue for me.

@wkrsz
Copy link
Contributor

wkrsz commented Nov 4, 2011

I narrowed the issue down to lib/guard/version.rb which defines Guard::Rake as a Module (which interferes with Guard::Rake class definition). Removing the file fixed the errors for me.

rubyist pushed a commit that referenced this issue Nov 7, 2011
@rubyist
Copy link
Owner

rubyist commented Nov 7, 2011

Fix merged in, thanks!

@rubyist rubyist closed this as completed Nov 7, 2011
@wkrsz
Copy link
Contributor

wkrsz commented Nov 7, 2011

Cool.

Thanks for the gem!

On Mon, Nov 7, 2011 at 3:14 PM, Scott Barron <
reply@reply.github.com>wrote:

Fix merged in, thanks!


Reply to this email directly or view it on GitHub:
#1 (comment)

@hojberg
Copy link

hojberg commented Jan 4, 2012

Could you publish a new gem version? The current gem is broken because of this!

@rubyist
Copy link
Owner

rubyist commented Jan 4, 2012

Sorry about that, new gem published.

@hojberg
Copy link

hojberg commented Jan 4, 2012

@rubyist thanks, but the new version you submitted doesn't have the patch applied that renames to RakeVersion :(

@rubyist
Copy link
Owner

rubyist commented Jan 4, 2012

Oh, that's because I'm so awesome I push gems from a stale repository. Next time, I'll have coffee first.

@hojberg
Copy link

hojberg commented Jan 4, 2012

haha thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants