我一直在努力更新我的gem(https://github.com/ivanoats/whm_xml_api_ruby上的whm_xml),以使其适用于ruby 1.9.2,最新的rubygems,最新的捆绑器,最新的rdoc,最新的rake。它在1.8.7中工作正常,但仅在1.9.2中有“未初始化的常量Rake :: DSL”错误。我认为rake 0.9.2固定了但可能没有?我在StackOverflow上已经阅读了很多,但仍然被卡住了。关于在哪里看的任何想法?
ivan:~/Development/ruby/whm_xml_api_ruby [git:master+] → bundle exec rake -T
(in /Users/ivan/Development/ruby/whm_xml_api_ruby)
rake aborted!
uninitialized constant Rake::DSL
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (required)>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rdoc-3.6.1/lib/rdoc/task.rb:37:in `require'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rdoc-3.6.1/lib/rdoc/task.rb:37:in `<top (required)>'
/Users/ivan/Development/ruby/whm_xml_api_ruby/Rakefile:3:in `require'
/Users/ivan/Development/ruby/whm_xml_api_ruby/Rakefile:3:in `<top (required)>'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373:in `load'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:1991:in `run'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
答案 0 :(得分:55)
This SO Question可能会帮助你。建议在require 'rake/dsl_definition'
中将require 'rake'
添加到Rakefile
之上。
答案 1 :(得分:3)
我认为这是rake 0.9.0版本发生的事情。试着把它放在你的Gemfile中: gem 'rake', '0.8.7'
<强>更新强>
您可以尝试添加
include Rake::DSL if defined?(Rake::DSL)
到您的应用;它一度适用于我的Rails应用程序。
答案 2 :(得分:3)
我骗了包括Rake :: DSL等,并且还遇到了其他错误。
添加
gem'rake','0.8.7'
到Gemfile似乎对我有用
答案 3 :(得分:1)
我遇到了与0.9.1相同的问题,安装了0.9.2但它运行但db:migrate命令发送了一条消息警告:不推荐全局访问Rake DSL方法。请.... 它解决了添加到rake文件 module :: yourappname 课程申请 包括Rake :: DSL 结束 结束 和 需要'rake / dsl_definition' 之前.. LoadTask条目