diff options
Diffstat (limited to 'lib/bundler/vendor/thor/lib')
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor.rb | 11 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/actions.rb | 2 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb | 6 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/error.rb | 2 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/parser/arguments.rb | 6 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/parser/options.rb | 17 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/shell/basic.rb | 7 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/shell/color.rb | 6 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/version.rb | 2 |
9 files changed, 36 insertions, 23 deletions
diff --git a/lib/bundler/vendor/thor/lib/thor.rb b/lib/bundler/vendor/thor/lib/thor.rb index f2a03388cc..0794dbb522 100644 --- a/lib/bundler/vendor/thor/lib/thor.rb +++ b/lib/bundler/vendor/thor/lib/thor.rb @@ -1,7 +1,7 @@ -require "set" require_relative "thor/base" class Bundler::Thor + $thor_runner ||= false class << self # Allows for custom "Command" package naming. # @@ -323,7 +323,7 @@ class Bundler::Thor # ==== Parameters # Symbol ...:: A list of commands that should be affected. def stop_on_unknown_option!(*command_names) - stop_on_unknown_option.merge(command_names) + @stop_on_unknown_option = stop_on_unknown_option | command_names end def stop_on_unknown_option?(command) #:nodoc: @@ -337,7 +337,7 @@ class Bundler::Thor # ==== Parameters # Symbol ...:: A list of commands that should be affected. def disable_required_check!(*command_names) - disable_required_check.merge(command_names) + @disable_required_check = disable_required_check | command_names end def disable_required_check?(command) #:nodoc: @@ -347,12 +347,12 @@ class Bundler::Thor protected def stop_on_unknown_option #:nodoc: - @stop_on_unknown_option ||= Set.new + @stop_on_unknown_option ||= [] end # help command has the required check disabled by default. def disable_required_check #:nodoc: - @disable_required_check ||= Set.new([:help]) + @disable_required_check ||= [:help] end # The method responsible for dispatching given the args. @@ -398,7 +398,6 @@ class Bundler::Thor # the namespace should be displayed as arguments. # def banner(command, namespace = nil, subcommand = false) - $thor_runner ||= false command.formatted_usage(self, $thor_runner, subcommand).split("\n").map do |formatted_usage| "#{basename} #{formatted_usage}" end.join("\n") diff --git a/lib/bundler/vendor/thor/lib/thor/actions.rb b/lib/bundler/vendor/thor/lib/thor/actions.rb index a5368d07f3..de9323b2db 100644 --- a/lib/bundler/vendor/thor/lib/thor/actions.rb +++ b/lib/bundler/vendor/thor/lib/thor/actions.rb @@ -219,7 +219,7 @@ class Bundler::Thor contents = if is_uri require "open-uri" - open(path, "Accept" => "application/x-thor-template", &:read) + URI.open(path, "Accept" => "application/x-thor-template", &:read) else open(path, &:read) end diff --git a/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb b/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb index afdbd53dd0..62c82b3dba 100644 --- a/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +++ b/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb @@ -251,7 +251,8 @@ class Bundler::Thor # path<String>:: path of the file to be changed # flag<Regexp|String>:: the regexp or string to be replaced # replacement<String>:: the replacement, can be also given as a block - # config<Hash>:: give :verbose => false to not log the status. + # config<Hash>:: give :verbose => false to not log the status, and + # :force => true, to force the replacement regardles of runner behavior. # # ==== Example # @@ -262,9 +263,10 @@ class Bundler::Thor # end # def gsub_file(path, flag, *args, &block) - return unless behavior == :invoke config = args.last.is_a?(Hash) ? args.pop : {} + return unless behavior == :invoke || config.fetch(:force, false) + path = File.expand_path(path, destination_root) say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true) diff --git a/lib/bundler/vendor/thor/lib/thor/error.rb b/lib/bundler/vendor/thor/lib/thor/error.rb index 1553afd201..7d57129b83 100644 --- a/lib/bundler/vendor/thor/lib/thor/error.rb +++ b/lib/bundler/vendor/thor/lib/thor/error.rb @@ -1,5 +1,5 @@ class Bundler::Thor - Correctable = if defined?(DidYouMean::SpellChecker) && defined?(DidYouMean::Correctable) + Correctable = if defined?(DidYouMean::SpellChecker) && defined?(DidYouMean::Correctable) # rubocop:disable Naming/ConstantName # In order to support versions of Ruby that don't have keyword # arguments, we need our own spell checker class that doesn't take key # words. Even though this code wouldn't be hit because of the check diff --git a/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb b/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb index d0f43e2d97..3a5d82cf29 100644 --- a/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +++ b/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb @@ -30,7 +30,11 @@ class Bundler::Thor arguments.each do |argument| if !argument.default.nil? - @assigns[argument.human_name] = argument.default + begin + @assigns[argument.human_name] = argument.default.dup + rescue TypeError # Compatibility shim for un-dup-able Fixnum in Ruby < 2.4 + @assigns[argument.human_name] = argument.default + end elsif argument.required? @non_assigned_required << argument end diff --git a/lib/bundler/vendor/thor/lib/thor/parser/options.rb b/lib/bundler/vendor/thor/lib/thor/parser/options.rb index 6d1342ee3c..3a8927d09c 100644 --- a/lib/bundler/vendor/thor/lib/thor/parser/options.rb +++ b/lib/bundler/vendor/thor/lib/thor/parser/options.rb @@ -133,15 +133,16 @@ class Bundler::Thor protected - def assign_result!(option, result) - if option.repeatable && option.type == :hash - (@assigns[option.human_name] ||= {}).merge!(result) - elsif option.repeatable - (@assigns[option.human_name] ||= []) << result - else - @assigns[option.human_name] = result + def assign_result!(option, result) + if option.repeatable && option.type == :hash + (@assigns[option.human_name] ||= {}).merge!(result) + elsif option.repeatable + (@assigns[option.human_name] ||= []) << result + else + @assigns[option.human_name] = result + end end - end + # Check if the current value in peek is a registered switch. # # Two booleans are returned. The first is true if the current value diff --git a/lib/bundler/vendor/thor/lib/thor/shell/basic.rb b/lib/bundler/vendor/thor/lib/thor/shell/basic.rb index be48358cb1..2dddd4a53a 100644 --- a/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +++ b/lib/bundler/vendor/thor/lib/thor/shell/basic.rb @@ -94,6 +94,8 @@ class Bundler::Thor # say("I know you knew that.") # def say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/)) + return if quiet? + buffer = prepare_message(message, *color) buffer << "\n" if force_new_line && !message.to_s.end_with?("\n") @@ -230,8 +232,9 @@ class Bundler::Thor paras = message.split("\n\n") paras.map! do |unwrapped| - counter = 0 - unwrapped.split(" ").inject do |memo, word| + words = unwrapped.split(" ") + counter = words.first.length + words.inject do |memo, word| word = word.gsub(/\n\005/, "\n").gsub(/\005/, "\n") counter = 0 if word.include? "\n" if (counter + word.length + 1) < width diff --git a/lib/bundler/vendor/thor/lib/thor/shell/color.rb b/lib/bundler/vendor/thor/lib/thor/shell/color.rb index 29f280202d..dc167ed3cc 100644 --- a/lib/bundler/vendor/thor/lib/thor/shell/color.rb +++ b/lib/bundler/vendor/thor/lib/thor/shell/color.rb @@ -97,7 +97,11 @@ class Bundler::Thor protected def can_display_colors? - stdout.tty? && !are_colors_disabled? + are_colors_supported? && !are_colors_disabled? + end + + def are_colors_supported? + stdout.tty? && ENV["TERM"] != "dumb" end def are_colors_disabled? diff --git a/lib/bundler/vendor/thor/lib/thor/version.rb b/lib/bundler/vendor/thor/lib/thor/version.rb index 1b222da995..a3efa9f762 100644 --- a/lib/bundler/vendor/thor/lib/thor/version.rb +++ b/lib/bundler/vendor/thor/lib/thor/version.rb @@ -1,3 +1,3 @@ class Bundler::Thor - VERSION = "1.0.1" + VERSION = "1.1.0" end |