diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-23 14:30:49 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-23 14:30:49 +0200 |
commit | edd07b5a7a37783f398a156b2eb99b5b2733a0ae (patch) | |
tree | c3726e647c406d43a10109c1bb584aecdb88c2d9 /railties/lib | |
parent | 178044dbd2bd3ed44148e9b6d6584669aa4b2f93 (diff) | |
download | rails-edd07b5a7a37783f398a156b2eb99b5b2733a0ae.tar.gz rails-edd07b5a7a37783f398a156b2eb99b5b2733a0ae.tar.bz2 rails-edd07b5a7a37783f398a156b2eb99b5b2733a0ae.zip |
Updated vendored thor to 0.11.3.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/generators.rb | 2 | ||||
-rw-r--r-- | railties/lib/generators/actions.rb | 22 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/CHANGELOG.rdoc (renamed from railties/lib/vendor/thor-0.11.2/CHANGELOG.rdoc) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/LICENSE (renamed from railties/lib/vendor/thor-0.11.2/LICENSE) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/README.markdown (renamed from railties/lib/vendor/thor-0.11.2/README.markdown) | 0 | ||||
-rwxr-xr-x | railties/lib/vendor/thor-0.11.3/bin/rake2thor (renamed from railties/lib/vendor/thor-0.11.2/bin/rake2thor) | 0 | ||||
-rwxr-xr-x | railties/lib/vendor/thor-0.11.3/bin/thor (renamed from railties/lib/vendor/thor-0.11.2/bin/thor) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor.rb) | 31 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/actions.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/actions.rb) | 42 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/actions/create_file.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/actions/create_file.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/actions/directory.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/actions/directory.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/actions/empty_directory.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/actions/empty_directory.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/actions/file_manipulation.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/actions/file_manipulation.rb) | 1 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/actions/inject_into_file.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/actions/inject_into_file.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/base.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/base.rb) | 29 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/core_ext/hash_with_indifferent_access.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/core_ext/hash_with_indifferent_access.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/core_ext/ordered_hash.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/core_ext/ordered_hash.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/error.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/error.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/group.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/group.rb) | 1 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/invocation.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/invocation.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/parser.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/parser.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/parser/argument.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/parser/argument.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/parser/arguments.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/parser/arguments.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/parser/option.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/parser/option.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/parser/options.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/parser/options.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/runner.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/runner.rb) | 8 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/shell.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/shell.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/shell/basic.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/shell/basic.rb) | 17 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/shell/color.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/shell/color.rb) | 20 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/task.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/task.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/tasks.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/tasks.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/tasks/install.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/tasks/install.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/tasks/package.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/tasks/package.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/tasks/spec.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/tasks/spec.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.3/lib/thor/util.rb (renamed from railties/lib/vendor/thor-0.11.2/lib/thor/util.rb) | 0 |
35 files changed, 92 insertions, 81 deletions
diff --git a/railties/lib/generators.rb b/railties/lib/generators.rb index dd02eb3f64..64ec808ee4 100644 --- a/railties/lib/generators.rb +++ b/railties/lib/generators.rb @@ -11,7 +11,7 @@ end $:.unshift(File.dirname(__FILE__)) -require 'vendor/thor-0.11.2/lib/thor' +require 'vendor/thor-0.11.3/lib/thor' require 'generators/base' require 'generators/named_base' diff --git a/railties/lib/generators/actions.rb b/railties/lib/generators/actions.rb index 795d420229..55ef212abb 100644 --- a/railties/lib/generators/actions.rb +++ b/railties/lib/generators/actions.rb @@ -4,28 +4,6 @@ module Rails module Generators module Actions - # Loads an external file and execute it in the instance binding. - # - # ==== Parameters - # path<String>:: The path to the file to execute. Can be a web address or - # a relative path from the source root. - # - # ==== Examples - # - # apply "http://gist.github.com/103208" - # - # apply "recipes/jquery.rb" - # - def apply(path, options={}) - verbose = options.fetch(:verbose, true) - path = find_in_source_paths(path) unless path =~ /^http\:\/\// - - log :apply, path, verbose - shell.padding += 1 if verbose - instance_eval(open(path).read) - shell.padding -= 1 if verbose - end - # Install a plugin. You must provide either a Subversion url or Git url. # For a Git-hosted plugin, you can specify if it should be added as a submodule instead of cloned. # diff --git a/railties/lib/vendor/thor-0.11.2/CHANGELOG.rdoc b/railties/lib/vendor/thor-0.11.3/CHANGELOG.rdoc index 544dde8c02..544dde8c02 100644 --- a/railties/lib/vendor/thor-0.11.2/CHANGELOG.rdoc +++ b/railties/lib/vendor/thor-0.11.3/CHANGELOG.rdoc diff --git a/railties/lib/vendor/thor-0.11.2/LICENSE b/railties/lib/vendor/thor-0.11.3/LICENSE index 98722da459..98722da459 100644 --- a/railties/lib/vendor/thor-0.11.2/LICENSE +++ b/railties/lib/vendor/thor-0.11.3/LICENSE diff --git a/railties/lib/vendor/thor-0.11.2/README.markdown b/railties/lib/vendor/thor-0.11.3/README.markdown index a1d7259775..a1d7259775 100644 --- a/railties/lib/vendor/thor-0.11.2/README.markdown +++ b/railties/lib/vendor/thor-0.11.3/README.markdown diff --git a/railties/lib/vendor/thor-0.11.2/bin/rake2thor b/railties/lib/vendor/thor-0.11.3/bin/rake2thor index 50c7410d80..50c7410d80 100755 --- a/railties/lib/vendor/thor-0.11.2/bin/rake2thor +++ b/railties/lib/vendor/thor-0.11.3/bin/rake2thor diff --git a/railties/lib/vendor/thor-0.11.2/bin/thor b/railties/lib/vendor/thor-0.11.3/bin/thor index eaf849fb4a..eaf849fb4a 100755 --- a/railties/lib/vendor/thor-0.11.2/bin/thor +++ b/railties/lib/vendor/thor-0.11.3/bin/thor diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor.rb b/railties/lib/vendor/thor-0.11.3/lib/thor.rb index ee4ef23309..f65455cdda 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor.rb @@ -166,16 +166,19 @@ class Thor shell.say task.description else list = (options[:short] ? tasks : all_tasks).map do |_, task| - [ banner(task, options[:namespace]), task.short_description || '' ] + item = [ " " + banner(task, options[:namespace]) ] + item << if task.short_description + "\n # #{task.short_description}\n" + else + "\n" + end end if options[:short] - shell.print_table(list, :emphasize_last => true) + shell.print_table(list) else shell.say "Tasks:" - shell.print_table(list, :ident => 2, :emphasize_last => true) - shell.say - + shell.print_table(list) class_options_help(shell, "Class") end end @@ -196,13 +199,19 @@ class Thor Thor end - def valid_task?(meth) #:nodoc: - @usage && @desc - end - def create_task(meth) #:nodoc: - tasks[meth.to_s] = Thor::Task.new(meth, @desc, @usage, method_options) - @usage, @desc, @method_options = nil + if @usage && @desc + tasks[meth.to_s] = Thor::Task.new(meth, @desc, @usage, method_options) + @usage, @desc, @method_options = nil + true + elsif self.all_tasks[meth.to_s] || meth.to_sym == :method_missing + true + else + puts "[WARNING] Attempted to create task #{meth.inspect} without usage or description. " << + "Call desc if you want this method to be available as task or declare it inside a " << + "no_tasks{} block. Invoked from #{caller[1].inspect}." + false + end end def initialize_added #:nodoc: diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/actions.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/actions.rb index f7b271dbe1..b8cfde1940 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/actions.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/actions.rb @@ -158,11 +158,34 @@ class Thor inside(@destination_stack.first) { yield } end + # Loads an external file and execute it in the instance binding. + # + # ==== Parameters + # path<String>:: The path to the file to execute. Can be a web address or + # a relative path from the source root. + # + # ==== Examples + # + # apply "http://gist.github.com/103208" + # + # apply "recipes/jquery.rb" + # + def apply(path, config={}) + verbose = config.fetch(:verbose, true) + path = find_in_source_paths(path) unless path =~ /^http\:\/\// + + say_status :apply, path, verbose + shell.padding += 1 if verbose + instance_eval(open(path).read) + shell.padding -= 1 if verbose + end + # Executes a command. # # ==== Parameters # command<String>:: the command to be executed. - # config<Hash>:: give :verbose => false to not log the status. + # config<Hash>:: give :verbose => false to not log the status. Specify :with + # to append an executable to command executation. # # ==== Example # @@ -172,7 +195,16 @@ class Thor # def run(command, config={}) return unless behavior == :invoke - say_status :run, command, config.fetch(:verbose, true) + + destination = relative_to_original_destination_root(destination_root, false) + desc = "#{command} from #{destination.inspect}" + + if config[:with] + desc = "#{File.basename(config[:with].to_s)} #{desc}" + command = "#{config[:with]} #{command}" + end + + say_status :run, desc, config.fetch(:verbose, true) `#{command}` unless options[:pretend] end @@ -184,8 +216,7 @@ class Thor # def run_ruby_script(command, config={}) return unless behavior == :invoke - say_status File.basename(Thor::Util.ruby_command), command, config.fetch(:verbose, true) - `#{Thor::Util.ruby_command} #{command}` unless options[:pretend] + run "#{command}", config.merge(:with => Thor::Util.ruby_command) end # Run a thor command. A hash of options can be given and it's converted to @@ -213,8 +244,7 @@ class Thor args.push Thor::Options.to_switches(config) command = args.join(' ').strip - say_status :thor, command, verbose - run "thor #{command}", :verbose => false + run command, :with => :thor, :verbose => verbose end protected diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/create_file.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/create_file.rb index 8f6badee27..8f6badee27 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/create_file.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/create_file.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/directory.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/directory.rb index e33639f4e5..e33639f4e5 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/directory.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/directory.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/empty_directory.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/empty_directory.rb index 03c1fe4af1..03c1fe4af1 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/empty_directory.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/empty_directory.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/file_manipulation.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/file_manipulation.rb index 5a39840404..74c157ba8c 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/file_manipulation.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/file_manipulation.rb @@ -189,6 +189,7 @@ class Thor say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true) ::FileUtils.rm_rf(path) if !options[:pretend] && File.exists?(path) end + alias :remove_dir :remove_file end end diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/inject_into_file.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/inject_into_file.rb index 089bd894e4..089bd894e4 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/actions/inject_into_file.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/actions/inject_into_file.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/base.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/base.rb index caf298dda8..0bdcc1f4d5 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/base.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/base.rb @@ -9,7 +9,8 @@ require 'thor/util' class Thor HELP_MAPPINGS = %w(-h -? --help -D) - THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root) + THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root + action add_file create_file in_root inside run run_ruby_script) module Base attr_accessor :options @@ -375,8 +376,16 @@ class Thor padding = options.collect{ |o| o.aliases.size }.max.to_i * 4 options.each do |option| - list << [ option.usage(padding), option.description || "" ] - list << [ "", "Default: #{option.default}" ] if option.show_default? + item = [ option.usage(padding) ] + + item << if option.description + "# #{option.description}" + else + "" + end + + list << item + list << [ "", "# Default: #{option.default}" ] if option.show_default? end unless list.empty? @@ -386,7 +395,7 @@ class Thor shell.say "Options:" end - shell.print_table(list, :emphasize_last => true, :ident => 2) + shell.print_table(list, :ident => 2) shell.say "" end end @@ -405,7 +414,7 @@ class Thor # def is_thor_reserved_word?(word, type) return false unless THOR_RESERVED_WORDS.include?(word.to_s) - raise "'#{word}' is a Thor reserved word and cannot be defined as #{type}" + raise "#{word.inspect} is a Thor reserved word and cannot be defined as #{type}" end # Build an option and adds it to the given scope. @@ -470,12 +479,10 @@ class Thor return unless public_instance_methods.include?(meth) || public_instance_methods.include?(meth.to_sym) - # Return if @no_tasks is enabled or it's not a valid task - return if @no_tasks || !valid_task?(meth) + return if @no_tasks || !create_task(meth) is_thor_reserved_word?(meth, :task) Thor::Base.register_klass_file(self) - create_task(meth) end # Retrieves a value from superclass. If it reaches the baseclass, @@ -495,12 +502,6 @@ class Thor def baseclass #:nodoc: end - # SIGNATURE: Defines if a given method is a valid_task?. This method is - # called before a new method is added to the class. - def valid_task?(meth) #:nodoc: - true # unless otherwise given - end - # SIGNATURE: Creates a new task if valid_task? is true. This method is # called when a new method is added to the class. def create_task(meth) #:nodoc: diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/core_ext/hash_with_indifferent_access.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/core_ext/hash_with_indifferent_access.rb index 3213961fe4..3213961fe4 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/core_ext/hash_with_indifferent_access.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/core_ext/hash_with_indifferent_access.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/core_ext/ordered_hash.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/core_ext/ordered_hash.rb index 5e4ad5609f..5e4ad5609f 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/core_ext/ordered_hash.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/core_ext/ordered_hash.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/error.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/error.rb index c846e9ce74..c846e9ce74 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/error.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/error.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/group.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/group.rb index ef1476a694..1be1c35ba5 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/group.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/group.rb @@ -233,6 +233,7 @@ class Thor::Group def create_task(meth) #:nodoc: tasks[meth.to_s] = Thor::Task.new(meth, nil, nil, nil) + true end end diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/invocation.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/invocation.rb index 34e7a4b911..34e7a4b911 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/invocation.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/invocation.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/parser.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/parser.rb index 57a3f6e1a5..57a3f6e1a5 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/parser.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/parser.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/parser/argument.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/parser/argument.rb index 2d7f4dbafb..2d7f4dbafb 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/parser/argument.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/parser/argument.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/parser/arguments.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/parser/arguments.rb index 9a2262d6f7..9a2262d6f7 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/parser/arguments.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/parser/arguments.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/parser/option.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/parser/option.rb index 5c43f6b18f..5c43f6b18f 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/parser/option.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/parser/option.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/parser/options.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/parser/options.rb index 01c86b7b27..01c86b7b27 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/parser/options.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/parser/options.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/runner.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/runner.rb index 330de38449..6782c61dec 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/runner.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/runner.rb @@ -281,15 +281,11 @@ class Thor::Runner < Thor unless klass.tasks.empty? base = klass.namespace - if base == "default" - say "\033[1;35m#{base}\033[0m" - else - say "\033[1;34m#{base}\033[0m" - end + color = base == "default" ? :magenta : :blue + say shell.set_color(base, color, true) say "-" * base.length klass.help(shell, :short => true, :namespace => true) - say end end end diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/shell.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/shell.rb index 7ed4a24bfb..7ed4a24bfb 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/shell.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/shell.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/shell/basic.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/shell/basic.rb index 6f1a2ade07..e294c87567 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/shell/basic.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/shell/basic.rb @@ -117,13 +117,6 @@ class Thor formats[0] = formats[0].insert(0, " " * options[:ident]) if options[:ident] formats << "%s" - if options[:emphasize_last] - table.each do |row| - next if row[-1].empty? - row[-1] = "# #{row[-1]}" - end - end - table.each do |row| row.each_with_index do |column, i| $stdout.print formats[i] % column.to_s @@ -175,11 +168,13 @@ class Thor $stderr.puts statement end - protected + # Apply color to the given string with optional bold. + # + def set_color(string, color, bold=false) + string + end - def set_color(string, color, bold=false) - string - end + protected def is?(value) value = value.to_s diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/shell/color.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/shell/color.rb index 67afa65ed2..be7995146a 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/shell/color.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/shell/color.rb @@ -44,17 +44,17 @@ class Thor # Set the terminal's background ANSI color to white. ON_WHITE = "\e[47m" - protected + # Set color by using a string or one of the defined constants. Based + # on Highline implementation. CLEAR is automatically be embedded to + # the end of the returned String. + # + def set_color(string, color, bold=false) + color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol) + bold = bold ? BOLD : "" + "#{bold}#{color}#{string}#{CLEAR}" + end - # Set color by using a string or one of the defined constants. Based - # on Highline implementation. CLEAR is automatically be embedded to - # the end of the returned String. - # - def set_color(string, color, bold=false) - color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol) - bold = bold ? BOLD : "" - "#{bold}#{color}#{string}#{CLEAR}" - end + protected # Overwrite show_diff to show diff with colors if Diff::LCS is # available. diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/task.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/task.rb index 92c0776c04..92c0776c04 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/task.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/task.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/tasks.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/tasks.rb index d1a7b1c673..d1a7b1c673 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/tasks.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/tasks.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/tasks/install.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/tasks/install.rb index 6b20ff1634..6b20ff1634 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/tasks/install.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/tasks/install.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/tasks/package.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/tasks/package.rb index 603d61b4ab..603d61b4ab 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/tasks/package.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/tasks/package.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/tasks/spec.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/tasks/spec.rb index c7d00968e8..c7d00968e8 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/tasks/spec.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/tasks/spec.rb diff --git a/railties/lib/vendor/thor-0.11.2/lib/thor/util.rb b/railties/lib/vendor/thor-0.11.3/lib/thor/util.rb index 26db24aadb..26db24aadb 100644 --- a/railties/lib/vendor/thor-0.11.2/lib/thor/util.rb +++ b/railties/lib/vendor/thor-0.11.3/lib/thor/util.rb |