Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed but with new invoke() method that broke unit tst

  • Loading branch information...
commit f90ccdad4cb95ff017eef0738eaaac0412def627 1 parent e06251f
Charles Jolley authored
Showing with 7 additions and 3 deletions.
  1. +2 −2 lib/thor.rb
  2. +5 −1 lib/thor/task.rb
View
4 lib/thor.rb
@@ -37,7 +37,7 @@ def self.group_name
@group_name || 'standard'
end
- def self.method_options(opts={})
+ def self.method_options(opts)
@method_options = (@method_options || {}).merge(opts)
end
@@ -101,7 +101,7 @@ def self.invoke(task_name=nil, args = ARGV)
# can override this to provide some class-wide processing. The default
# implementation simply invokes the named method
def invoke(meth, *args)
- send meth, *args
+ self.send(meth, *args)
end
class << self
View
6 lib/thor/task.rb
@@ -26,12 +26,16 @@ def run(obj, *params)
obj.invoke(meth, *params)
rescue ArgumentError => e
+
# backtrace sans anything in this file
backtrace = e.backtrace.reject {|frame| frame =~ /^#{Regexp.escape(__FILE__)}/}
+ # also nix anything in thor.rb
+ backtrace = backtrace.reject { |frame| frame =~ /\/thor.rb/ }
+
# and sans anything that got us here
backtrace -= caller
raise e unless backtrace.empty?
-
+
# okay, they really did call it wrong
raise Error, "`#{meth}' was called incorrectly. Call as `#{formatted_usage}'"
rescue NoMethodError => e
Please sign in to comment.
Something went wrong with that request. Please try again.