diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-08 10:57:56 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-08 12:53:45 +0200 |
commit | 2699e9c2ddff13c5e19e1c95e838fa6d9a965c34 (patch) | |
tree | 7b705d9a2bf2ceb6c21c3047852d6f23f02e94b9 /railties/lib | |
parent | c07746cbdfb7b60d2692c9c4a549e4e1b133865f (diff) | |
download | rails-2699e9c2ddff13c5e19e1c95e838fa6d9a965c34.tar.gz rails-2699e9c2ddff13c5e19e1c95e838fa6d9a965c34.tar.bz2 rails-2699e9c2ddff13c5e19e1c95e838fa6d9a965c34.zip |
Added config.generators with tests.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/configuration.rb | 49 |
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 |