wycats/thor — pull request #204 by hectcastro (2011-12-03 17:56:20+00:00)
Title: Fixes issues with handling incorrect number of command arguments with JRuby

It looks like Thor decides how command argument errors are handled based on exception backtraces. After taking a closer look, JRuby backtraces include references to Java source code that disrupt `handle_argument_error?`. In order to address this, I added an additional filter to the backtrace that rejects Java source files if `RUBY_PLATFORM` matches `/java/`.

This patch is meant to resolve #179 and makes the specs below pass with JRuby. Any alternate solutions or feedback are welcome.

rspec ./spec/group_spec.rb:34 # Thor::Group#start raises an error when a Thor group task expects arguments
rspec ./spec/group_spec.rb:128 # Thor::Group#invoke_from_option with default type allows to invoke a class from the class binding by the given option
rspec ./spec/runner_spec.rb:107 # Thor::Runner#start does not swallow Thor::Group InvocationError
rspec ./spec/runner_spec.rb:112 # Thor::Runner#start does not swallow Thor InvocationError
rspec ./spec/thor_spec.rb:174 # Thor#start raises an error if a required param is not provided
rspec ./spec/thor_spec.rb:204 # Thor Thor#start when the user enters an unambiguous substring of a command should invoke a command, even when there's an alias the resolves to the same command