rake-hooks icon indicating copy to clipboard operation
rake-hooks copied to clipboard

uninitialized constant Rake (NameError) in lib/rake/hooks.rb:1

Open szymon-jez opened this issue 12 years ago • 6 comments

rake-hooks-1.2.3/lib/rake/hooks.rb:1:in `<top (required)>': uninitialized constant Rake (NameError)
        from ~/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `require'

szymon-jez avatar Apr 16 '12 09:04 szymon-jez

See this quick fix patch https://github.com/jeznet/rake-hooks/commit/7fc26383b3b37589cd55742f1da7cee63809d149

szymon-jez avatar Apr 16 '12 09:04 szymon-jez

Yes, you are right. But how you load a rake library without rake. Rake hooks is supposed to be loaded within rake. Not outside.

Can you explain a little bit more the use case, and also the rake version you are using? Is rake in your Gemfile?

guillermo avatar Apr 16 '12 10:04 guillermo

I'm using Rake 0.9.2.2. Rake is not directly declared in my Gemfile. It is thought in Gemfile.lock (because it's a dependency). I'm using it all in a Rails app.

szymon-jez avatar Apr 18 '12 12:04 szymon-jez

I'm getting this same error too from Rails:

/Users/aaron/.rvm/gems/ruby-1.9.3-p484@brightbytes/gems/rake-hooks-1.2.3/lib/rake/hooks.rb:1:in '<top (required)>': uninitialized constant Rake (NameError)

However, I don't have permission to see the patch.

brightbytes-dude avatar Mar 26 '14 22:03 brightbytes-dude

To fix this issue it's enough to setup in Gemfile gem 'rake-hooks', require: false and require hooks manually inside rake files like require 'rake/hooks'

cheef avatar Jun 24 '14 09:06 cheef

@cheef +1

Another fix is to add require 'rake' just above Bundler.require(:default, Rails.env) in application.rb, but I like your fix better.

abuisman avatar Jul 09 '15 12:07 abuisman