当使用选项运行rails generated 时,为什么 minitest 会抛出 OptionParse::InvalidOption ?
每当 Rails 生成器使用一个或多个选项运行时,mintiest 都会引发 OptionParse::InvalidOption 。
我正在使用 Rails 3.1、Ruby 1.9.2-p290 和 Mintest 2.10.0。
生成命令实际上会运行并处理传递的选项,但 Minitest 会在最后引发异常和堆栈跟踪:
rails generate model x --no-migration -s -p
invoke active_record
identical app/models/x.rb
invoke test_unit
identical test/unit/x_test.rb
identical test/fixtures/xs.yml
/Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:900:in 'block in process_args': invalid option: --no-migration (OptionParser::InvalidOption)
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:879:in 'new'
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:879:in 'process_args'
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:929:in '_run'
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:922:in 'run'
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:690:in 'block in autorun'
还有其他人遇到过这个吗?
Whenever the Rails generator is run with one or more options, mintiest raises OptionParse::InvalidOption
.
I'm using Rails 3.1, Ruby 1.9.2-p290 and Mintest 2.10.0.
The generate command will actually run and process the passed option(s), but Minitest raises the exception and a stack trace at the end:
rails generate model x --no-migration -s -p
invoke active_record
identical app/models/x.rb
invoke test_unit
identical test/unit/x_test.rb
identical test/fixtures/xs.yml
/Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:900:in 'block in process_args': invalid option: --no-migration (OptionParser::InvalidOption)
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:879:in 'new'
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:879:in 'process_args'
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:929:in '_run'
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:922:in 'run'
from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:690:in 'block in autorun'
Has anyone else come across this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如日志中所述 - 没有这样的选项
--no-migration
(据我所知应该可用),这就是您抛出错误的原因。尝试--skip-migration
As stated in the log - there is no such option
--no-migration
(which as far as I understand should be available) and that is why you are thrown an error. Try--skip-migration