当使用选项运行rails generated 时,为什么 minitest 会抛出 OptionParse::InvalidOption ?

发布于 2024-12-23 05:22:08 字数 1135 浏览 0 评论 0原文

每当 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 技术交流群。

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

发布评论

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

评论(1

听风念你 2024-12-30 05:22:08

正如日志中所述 - 没有这样的选项 --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

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