diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-02 15:55:21 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-02 15:55:21 +0200 |
commit | 528d555e378e9900ffda40c8ff3627e0609a048c (patch) | |
tree | 4f00ff742efbbe1fd732cdea57c9556467fc817d /railties/lib | |
parent | a08a8cd8d24dd1a8342e0fd133c5e8ed09e1f56d (diff) | |
download | rails-528d555e378e9900ffda40c8ff3627e0609a048c.tar.gz rails-528d555e378e9900ffda40c8ff3627e0609a048c.tar.bz2 rails-528d555e378e9900ffda40c8ff3627e0609a048c.zip |
Make invoke output white and use padding.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/generators/active_record/model/model_generator.rb | 8 | ||||
-rw-r--r-- | railties/lib/generators/base.rb | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/railties/lib/generators/active_record/model/model_generator.rb b/railties/lib/generators/active_record/model/model_generator.rb index 149ce281f3..d337ca4eec 100644 --- a/railties/lib/generators/active_record/model/model_generator.rb +++ b/railties/lib/generators/active_record/model/model_generator.rb @@ -11,10 +11,6 @@ module ActiveRecord class_option :timestamps, :type => :boolean class_option :parent, :type => :string, :desc => "The parent class for the generated model" - def create_model_file - template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") - end - def create_migration_file if options[:migration] && options[:parent].nil? file_name = "create_#{file_path.gsub(/\//, '_').pluralize}" @@ -22,6 +18,10 @@ module ActiveRecord end end + def create_model_file + template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") + end + hook_for :test_framework protected diff --git a/railties/lib/generators/base.rb b/railties/lib/generators/base.rb index aeb79dd339..4b47ebc49b 100644 --- a/railties/lib/generators/base.rb +++ b/railties/lib/generators/base.rb @@ -118,7 +118,7 @@ module Rails def self.hook_for(*names, &block) options = names.extract_options! as = options.fetch(:as, generator_name) - verbose = options.fetch(:verbose, :blue) + verbose = options.fetch(:verbose, :white) names.each do |name| default = { :desc => "#{name.to_s.humanize} to be invoked", :banner => "NAME" } @@ -196,7 +196,7 @@ module Rails def self.invoke_if(*names, &block) options = names.extract_options!.merge(:type => :boolean) as = options.fetch(:as, generator_name) - verbose = options.fetch(:verbose, :blue) + verbose = options.fetch(:verbose, :white) names.each do |name| class_option name, options @@ -267,11 +267,13 @@ module Rails # in case the user wants to customize how the class is invoked. # def invoke_class_with_block(name, klass) #:nodoc: + shell.padding += 1 if block = self.class.invocation_blocks[name] block.call(self, klass) else invoke klass end + shell.padding -= 1 end # Check whether the given class names are already taken by user |