Marc
Marc

Reputation: 2584

Another: uninitialized constant Rake::DSL

Here' the output:

rake aborted!
uninitialized constant Rake::DSL
/Users/marclipovsky/Sites/sat-7/app/Rakefile:6
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in `load'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in `raw_load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2017:in `load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2016:in `load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2000:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:31

And here's my rake file:

require File.expand_path('../config/application', __FILE__)
require 'rake'
include Rake::DSL

App::Application.load_tasks

Not even sure what to look at or where to start. Any help is appreciated. Thanks!

Update: Rake commands work now but I still get this before it runs the command itself:

/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED

Upvotes: 1

Views: 1303

Answers (2)

Stephen McCarthy
Stephen McCarthy

Reputation: 601

What worked for me was removing older versions of rake from my system. After I ran:

sudo gem uninstall rake -v 0.8.7

I stopped seeing errors like:

/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
WARNING: Global access to Rake DSL methods is deprecated.  Please include
...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Rake::TestTask#ruby called at /Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `ruby'
WARNING: Global access to Rake DSL methods is deprecated.  Please include
...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Object#ruby called at /Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `ruby'

`

Upvotes: 0

Seamus Abshere
Seamus Abshere

Reputation: 8526

There are answers like Ruby on Rails and Rake problems: uninitialized constant Rake::DSL and uninitialized constant Rake::DSL in Ruby Gem ... I would try this first:

# [...]
require 'rake/dsl_definition'
require 'rake'
# [...]

If that doesn't fix it completely, you may be able to put gem 'rake', '>=0.9.2' in your Gemfile, then do a bundle update, and finally run bundle exec rake db:migrate.

Upvotes: 5

Related Questions