diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-08 12:19:17 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-08 12:53:45 +0200 |
commit | c9ea21717eefb9e9b49891c519cc4d121ef7bb74 (patch) | |
tree | a7901541789ab022074cf043fd764a4992455b7f /railties/lib/rails | |
parent | 2699e9c2ddff13c5e19e1c95e838fa6d9a965c34 (diff) | |
download | rails-c9ea21717eefb9e9b49891c519cc4d121ef7bb74.tar.gz rails-c9ea21717eefb9e9b49891c519cc4d121ef7bb74.tar.bz2 rails-c9ea21717eefb9e9b49891c519cc4d121ef7bb74.zip |
Generators are configured on initialization if RAILS_ENV=generators.
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/configuration.rb | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 4a5fe4da7d..1a8f261e6f 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -252,21 +252,25 @@ module Rails # Holds generators configuration: # - # config.generators.orm :datamapper - # config.generators.test_framework :rspec - # config.generators.template_engine :haml + # config.generators.orm = :datamapper + # config.generators.test_framework = :rspec + # config.generators.template_engine = :haml # # A block can also be given for less verbose configuration: # # config.generators do |g| - # g.orm :datamapper - # g.test_framework :datamapper - # g.template_engine :haml + # g.orm = :datamapper + # g.test_framework = :datamapper + # g.template_engine = :haml # end # # You can also configure/override aliases: # - # config.generators.aliases :test_framework => "-w" + # config.generators.aliases = :test_framework => "-w" + # + # Finally, to disable color in console, do: + # + # config.generators.colorize_logging = false # def generators @generators ||= Generators.new @@ -278,22 +282,19 @@ module Rails end class Generators #:nodoc: - def initialize - @aliases, @options = {}, {} - end + attr_accessor :aliases, :options, :colorize_logging - def aliases(values=nil) - @aliases = values if values - @aliases - end - - def options(values=nil) - @options = values if values - @options + def initialize + @aliases, @options, @colorize_logging = {}, {}, true end def method_missing(method, *args, &block) - @options[method.to_sym] = args.first + method = method.to_s + if method.gsub!(/=$/, '') + @options[method.to_sym] = args.first + else + super(method.to_sym, *args, &block) + end end end end |