我有ruby 1.9.2和rails 3.1。我试图让注释2.4.0工作,但我得到nomethod错误。我尝试卸载并重新安装,但它没有帮助。跳转后请看线轴。有关如何进行的任何建议都会有所帮助。
~/myapps/testapp/app>sudo gem install annotate
Fetching: annotate-2.4.0.gem (100%)
Successfully installed annotate-2.4.0
1 gem installed
~/myapps/testapp/app>bundle exec annotate -e -p before
/Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/bin/annotate:61:in block (2 levels) in <top (required)>': undefined methodeach' for nil:NilClass (NoMethodError)
from /Users/mymachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:1308:in call'
from /Users/mymachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:1308:inblock in parse_in_order'
from /Users/mymachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:1264:in catch'
from /Users/mymachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:1264:inparse_in_order'
from /Users/mymachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:1258:in order!'
from /Users/mymachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:1349:inpermute!'
from /Users/mymachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/optparse.rb:1370:in parse!'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/bin/annotate:8:in'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in load'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in'
答案 0 :(得分:0)
-e标志需要你没有给出的参数。
您可以通过查看堆栈跟踪来判断,错误是nil
没有方法each
。由于在optparse文件中引发了错误,您可以推断出optparse试图迭代某些不存在的选项。当然,这导致annotate -h
表示“-e, - exclude [tests,fixtures]不注释灯具,测试文件或两者兼而有之”