diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/configuration.rb | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 1a2f217d20..1a8f261e6f 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -249,5 +249,53 @@ module Rails def reload_plugins? @reload_plugins end + + # Holds generators configuration: + # + # 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 + # end + # + # You can also configure/override aliases: + # + # config.generators.aliases = :test_framework => "-w" + # + # Finally, to disable color in console, do: + # + # config.generators.colorize_logging = false + # + def generators + @generators ||= Generators.new + if block_given? + yield @generators + else + @generators + end + end + + class Generators #:nodoc: + attr_accessor :aliases, :options, :colorize_logging + + def initialize + @aliases, @options, @colorize_logging = {}, {}, true + end + + def method_missing(method, *args, &block) + method = method.to_s + if method.gsub!(/=$/, '') + @options[method.to_sym] = args.first + else + super(method.to_sym, *args, &block) + end + end + end end -end
\ No newline at end of file +end |