aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/configuration.rb49
1 files changed, 48 insertions, 1 deletions
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index 1a2f217d20..4a5fe4da7d 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -249,5 +249,52 @@ 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"
+ #
+ def generators
+ @generators ||= Generators.new
+ if block_given?
+ yield @generators
+ else
+ @generators
+ end
+ end
+
+ class Generators #:nodoc:
+ def initialize
+ @aliases, @options = {}, {}
+ end
+
+ def aliases(values=nil)
+ @aliases = values if values
+ @aliases
+ end
+
+ def options(values=nil)
+ @options = values if values
+ @options
+ end
+
+ def method_missing(method, *args, &block)
+ @options[method.to_sym] = args.first
+ end
+ end
end
-end \ No newline at end of file
+end