diff options
author | Andre Arko <andre@arko.net> | 2013-07-31 14:11:25 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2013-07-31 14:11:25 -0700 |
commit | 04f8e4b298343be8898368efc032a245dfc5ee3c (patch) | |
tree | 8032b7e55d98388a7910f3d8a228dc75a4ab5b9c | |
parent | 92393aba426e215e76a71c2ee2e8000ab417f506 (diff) | |
download | bundler-04f8e4b298343be8898368efc032a245dfc5ee3c.tar.gz |
Update to erikhuda/thor@2b347d4363c9b1bfeb4de2426d5c4edb054f2ced
-rw-r--r-- | lib/bundler/vendor/thor.rb | 2 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/base.rb | 19 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/error.rb | 4 |
3 files changed, 16 insertions, 9 deletions
diff --git a/lib/bundler/vendor/thor.rb b/lib/bundler/vendor/thor.rb index 9eeab586aa..6880b6d7ae 100644 --- a/lib/bundler/vendor/thor.rb +++ b/lib/bundler/vendor/thor.rb @@ -421,7 +421,7 @@ class Thor possibilities = find_command_possibilities(meth) if possibilities.size > 1 - raise ArgumentError, "Ambiguous command #{meth} matches [#{possibilities.join(', ')}]" + raise AmbiguousTaskError, "Ambiguous command #{meth} matches [#{possibilities.join(', ')}]" elsif possibilities.size < 1 meth = meth || default_command elsif map[meth] diff --git a/lib/bundler/vendor/thor/base.rb b/lib/bundler/vendor/thor/base.rb index e33d852e2f..272dae417b 100644 --- a/lib/bundler/vendor/thor/base.rb +++ b/lib/bundler/vendor/thor/base.rb @@ -474,10 +474,10 @@ class Thor alias handle_no_task_error handle_no_command_error def handle_argument_error(command, error, args, arity) #:nodoc: - msg = "ERROR: #{basename} #{command.name} was called with " + msg = "ERROR: \"#{basename} #{command.name}\" was called with " msg << 'no arguments' if args.empty? msg << 'arguments ' << args.inspect if !args.empty? - msg << "\nUsage: #{self.banner(command).inspect}." + msg << "\nUsage: #{self.banner(command).inspect}" raise InvocationError, msg end @@ -603,13 +603,16 @@ class Thor else value = superclass.send(method) - if value - if value.is_a?(TrueClass) || value.is_a?(Symbol) - value - else - value.dup - end + # Ruby implements `dup` on Object, but raises a `TypeError` + # if the method is called on immediates. As a result, we + # don't have a good way to check whether dup will succeed + # without calling it and rescuing the TypeError. + begin + value.dup + rescue TypeError + value end + end end diff --git a/lib/bundler/vendor/thor/error.rb b/lib/bundler/vendor/thor/error.rb index 31e0c4bc5c..3174c57eac 100644 --- a/lib/bundler/vendor/thor/error.rb +++ b/lib/bundler/vendor/thor/error.rb @@ -13,6 +13,10 @@ class Thor end UndefinedTaskError = UndefinedCommandError + class AmbiguousCommandError < Error + end + AmbiguousTaskError = AmbiguousCommandError + # Raised when a command was found, but not invoked properly. class InvocationError < Error end |