diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-14 22:20:43 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-14 22:20:43 +0200 |
commit | a06c825b464758a0c22f8b089a596e46f1bba5cb (patch) | |
tree | 575916106127d59c3f166c6cebbccc9039a41bcc /railties | |
parent | e96af1eaa22b649e5df816d7931bd3e912e7a6bc (diff) | |
download | rails-a06c825b464758a0c22f8b089a596e46f1bba5cb.tar.gz rails-a06c825b464758a0c22f8b089a596e46f1bba5cb.tar.bz2 rails-a06c825b464758a0c22f8b089a596e46f1bba5cb.zip |
Updated vendored Thor to 0.11.1 and update Rails::Generators.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/generators/actions.rb | 2 | ||||
-rw-r--r-- | railties/lib/generators/base.rb | 128 | ||||
-rw-r--r-- | railties/lib/generators/rails/app/app_generator.rb | 8 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.0/lib/thor/group.rb | 72 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/CHANGELOG.rdoc (renamed from railties/lib/vendor/thor-0.11.0/CHANGELOG.rdoc) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/LICENSE (renamed from railties/lib/vendor/thor-0.11.0/LICENSE) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/README.markdown (renamed from railties/lib/vendor/thor-0.11.0/README.markdown) | 0 | ||||
-rwxr-xr-x | railties/lib/vendor/thor-0.11.1/bin/rake2thor (renamed from railties/lib/vendor/thor-0.11.0/bin/rake2thor) | 0 | ||||
-rwxr-xr-x | railties/lib/vendor/thor-0.11.1/bin/thor (renamed from railties/lib/vendor/thor-0.11.0/bin/thor) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor.rb) | 5 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions.rb) | 88 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions/copy_file.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions/copy_file.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions/create_file.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions/create_file.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions/directory.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions/directory.rb) | 3 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions/empty_directory.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions/empty_directory.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions/get.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions/get.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions/inject_into_file.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions/inject_into_file.rb) | 2 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions/template.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions/template.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/actions/templater.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/actions/templater.rb) | 4 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/base.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/base.rb) | 82 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/core_ext/hash_with_indifferent_access.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/core_ext/hash_with_indifferent_access.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/core_ext/ordered_hash.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/core_ext/ordered_hash.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/error.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/error.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/group.rb | 240 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/invocation.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/invocation.rb) | 69 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/parser.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/parser.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/parser/argument.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/parser/argument.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/parser/arguments.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/parser/arguments.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/parser/option.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/parser/option.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/parser/options.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/parser/options.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/runner.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/runner.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/shell.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/shell.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/shell/basic.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/shell/basic.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/shell/color.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/shell/color.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/task.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/task.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/tasks.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/tasks.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/tasks/install.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/tasks/install.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/tasks/package.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/tasks/package.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/tasks/spec.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/tasks/spec.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor-0.11.1/lib/thor/util.rb (renamed from railties/lib/vendor/thor-0.11.0/lib/thor/util.rb) | 0 | ||||
-rw-r--r-- | railties/lib/vendor/thor.rb | 4 | ||||
-rw-r--r-- | railties/test/generators/actions_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/controller_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/generator_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/helper_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/integration_test_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/mailer_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/metal_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/observer_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/performance_test_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/resource_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/scaffold_controller_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/scaffold_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/session_migration_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/stylesheets_generator_test.rb | 2 |
59 files changed, 430 insertions, 313 deletions
diff --git a/railties/lib/generators/actions.rb b/railties/lib/generators/actions.rb index e0f765f201..34c78aaad8 100644 --- a/railties/lib/generators/actions.rb +++ b/railties/lib/generators/actions.rb @@ -17,7 +17,7 @@ module Rails # apply "recipes/jquery.rb" # def apply(path, log_status=true) - path = File.expand_path(path, source_root) unless path =~ /^http\:\/\// + path = find_in_source_paths(path) unless path =~ /^http\:\/\// log :apply, path, log_status instance_eval(open(path).read) diff --git a/railties/lib/generators/base.rb b/railties/lib/generators/base.rb index 069c25f94a..30f138c62a 100644 --- a/railties/lib/generators/base.rb +++ b/railties/lib/generators/base.rb @@ -104,8 +104,8 @@ module Rails # def self.hook_for(*names, &block) options = names.extract_options! - as = options.fetch(:as, generator_name) - verbose = options.fetch(:verbose, :white) + in_base = options.delete(:in) || base_name + as_hook = options.delete(:as) || generator_name names.each do |name| defaults = if options[:type] == :boolean @@ -116,57 +116,12 @@ module Rails { :desc => "#{name.to_s.humanize} to be invoked", :banner => "NAME" } end - class_option name, defaults.merge!(options) - invocations << [ name, base_name, as ] - invocation_blocks[name] = block if block_given? - - # hook_for :test_framework - # - # ==== Generates - # - # def hook_for_test_framework - # return unless options[:test_framework] - # - # klass_name = options[:test_framework] - # klass_name = :test_framework if TrueClass === klass_name - # klass = Rails::Generators.find_by_namespace(klass_name, "rails", "model") - # - # if klass - # say_status :invoke, options[:test_framework], :white - # shell.padding += 1 - # if block = self.class.invocation_blocks[:test_framework] - # block.call(self, klass) - # else - # invoke klass - # end - # shell.padding -= 1 - # else - # say "Could not find and invoke '#{klass_name}'" - # end - # end - # - class_eval <<-METHOD, __FILE__, __LINE__ - def hook_for_#{name} - return unless options[#{name.inspect}] - - klass_name = options[#{name.inspect}] - klass_name = #{name.inspect} if TrueClass === klass_name - klass = Rails::Generators.find_by_namespace(klass_name, #{base_name.inspect}, #{as.inspect}) + unless class_options.key?(name) + class_option name, defaults.merge!(options) + end - if klass - say_status :invoke, klass_name, #{verbose.inspect} - shell.padding += 1 - if block = self.class.invocation_blocks[#{name.inspect}] - block.call(self, klass) - else - invoke klass - end - shell.padding -= 1 - else - say_status :error, "\#{klass_name} [not found]", :red - end - end - METHOD + hooks[name] = [ in_base, as_hook ] + invoke_from_option name, options, &block end end @@ -177,11 +132,10 @@ module Rails # remove_hook_for :orm # def self.remove_hook_for(*names) + remove_invocation *names + names.each do |name| - remove_class_option name - remove_task name - invocations.delete_if { |i| i[0] == name } - invocation_blocks.delete(name) + hooks.delete(name) end end @@ -189,7 +143,7 @@ module Rails # def self.class_option(name, options={}) #:nodoc: options[:desc] = "Indicates when to generate #{name.to_s.humanize.downcase}" unless options.key?(:desc) - options[:aliases] = Rails::Generators.aliases[name] unless options.key?(:aliases) + options[:aliases] = Rails::Generators.aliases[name] unless options.key?(:aliases) options[:default] = Rails::Generators.options[name] unless options.key?(:default) super(name, options) end @@ -199,7 +153,7 @@ module Rails # Check whether the given class names are already taken by user # application or Ruby on Rails. # - def class_collisions(*class_names) + def class_collisions(*class_names) #:nodoc: return unless behavior == :invoke class_names.flatten.each do |class_name| @@ -231,7 +185,7 @@ module Rails # Use Rails default banner. # def self.banner - "#{$0} #{generator_name} #{self.arguments.map(&:usage).join(' ')} [options]" + "#{$0} #{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]" end # Sets the base_name taking into account the current class namespace. @@ -251,56 +205,20 @@ module Rails end end - # Stores invocations for this class merging with superclass values. - # - def self.invocations #:nodoc: - @invocations ||= from_superclass(:invocations, []) - end - - # Stores invocation blocks used on hook_for and invoke_if. - # - def self.invocation_blocks #:nodoc: - @invocation_blocks ||= from_superclass(:invocation_blocks, {}) - end - - # Overwrite class options help to allow invoked generators options to be - # shown recursively when invoking a generator. + # Keep hooks configuration that are used on prepare_for_invocation. # - def self.class_options_help(shell, ungrouped_name=nil, extra_group=nil) - group_options = Thor::CoreExt::OrderedHash.new - - get_options_from_invocations(group_options, class_options) do |klass| - klass.send(:get_options_from_invocations, group_options, class_options) - end - - group_options.merge!(extra_group) if extra_group - super(shell, ungrouped_name, group_options) + def self.hooks #:nodoc: + @hooks ||= from_superclass(:hooks, {}) end - # Get invocations array and merge options from invocations. Those - # options are added to group_options hash. Options that already exists - # in base_options are not added twice. + # Prepare class invocation to search on Rails namespace if a previous + # added hook is being used. # - def self.get_options_from_invocations(group_options, base_options) - invocations.each do |args| - name, base, generator = args - option = class_options[name] - - klass_name = option.type == :boolean ? name : option.default - next unless klass_name - - klass = Rails::Generators.find_by_namespace(klass_name, base, generator) - next unless klass - - human_name = klass_name.to_s.classify - group_options[human_name] ||= [] - - group_options[human_name] += klass.class_options.values.select do |option| - base_options[option.name.to_sym].nil? && option.group.nil? && - !group_options.values.flatten.any? { |i| i.name == option.name } - end - - yield klass if block_given? + def self.prepare_for_invocation(name, value) #:nodoc: + if value && constants = self.hooks[name] + Rails::Generators.find_by_namespace(value, *constants) + else + super end end diff --git a/railties/lib/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb index 20a06ed16a..88a52c60b0 100644 --- a/railties/lib/generators/rails/app/app_generator.rb +++ b/railties/lib/generators/rails/app/app_generator.rb @@ -46,11 +46,11 @@ module Rails::Generators end def create_root - self.root = File.expand_path(app_path, root) + self.destination_root = File.expand_path(app_path, destination_root) empty_directory '.' app_name # Sets the app name - FileUtils.cd(root) + FileUtils.cd(destination_root) end def create_root_files @@ -162,7 +162,7 @@ module Rails::Generators def apply_rails_template apply options[:template] if options[:template] - rescue LoadError, Errno::ENOENT => e + rescue Thor::Error, LoadError, Errno::ENOENT => e raise Error, "The template [#{options[:template]}] could not be loaded. Error: #{e}" end @@ -180,7 +180,7 @@ module Rails::Generators end def app_name - @app_name ||= File.basename(root) + @app_name ||= File.basename(destination_root) end def app_secret diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/group.rb b/railties/lib/vendor/thor-0.11.0/lib/thor/group.rb deleted file mode 100644 index e4e1533386..0000000000 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/group.rb +++ /dev/null @@ -1,72 +0,0 @@ -class Thor::Group - - class << self - - # The descrition for this Thor::Group. If none is provided, but a source root - # exists, tries to find the USAGE one folder above it, otherwise searches - # in the superclass. - # - # ==== Parameters - # description<String>:: The description for this Thor::Group. - # - def desc(description=nil) - case description - when nil - @desc ||= from_superclass(:desc, nil) - else - @desc = description - end - end - - # Start works differently in Thor::Group, it simply invokes all tasks - # inside the class. - # - def start(given_args=ARGV, config={}) - super do - if Thor::HELP_MAPPINGS.include?(given_args.first) - help(config[:shell]) - return - end - - args, opts = Thor::Options.split(given_args) - new(args, opts, config).invoke - end - end - - # Prints help information. - # - # ==== Options - # short:: When true, shows only usage. - # - def help(shell, options={}) - if options[:short] - shell.say banner - else - shell.say "Usage:" - shell.say " #{banner}" - shell.say - class_options_help(shell) - shell.say self.desc if self.desc - end - end - - protected - - # The banner for this class. You can customize it if you are invoking the - # thor class by another means which is not the Thor::Runner. - # - def banner #:nodoc: - "#{self.namespace} #{self.arguments.map {|a| a.usage }.join(' ')}" - end - - def baseclass #:nodoc: - Thor::Group - end - - def create_task(meth) #:nodoc: - tasks[meth.to_s] = Thor::Task.new(meth, nil, nil, nil) - end - end - - include Thor::Base -end diff --git a/railties/lib/vendor/thor-0.11.0/CHANGELOG.rdoc b/railties/lib/vendor/thor-0.11.1/CHANGELOG.rdoc index 544dde8c02..544dde8c02 100644 --- a/railties/lib/vendor/thor-0.11.0/CHANGELOG.rdoc +++ b/railties/lib/vendor/thor-0.11.1/CHANGELOG.rdoc diff --git a/railties/lib/vendor/thor-0.11.0/LICENSE b/railties/lib/vendor/thor-0.11.1/LICENSE index 98722da459..98722da459 100644 --- a/railties/lib/vendor/thor-0.11.0/LICENSE +++ b/railties/lib/vendor/thor-0.11.1/LICENSE diff --git a/railties/lib/vendor/thor-0.11.0/README.markdown b/railties/lib/vendor/thor-0.11.1/README.markdown index a1d7259775..a1d7259775 100644 --- a/railties/lib/vendor/thor-0.11.0/README.markdown +++ b/railties/lib/vendor/thor-0.11.1/README.markdown diff --git a/railties/lib/vendor/thor-0.11.0/bin/rake2thor b/railties/lib/vendor/thor-0.11.1/bin/rake2thor index 50c7410d80..50c7410d80 100755 --- a/railties/lib/vendor/thor-0.11.0/bin/rake2thor +++ b/railties/lib/vendor/thor-0.11.1/bin/rake2thor diff --git a/railties/lib/vendor/thor-0.11.0/bin/thor b/railties/lib/vendor/thor-0.11.1/bin/thor index eaf849fb4a..eaf849fb4a 100755 --- a/railties/lib/vendor/thor-0.11.0/bin/thor +++ b/railties/lib/vendor/thor-0.11.1/bin/thor diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor.rb b/railties/lib/vendor/thor-0.11.1/lib/thor.rb index 72d5574983..ee4ef23309 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor.rb @@ -4,9 +4,7 @@ require 'thor/group' require 'thor/actions' class Thor - class << self - # Sets the default task when thor is executed without an explicit task to be called. # # ==== Parameters @@ -108,7 +106,7 @@ class Thor # :group - The group for this options. Use by class options to output options in different levels. # :banner - String to show on usage notes. # - def method_option(name, options) + def method_option(name, options={}) scope = if options[:for] find_and_refresh_task(options[:for]).options else @@ -220,7 +218,6 @@ class Thor meth = mapping || meth || default_task meth.to_s.gsub('-','_') # treat foo-bar > foo_bar end - end include Thor::Base diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions.rb index 126d8df428..b64ea1c878 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions.rb @@ -38,8 +38,8 @@ class Thor # It also accepts :force, :skip and :pretend to set the behavior # and the respective option. # - # root<String>:: The root directory needed for some actions. It's also known - # as destination root. + # destination_root<String>:: The root directory needed for some actions. It's also known + # as destination root. # def initialize(args=[], options={}, config={}) self.behavior = case config[:behavior].to_s @@ -53,7 +53,7 @@ class Thor end super - self.root = config[:root] + self.destination_root = config[:destination_root] end # Wraps an action object and call it accordingly to the thor class behavior. @@ -68,44 +68,44 @@ class Thor # Returns the root for this thor class (also aliased as destination root). # - def root - @root_stack.last + def destination_root + @destination_stack.last end - alias :destination_root :root # Sets the root for this thor class. Relatives path are added to the # directory where the script was invoked and expanded. # - def root=(root) - @root_stack ||= [] - @root_stack[0] = File.expand_path(root || '') - end - - # Gets the current root relative to the absolute root. - # - # inside "foo" do - # relative_root #=> "foo" - # end - # - def relative_root(remove_dot=true) - relative_to_absolute_root(root, remove_dot) + def destination_root=(root) + @destination_stack ||= [] + @destination_stack[0] = File.expand_path(root || '') end # Returns the given path relative to the absolute root (ie, root where # the script started). # - def relative_to_absolute_root(path, remove_dot=true) - path = path.gsub(@root_stack[0], '.') + def relative_to_original_destination_root(path, remove_dot=true) + path = path.gsub(@destination_stack[0], '.') remove_dot ? (path[2..-1] || '') : path end - # Get the source root in the class. Raises an error if a source root is - # not specified in the thor class. + # Receives a file or directory and serach for it in the source paths. Paths + # added for last are the one searched first. # - def source_root - self.class.source_root - rescue NoMethodError => e - raise NoMethodError, "You have to specify the class method source_root in your thor class." + def find_in_source_paths(file) + relative_root = relative_to_original_destination_root(destination_root, false) + source_file = nil + + self.class.source_paths.reverse_each do |source| + source_file = File.expand_path(file, File.join(source, relative_root)) + return source_file if File.exists?(source_file) + end + + if self.class.source_paths.empty? + raise Error, "You don't have any source path defined for class #{self.class.name}. To fix this, " << + "you can define a source_root in your class." + else + raise Error, "Could not find #{file.inspect} in source paths." + end end # Do something in the root or on a provided subfolder. If a relative path @@ -117,16 +117,16 @@ class Thor # dir<String>:: the directory to move to. # def inside(dir='', &block) - @root_stack.push File.expand_path(dir, root) - FileUtils.mkdir_p(root) unless File.exist?(root) - FileUtils.cd(root) { block.arity == 1 ? yield(root) : yield } - @root_stack.pop + @destination_stack.push File.expand_path(dir, destination_root) + FileUtils.mkdir_p(destination_root) unless File.exist?(destination_root) + FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield } + @destination_stack.pop end # Goes to the root and execute the given block. # def in_root - inside(@root_stack.first) { yield } + inside(@destination_stack.first) { yield } end # Changes the mode of the given file or directory. @@ -143,8 +143,8 @@ class Thor # def chmod(path, mode, log_status=true) return unless behavior == :invoke - path = File.expand_path(path, root) - say_status :chmod, relative_to_absolute_root(path), log_status + path = File.expand_path(path, destination_root) + say_status :chmod, relative_to_original_destination_root(path), log_status FileUtils.chmod_R(mode, path) unless options[:pretend] end @@ -163,7 +163,7 @@ class Thor # def run(command, log_status=true) return unless behavior == :invoke - say_status :run, "\"#{command}\" from #{relative_to_absolute_root(root, false)}", log_status + say_status :run, "\"#{command}\" from #{relative_to_original_destination_root(destination_root, false)}", log_status `#{command}` unless options[:pretend] end @@ -224,10 +224,10 @@ class Thor # def remove_file(path, log_status=true) return unless behavior == :invoke - path = File.expand_path(path, root) + path = File.expand_path(path, destination_root) color = log_status.is_a?(Symbol) ? log_status : :red - say_status :remove, relative_to_absolute_root(path), log_status + say_status :remove, relative_to_original_destination_root(path), log_status ::FileUtils.rm_rf(path) if !options[:pretend] && File.exists?(path) end @@ -252,8 +252,8 @@ class Thor return unless behavior == :invoke log_status = args.last.is_a?(Symbol) || [ true, false ].include?(args.last) ? args.pop : true - path = File.expand_path(path, root) - say_status :gsub, relative_to_absolute_root(path), log_status + path = File.expand_path(path, destination_root) + say_status :gsub, relative_to_original_destination_root(path), log_status unless options[:pretend] content = File.read(path) @@ -276,8 +276,8 @@ class Thor # def append_file(path, data=nil, log_status=true, &block) return unless behavior == :invoke - path = File.expand_path(path, root) - say_status :append, relative_to_absolute_root(path), log_status + path = File.expand_path(path, destination_root) + say_status :append, relative_to_original_destination_root(path), log_status File.open(path, 'ab') { |file| file.write(data || block.call) } unless options[:pretend] end @@ -295,8 +295,8 @@ class Thor # def prepend_file(path, data=nil, log_status=true, &block) return unless behavior == :invoke - path = File.expand_path(path, root) - say_status :prepend, relative_to_absolute_root(path), log_status + path = File.expand_path(path, destination_root) + say_status :prepend, relative_to_original_destination_root(path), log_status unless options[:pretend] content = data || block.call @@ -310,7 +310,7 @@ class Thor # Allow current root to be shared between invocations. # def _shared_configuration #:nodoc: - super.merge!(:root => self.root) + super.merge!(:destination_root => self.destination_root) end def _cleanup_options_and_set(options, key) #:nodoc: diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/copy_file.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/copy_file.rb index b9d2e9e0a7..b9d2e9e0a7 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/copy_file.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/copy_file.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/create_file.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/create_file.rb index 2f3732247e..2f3732247e 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/create_file.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/create_file.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/directory.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/directory.rb index 24ff210b0f..134f13d1b7 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/directory.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/directory.rb @@ -53,7 +53,6 @@ class Thor end def invoke! - raise "Source #{source.inspect} does not exist" unless File.exists?(source) base.empty_directory given_destination, @log_status execute! end @@ -69,8 +68,8 @@ class Thor lookup = File.join(lookup, '{*,.[a-z]*}') Dir[lookup].each do |file_source| - file_destination = File.join(given_destination, file_source.gsub(source, '.')) next if File.directory?(file_source) + file_destination = File.join(given_destination, file_source.gsub(source, '.')) case file_source when /\.empty_directory$/ diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/empty_directory.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/empty_directory.rb index 3f29d52362..3f29d52362 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/empty_directory.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/empty_directory.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/get.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/get.rb index a0d12b8370..a0d12b8370 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/get.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/get.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/inject_into_file.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/inject_into_file.rb index ab6a90d317..c91bd96098 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/inject_into_file.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/inject_into_file.rb @@ -68,7 +68,7 @@ class Thor def destination=(destination) if destination @destination = ::File.expand_path(destination.to_s, base.destination_root) - @relative_destination = base.relative_to_absolute_root(@destination) + @relative_destination = base.relative_to_original_destination_root(@destination) end end diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/template.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/template.rb index 6b2e50b8c5..6b2e50b8c5 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/template.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/template.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/templater.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/templater.rb index 5aa2f99b16..b4b7bae3af 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/actions/templater.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/actions/templater.rb @@ -101,7 +101,7 @@ class Thor # def source=(source) if source - @source = ::File.expand_path(source.to_s, File.join(base.source_root, base.relative_root)) + @source = ::File.expand_path(base.find_in_source_paths(source.to_s)) end end @@ -123,7 +123,7 @@ class Thor if destination @given_destination = convert_encoded_instructions(destination.to_s) @destination = ::File.expand_path(@given_destination, base.destination_root) - @relative_destination = base.relative_to_absolute_root(@destination) + @relative_destination = base.relative_to_original_destination_root(@destination) end end diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/base.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/base.rb index e6d364e767..fcd2a82be0 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/base.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/base.rb @@ -9,7 +9,7 @@ require 'thor/util' class Thor HELP_MAPPINGS = %w(-h -? --help -D) - THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root source_root) + THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root) module Base attr_accessor :options @@ -75,16 +75,16 @@ class Thor # Whenever a class inherits from Thor or Thor::Group, we should track the # class and the file on Thor::Base. This is the method responsable for it. - # Also invoke the source_root if the klass respond to it. This is needed - # to ensure that the source_root does not change after FileUtils#cd is - # called. + # Also adds the source root to the source paths if the klass respond to it. # def register_klass_file(klass) #:nodoc: file = caller[1].match(/(.*):\d+/)[1] - - klass.source_root if klass.respond_to?(:source_root) Thor::Base.subclasses << klass unless Thor::Base.subclasses.include?(klass) + if klass.respond_to?(:source_root) && !klass.source_paths.include?(klass.source_root) + klass.source_paths.unshift(klass.source_root) + end + file_subclasses = Thor::Base.subclass_files[File.expand_path(file)] file_subclasses << klass unless file_subclasses.include?(klass) end @@ -189,7 +189,7 @@ class Thor # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. # :banner - String to show on usage notes. # - def class_option(name, options) + def class_option(name, options={}) build_option(name, options, class_options) end @@ -341,6 +341,13 @@ class Thor end end + # Hold source paths used by Thor::Actions. Paths added for last are the + # one searched first. + # + def source_paths + @source_paths ||= [] + end + # Default way to start generators from the command line. # def start(given_args=ARGV, config={}) #:nodoc: @@ -359,51 +366,48 @@ class Thor # Prints the class options per group. If an option does not belong to # any group, it uses the ungrouped name value. This method provide to # hooks to add extra options, one of them if the third argument called - # extra_group that should be a Thor::CoreExt::OrderedHash in the format - # :group => Array[Options]. + # extra_group that should be a hash in the format :group => Array[Options]. # # The second is by returning a lamda used to print values. The lambda # requires two options: the group name and the array of options. # def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: - unless self.class_options.empty? - groups = {} - - class_options.each do |_, value| - groups[value.group] ||= [] - groups[value.group] << value - end + groups = {} - printer = proc do |group_name, options| - list = [] - padding = options.collect{ |o| o.aliases.size }.max.to_i * 4 + class_options.each do |_, value| + groups[value.group] ||= [] + groups[value.group] << value + end - options.each do |option| - list << [ option.usage(padding), option.description || "" ] - list << [ "", "Default: #{option.default}" ] if option.show_default? - end + printer = proc do |group_name, options| + list = [] + padding = options.collect{ |o| o.aliases.size }.max.to_i * 4 - unless list.empty? - if group_name - shell.say "#{group_name} options:" - else - shell.say "Options:" - end + options.each do |option| + list << [ option.usage(padding), option.description || "" ] + list << [ "", "Default: #{option.default}" ] if option.show_default? + end - shell.print_table(list, :emphasize_last => true, :ident => 2) - shell.say "" + unless list.empty? + if group_name + shell.say "#{group_name} options:" + else + shell.say "Options:" end + + shell.print_table(list, :emphasize_last => true, :ident => 2) + shell.say "" end + end - # Deal with default group - global_options = groups.delete(nil) || [] - printer.call(ungrouped_name, global_options) if global_options + # Deal with default group + global_options = groups.delete(nil) || [] + printer.call(ungrouped_name, global_options) if global_options - # Print all others - groups = extra_group.merge(groups) if extra_group - groups.each(&printer) - printer - end + # Print all others + groups = extra_group.merge(groups) if extra_group + groups.each(&printer) + printer end # Raises an error if the word given is a Thor reserved word. diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/core_ext/hash_with_indifferent_access.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/core_ext/hash_with_indifferent_access.rb index 3213961fe4..3213961fe4 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/core_ext/hash_with_indifferent_access.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/core_ext/hash_with_indifferent_access.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/core_ext/ordered_hash.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/core_ext/ordered_hash.rb index 5e4ad5609f..5e4ad5609f 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/core_ext/ordered_hash.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/core_ext/ordered_hash.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/error.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/error.rb index c846e9ce74..c846e9ce74 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/error.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/error.rb diff --git a/railties/lib/vendor/thor-0.11.1/lib/thor/group.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/group.rb new file mode 100644 index 0000000000..63267934c7 --- /dev/null +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/group.rb @@ -0,0 +1,240 @@ +# Thor has a special class called Thor::Group. The main difference to Thor class +# is that it invokes all tasks at once. It also include some methods that allows +# invocations to be done at the class method, which are not available to Thor +# tasks. +# +class Thor::Group + class << self + # The descrition for this Thor::Group. If none is provided, but a source root + # exists, tries to find the USAGE one folder above it, otherwise searches + # in the superclass. + # + # ==== Parameters + # description<String>:: The description for this Thor::Group. + # + def desc(description=nil) + case description + when nil + @desc ||= from_superclass(:desc, nil) + else + @desc = description + end + end + + # Start works differently in Thor::Group, it simply invokes all tasks + # inside the class. + # + def start(given_args=ARGV, config={}) + super do + if Thor::HELP_MAPPINGS.include?(given_args.first) + help(config[:shell]) + return + end + + args, opts = Thor::Options.split(given_args) + new(args, opts, config).invoke + end + end + + # Prints help information. + # + # ==== Options + # short:: When true, shows only usage. + # + def help(shell, options={}) + if options[:short] + shell.say banner + else + shell.say "Usage:" + shell.say " #{banner}" + shell.say + class_options_help(shell) + shell.say self.desc if self.desc + end + end + + # Stores invocations for this class merging with superclass values. + # + def invocations #:nodoc: + @invocations ||= from_superclass(:invocations, {}) + end + + # Stores invocation blocks used on invoke_from_option. + # + def invocation_blocks #:nodoc: + @invocation_blocks ||= from_superclass(:invocation_blocks, {}) + end + + # Invoke the given namespace or class given. It adds an instance + # method that will invoke the klass and task. You can give a block to + # configure how it will be invoked. + # + # The namespace/class given will have its options showed on the help + # usage. Check invoke_from_option for more information. + # + def invoke(*names, &block) + options = names.last.is_a?(Hash) ? names.pop : {} + verbose = options.fetch(:verbose, :white) + + names.each do |name| + invocations[name] = false + invocation_blocks[name] = block if block_given? + + class_eval <<-METHOD, __FILE__, __LINE__ + def _invoke_#{name.to_s.gsub(/\W/, '_')} + klass, task = self.class.prepare_for_invocation(nil, #{name.inspect}) + + if klass + say_status :invoke, #{name.inspect}, #{verbose.inspect} + block = self.class.invocation_blocks[#{name.inspect}] + invoke_with_padding klass, task, &block + else + say_status :error, %(#{name.inspect} [not found]), :red + end + end + METHOD + end + end + + # Invoke a thor class based on the value supplied by the user to the + # given option named "name". A class option must be created before this + # method is invoked for each name given. + # + # ==== Examples + # + # class GemGenerator < Thor::Group + # class_option :test_framework, :type => :string + # invoke_from_option :test_framework + # end + # + # ==== Boolean options + # + # In some cases, you want to invoke a thor class if some option is true or + # false. This is automatically handled by invoke_from_option. Then the + # option name is used to invoke the generator. + # + # ==== Preparing for invocation + # + # In some cases you want to customize how a specified hook is going to be + # invoked. You can do that by overwriting the class method + # prepare_for_invocation. The class method must necessarily return a klass + # and an optional task. + # + # ==== Custom invocations + # + # You can also supply a block to customize how the option is giong to be + # invoked. The block receives two parameters, an instance of the current + # class and the klass to be invoked. + # + def invoke_from_option(*names, &block) + options = names.last.is_a?(Hash) ? names.pop : {} + verbose = options.fetch(:verbose, :white) + + names.each do |name| + unless class_options.key?(name) + raise ArgumentError, "You have to define the option #{name.inspect} " << + "before setting invoke_from_option." + end + + invocations[name] = true + invocation_blocks[name] = block if block_given? + + class_eval <<-METHOD, __FILE__, __LINE__ + def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')} + return unless options[#{name.inspect}] + + value = options[#{name.inspect}] + value = #{name.inspect} if TrueClass === value + klass, task = self.class.prepare_for_invocation(#{name.inspect}, value) + + if klass + say_status :invoke, value, #{verbose.inspect} + block = self.class.invocation_blocks[#{name.inspect}] + invoke_with_padding klass, task, &block + else + say_status :error, %(\#{value} [not found]), :red + end + end + METHOD + end + end + + # Remove a previously added invocation. + # + # ==== Examples + # + # remove_invocation :test_framework + # + def remove_invocation(*names) + names.each do |name| + remove_task(name) + remove_class_option(name) + invocations.delete(name) + invocation_blocks.delete(name) + end + end + + # Overwrite class options help to allow invoked generators options to be + # shown recursively when invoking a generator. + # + def class_options_help(shell, ungrouped_name=nil, extra_group=nil) #:nodoc: + group_options = {} + + get_options_from_invocations(group_options, class_options) do |klass| + klass.send(:get_options_from_invocations, group_options, class_options) + end + + group_options.merge!(extra_group) if extra_group + super(shell, ungrouped_name, group_options) + end + + # Get invocations array and merge options from invocations. Those + # options are added to group_options hash. Options that already exists + # in base_options are not added twice. + # + def get_options_from_invocations(group_options, base_options) #:nodoc: + invocations.each do |name, from_option| + value = if from_option + option = class_options[name] + option.type == :boolean ? name : option.default + else + name + end + next unless value + + klass, task = prepare_for_invocation(name, value) + next unless klass && klass.respond_to?(:class_options) + + value = value.to_s + human_name = value.respond_to?(:classify) ? value.classify : value + + group_options[human_name] ||= [] + group_options[human_name] += klass.class_options.values.select do |option| + base_options[option.name.to_sym].nil? && option.group.nil? && + !group_options.values.flatten.any? { |i| i.name == option.name } + end + + yield klass if block_given? + end + end + + protected + + # The banner for this class. You can customize it if you are invoking the + # thor class by another means which is not the Thor::Runner. + # + def banner #:nodoc: + "#{self.namespace} #{self.arguments.map {|a| a.usage }.join(' ')}" + end + + def baseclass #:nodoc: + Thor::Group + end + + def create_task(meth) #:nodoc: + tasks[meth.to_s] = Thor::Task.new(meth, nil, nil, nil) + end + end + + include Thor::Base +end diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/invocation.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/invocation.rb index 9093b1e5df..4e8a7e578d 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/invocation.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/invocation.rb @@ -1,5 +1,22 @@ class Thor module Invocation + def self.included(base) #:nodoc: + base.extend ClassMethods + end + + module ClassMethods + # Prepare for class methods invocations. This method must return a klass to + # have the invoked class options showed in help messages in generators. + # + def prepare_for_invocation(key, name) #:nodoc: + case name + when Symbol, String + Thor::Util.namespace_to_thor_class(name.to_s, false) + else + name + end + end + end # Make initializer aware of invocations and the initializer proc. # @@ -79,7 +96,7 @@ class Thor task, args, opts, config = nil, task, args, opts if task.nil? || task.is_a?(Array) args, opts, config = nil, args, opts if args.is_a?(Hash) - object, task = _setup_for_invoke(name, task) + object, task = _prepare_for_invocation(name, task) if object.is_a?(Class) klass = object @@ -113,6 +130,26 @@ class Thor end end + # Shortcut for invoke with padding and status handling. Used internally by + # class options invoke and invoke_from_option. + # + def invoke_with_padding(klass, task=nil, *args, &block) + shell.padding += 1 + + result = if block_given? + if block.arity == 2 + block.call(self, klass) + else + block.call(self, klass, task) + end + else + invoke klass, task, *args + end + + shell.padding -= 1 + result + end + protected # Configuration values that are shared between invocations. @@ -121,23 +158,18 @@ class Thor { :invocations => @_invocations } end - # This is the method responsable for retrieving and setting up an - # instance to be used in invoke. + # Prepare for invocation in the instance level. In this case, we have to + # take into account that a just a task name from the current class was + # given or even a Thor::Task object. # - def _setup_for_invoke(name, sent_task=nil) #:nodoc: - case name - when Thor::Task - task = name - when Symbol, String - name = name.to_s - - # If is not one of this class tasks, do a lookup. - unless task = self.class.all_tasks[name] - object, task = Thor::Util.namespace_to_thor_class(name, false) - task ||= sent_task - end - else - object, task = name, sent_task + def _prepare_for_invocation(name, sent_task=nil) #:nodoc: + if name.is_a?(Thor::Task) + task = name + elsif task = self.class.all_tasks[name.to_s] + object = self + else + object, task = self.class.prepare_for_invocation(nil, name) + task ||= sent_task end # If the object was not set, use self and use the name as task. @@ -148,7 +180,7 @@ class Thor # Check if the object given is a Thor class object and get a task object # for it. # - def _validate_klass_and_task(object, task) + def _validate_klass_and_task(object, task) #:nodoc: klass = object.is_a?(Class) ? object : object.class raise "Expected Thor class, got #{klass}" unless klass <= Thor::Base @@ -156,6 +188,5 @@ class Thor task = klass.all_tasks[task.to_s] || Task.dynamic(task) if task && !task.is_a?(Thor::Task) task end - end end diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/parser.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/parser.rb index 57a3f6e1a5..57a3f6e1a5 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/parser.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/parser.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/parser/argument.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/parser/argument.rb index 2d7f4dbafb..2d7f4dbafb 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/parser/argument.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/parser/argument.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/parser/arguments.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/parser/arguments.rb index 9a2262d6f7..9a2262d6f7 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/parser/arguments.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/parser/arguments.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/parser/option.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/parser/option.rb index ab9be6fb9f..ab9be6fb9f 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/parser/option.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/parser/option.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/parser/options.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/parser/options.rb index 29f6500d97..29f6500d97 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/parser/options.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/parser/options.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/runner.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/runner.rb index 330de38449..330de38449 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/runner.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/runner.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/shell.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/shell.rb index 7ed4a24bfb..7ed4a24bfb 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/shell.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/shell.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/shell/basic.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/shell/basic.rb index 6f1a2ade07..6f1a2ade07 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/shell/basic.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/shell/basic.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/shell/color.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/shell/color.rb index 67afa65ed2..67afa65ed2 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/shell/color.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/shell/color.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/task.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/task.rb index 92c0776c04..92c0776c04 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/task.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/task.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/tasks.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/tasks.rb index d1a7b1c673..d1a7b1c673 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/tasks.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/tasks.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/tasks/install.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/tasks/install.rb index 6b20ff1634..6b20ff1634 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/tasks/install.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/tasks/install.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/tasks/package.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/tasks/package.rb index 603d61b4ab..603d61b4ab 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/tasks/package.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/tasks/package.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/tasks/spec.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/tasks/spec.rb index c7d00968e8..c7d00968e8 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/tasks/spec.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/tasks/spec.rb diff --git a/railties/lib/vendor/thor-0.11.0/lib/thor/util.rb b/railties/lib/vendor/thor-0.11.1/lib/thor/util.rb index 26db24aadb..26db24aadb 100644 --- a/railties/lib/vendor/thor-0.11.0/lib/thor/util.rb +++ b/railties/lib/vendor/thor-0.11.1/lib/thor/util.rb diff --git a/railties/lib/vendor/thor.rb b/railties/lib/vendor/thor.rb index a5383529c1..89201313cd 100644 --- a/railties/lib/vendor/thor.rb +++ b/railties/lib/vendor/thor.rb @@ -1,9 +1,9 @@ begin # Prefer gems to the bundled libs. require 'rubygems' - gem 'thor', '>= 0.11.0' + gem 'thor', '>= 0.11.1' rescue Gem::LoadError - $:.unshift "#{File.dirname(__FILE__)}/thor-0.11.0/lib" + $:.unshift "#{File.dirname(__FILE__)}/thor-0.11.1/lib" end require 'thor' diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 3313e92c31..e8b10522b9 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -178,7 +178,7 @@ class ActionsTest < GeneratorsTestCase end def generator(config={}) - @generator ||= Rails::Generators::Base.new([], {}, { :root => destination_root }.merge!(config)) + @generator ||= Rails::Generators::Base.new([], {}, { :destination_root => destination_root }.merge!(config)) end def action(*args, &block) diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 8955789087..c78b7d2f25 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -171,7 +171,7 @@ class AppGeneratorTest < GeneratorsTestCase end def generator(options={}) - @generator ||= Rails::Generators::AppGenerator.new([destination_root], options, :root => destination_root) + @generator ||= Rails::Generators::AppGenerator.new([destination_root], options, :destination_root => destination_root) end def action(*args, &block) diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index 29169f225b..850b9e632d 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -74,7 +74,7 @@ class ControllerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["Account", "foo", "bar"]) - silence(:stdout) { Rails::Generators::ControllerGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::ControllerGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index e31f4eb4be..b1ebe5f1b5 100644 --- a/railties/test/generators/generator_generator_test.rb +++ b/railties/test/generators/generator_generator_test.rb @@ -20,7 +20,7 @@ class GeneratorGeneratorTest < GeneratorsTestCase protected def run_generator(args=["awesome"], config={}) - silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config.merge(:root => destination_root) } + silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config.merge(:destination_root => destination_root) } end end diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb index 02148ee1ce..3d655016f1 100644 --- a/railties/test/generators/helper_generator_test.rb +++ b/railties/test/generators/helper_generator_test.rb @@ -54,7 +54,7 @@ class HelperGeneratorTest < GeneratorsTestCase protected def run_generator(args=["admin"]) - silence(:stdout) { Rails::Generators::HelperGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::HelperGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb index 1961a102b9..190b28012c 100644 --- a/railties/test/generators/integration_test_generator_test.rb +++ b/railties/test/generators/integration_test_generator_test.rb @@ -12,7 +12,7 @@ class IntegrationTestGeneratorTest < GeneratorsTestCase protected def run_generator(args=["integration"]) - silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index d3bb1cd13f..9e74859c3a 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -46,7 +46,7 @@ class MailerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["notifier", "foo", "bar"]) - silence(:stdout) { Rails::Generators::MailerGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::MailerGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb index 4e73883feb..97e892cefb 100644 --- a/railties/test/generators/metal_generator_test.rb +++ b/railties/test/generators/metal_generator_test.rb @@ -17,7 +17,7 @@ class MetalGeneratorTest < GeneratorsTestCase protected def run_generator(args=["foo"]) - silence(:stdout) { Rails::Generators::MetalGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::MetalGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index e756d0a9fa..a4335068e6 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -53,7 +53,7 @@ class MigrationGeneratorTest < GeneratorsTestCase protected def run_generator(args=[@migration]) - silence(:stdout) { Rails::Generators::MigrationGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::MigrationGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 85aa2cc145..a9b772d67b 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -131,7 +131,7 @@ class ModelGeneratorTest < GeneratorsTestCase protected def run_generator(args=["Account", "name:string", "age:integer"], config={}) - silence(:stdout) { Rails::Generators::ModelGenerator.start args, config.merge(:root => destination_root) } + silence(:stdout) { Rails::Generators::ModelGenerator.start args, config.merge(:destination_root => destination_root) } end end diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb index 65e18eb942..a556731e16 100644 --- a/railties/test/generators/observer_generator_test.rb +++ b/railties/test/generators/observer_generator_test.rb @@ -27,7 +27,7 @@ class ObserverGeneratorTest < GeneratorsTestCase protected def run_generator(args=["account"]) - silence(:stdout) { Rails::Generators::ObserverGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::ObserverGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb index fdfbf9031c..74c9c20c4c 100644 --- a/railties/test/generators/performance_test_generator_test.rb +++ b/railties/test/generators/performance_test_generator_test.rb @@ -12,7 +12,7 @@ class PerformanceTestGeneratorTest < GeneratorsTestCase protected def run_generator(args=["performance"]) - silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index bfec671d31..3982586bc3 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -50,7 +50,7 @@ class PluginGeneratorTest < GeneratorsTestCase protected def run_generator(args=["plugin_fu"], config={}) - silence(:stdout) { Rails::Generators::PluginGenerator.start args, config.merge(:root => destination_root) } + silence(:stdout) { Rails::Generators::PluginGenerator.start args, config.merge(:destination_root => destination_root) } end end diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 7b03ca31ec..876ddbf84e 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -100,7 +100,7 @@ class ResourceGeneratorTest < GeneratorsTestCase protected def run_generator(args=["account"], config={}) - silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config.merge(:root => destination_root) } + silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config.merge(:destination_root => destination_root) } end end diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 1f0060d11e..024ea439ef 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -106,7 +106,7 @@ class ScaffoldControllerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["User", "name:string", "age:integer"]) - silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 2e5d4b609e..9560cf7ba7 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -128,7 +128,7 @@ class ScaffoldGeneratorTest < GeneratorsTestCase def run_generator(config={}) silence(:stdout) do Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"], - config.merge(:root => destination_root) + config.merge(:destination_root => destination_root) end end diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb index 7eefbe51e6..f83109800b 100644 --- a/railties/test/generators/session_migration_generator_test.rb +++ b/railties/test/generators/session_migration_generator_test.rb @@ -17,7 +17,7 @@ class SessionMigrationGeneratorTest < GeneratorsTestCase protected def run_generator(args=[]) - silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args, :root => destination_root } + silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args, :destination_root => destination_root } end end diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb index e2cddedf1a..02082d5cc8 100644 --- a/railties/test/generators/stylesheets_generator_test.rb +++ b/railties/test/generators/stylesheets_generator_test.rb @@ -18,7 +18,7 @@ class StylesheetsGeneratorTest < GeneratorsTestCase protected def run_generator(config={}) - silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config.merge(:root => destination_root) } + silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config.merge(:destination_root => destination_root) } end end |