rake-hooks
rake-hooks copied to clipboard
uninitialized constant Rake (NameError) in lib/rake/hooks.rb:1
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'
See this quick fix patch https://github.com/jeznet/rake-hooks/commit/7fc26383b3b37589cd55742f1da7cee63809d149
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?
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.
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.
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 +1
Another fix is to add require 'rake'
just above Bundler.require(:default, Rails.env)
in application.rb
, but I like your fix better.