注释gem:没有要加载的文件?

时间:2012-08-05 18:29:12

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.1

当我运行Annotate Model Gem的命令来注释我的模型时,我得到以下错误,并使用这两种方法来安装gem:

$ annotate --exclude tests, fixtures
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
        from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/annotate-2.5.0/bin/annotate:3:i
        from c:/Ruby192/bin/annotate:19:in `load'
        from c:/Ruby192/bin/annotate:19:in `<main>'

$ bundle exec annotate --exclude tests, fixtures
c:/Ruby192/lib/ruby/gems/1.9.1/gems/annotate-2.5.0/bin/annotate:3:in `require': no such file to load -- rake/dsl_definition (LoadError)
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/annotate-2.5.0/bin/annotate:3:in `<top (required)>'
        from c:/Ruby192/lib/ruby/gems/1.9.1/bin/annotate:19:in `load'
        from c:/Ruby192/lib/ruby/gems/1.9.1/bin/annotate:19:in `<main>'

的Gemfile

gem "rails", "3.1.0"
gem "rake", "0.8.7"

group :development do
  gem "annotate", "2.5.0"
end

命令行:

$ gem install annotate
Successfully installed annotate-2.5.0
1 gem installed

我怎样才能让这个宝石起作用?

1 个答案:

答案 0 :(得分:4)

请更新rake。版本 0.9 中引入了Rake::DSL

bundle update rake