注释找不到 rake 可执行文件

发布于 2024-11-25 10:57:36 字数 1367 浏览 1 评论 0原文

我正在使用 ctran/annotate_models 来注释我的模型和路由文件。我现在收到错误:

$ annotate -r
$ROOT/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:151:in `block in cripple_rubygems': can't find executable rake (Gem::Exception)
from $ROOT/usr/lib/ruby/gems/1.9.1/bin/rake:19:in `<main>'
Route file annotated.

...结果 annotate 将注释块添加到 config/routes.db,但注释为空。该消息表明 annotate 无法找到 rake,但 rake 确实存在:

$ which rake
$ROOT/usr/bin/rake

以下是 rake 关于当前配置的说明

$ rake about
About your application's environment
Ruby version              1.9.2 (x86_64-darwin10.6.0)
RubyGems version          1.3.7
Rack version              1.2
Rails version             3.0.5
Active Record version     3.0.5
Action Pack version       3.0.5
Active Resource version   3.0.5
Action Mailer version     3.0.5
Active Support version    3.0.5
Application root          .../myapp
Environment               development

:我的 Gemfile 中有点奇怪的是我指定了以前版本的 rake:

# file: Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'rake', '0.8.7'             # workaround "uninitialized constant Rake::DSL" bug
...
gem 'annotate', '2.4.0'

有什么问题的想法吗?

I'm using ctran/annotate_models to annotate my models and route files. I'm now getting an error:

$ annotate -r
$ROOT/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:151:in `block in cripple_rubygems': can't find executable rake (Gem::Exception)
from $ROOT/usr/lib/ruby/gems/1.9.1/bin/rake:19:in `<main>'
Route file annotated.

...with the result that annotate adds the comment block to config/routes.db, but the comment is empty. The message suggests that annotate can't find rake, but rake is certainly there:

$ which rake
$ROOT/usr/bin/rake

and here's what rake says about the current configuration:

$ rake about
About your application's environment
Ruby version              1.9.2 (x86_64-darwin10.6.0)
RubyGems version          1.3.7
Rack version              1.2
Rails version             3.0.5
Active Record version     3.0.5
Action Pack version       3.0.5
Active Resource version   3.0.5
Action Mailer version     3.0.5
Active Support version    3.0.5
Application root          .../myapp
Environment               development

The only things that's slightly odd in my Gemfile is that I am specifying a previous version of rake:

# file: Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'rake', '0.8.7'             # workaround "uninitialized constant Rake::DSL" bug
...
gem 'annotate', '2.4.0'

Any ideas of what's wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

折戟 2024-12-02 10:57:36

尝试使用 bundle exec rake 代替。

Try using bundle exec rake instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文