diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-08 12:55:50 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-08 12:55:50 +0200 |
commit | 09c288f0c5b5f9da4473bb321cccb766d9f59d7e (patch) | |
tree | d12cb86acdbe32ca2c6c9971ff9921360a02b1ef /railties/lib | |
parent | c9ea21717eefb9e9b49891c519cc4d121ef7bb74 (diff) | |
download | rails-09c288f0c5b5f9da4473bb321cccb766d9f59d7e.tar.gz rails-09c288f0c5b5f9da4473bb321cccb766d9f59d7e.tar.bz2 rails-09c288f0c5b5f9da4473bb321cccb766d9f59d7e.zip |
Add the new generators environment and update commands.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/commands/destroy.rb | 2 | ||||
-rwxr-xr-x | railties/lib/commands/generate.rb | 2 | ||||
-rw-r--r-- | railties/lib/commands/update.rb | 2 | ||||
-rw-r--r-- | railties/lib/generators.rb | 10 | ||||
-rw-r--r-- | railties/lib/generators/base.rb | 2 | ||||
-rw-r--r-- | railties/lib/generators/rails/app/app_generator.rb | 2 | ||||
-rw-r--r-- | railties/lib/generators/rails/app/templates/config/environments/generators.rb | 19 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 2 |
8 files changed, 30 insertions, 11 deletions
diff --git a/railties/lib/commands/destroy.rb b/railties/lib/commands/destroy.rb index 075fe5bb12..6e740bb754 100644 --- a/railties/lib/commands/destroy.rb +++ b/railties/lib/commands/destroy.rb @@ -1,5 +1,5 @@ +RAILS_ENV.replace "generators" require "#{RAILS_ROOT}/config/environment" -require 'generators' if ARGV.size == 0 Rails::Generators.help diff --git a/railties/lib/commands/generate.rb b/railties/lib/commands/generate.rb index f6db965960..5408e78157 100755 --- a/railties/lib/commands/generate.rb +++ b/railties/lib/commands/generate.rb @@ -1,5 +1,5 @@ +RAILS_ENV.replace "generators" require "#{RAILS_ROOT}/config/environment" -require 'generators' if ARGV.size == 0 Rails::Generators.help diff --git a/railties/lib/commands/update.rb b/railties/lib/commands/update.rb index 50b7d73e0e..5ce1068e1a 100644 --- a/railties/lib/commands/update.rb +++ b/railties/lib/commands/update.rb @@ -1,5 +1,5 @@ +RAILS_ENV.replace "generators" require "#{RAILS_ROOT}/config/environment" -require 'generators' if ARGV.size == 0 Rails::Generators.help diff --git a/railties/lib/generators.rb b/railties/lib/generators.rb index a4ce92e04b..8fe5dabf86 100644 --- a/railties/lib/generators.rb +++ b/railties/lib/generators.rb @@ -38,13 +38,13 @@ module Rails :helper => true, :layout => true, :migration => true, - :orm => 'active_record', - :resource_controller => 'controller', - :scaffold_controller => 'scaffold_controller', + :orm => :active_record, + :resource_controller => :controller, + :scaffold_controller => :scaffold_controller, :singleton => false, :stylesheets => true, - :test_framework => 'test_unit', - :template_engine => 'erb', + :test_framework => :test_unit, + :template_engine => :erb, :timestamps => true } diff --git a/railties/lib/generators/base.rb b/railties/lib/generators/base.rb index dcc210240e..13916e081b 100644 --- a/railties/lib/generators/base.rb +++ b/railties/lib/generators/base.rb @@ -163,7 +163,7 @@ module Rails end shell.padding -= 1 else - say "Could not find and invoke '\#{klass_name}'." + say_status :error, "\#{klass_name} [not found]", :red end end METHOD diff --git a/railties/lib/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb index dc1d360e3f..20a06ed16a 100644 --- a/railties/lib/generators/rails/app/app_generator.rb +++ b/railties/lib/generators/rails/app/app_generator.rb @@ -1,6 +1,6 @@ require 'digest/md5' require 'active_support/secure_random' -require 'rails/version' unless defined?(RAILS::VERSION) +require 'rails/version' unless defined?(Rails::VERSION) module Rails::Generators class AppGenerator < Base diff --git a/railties/lib/generators/rails/app/templates/config/environments/generators.rb b/railties/lib/generators/rails/app/templates/config/environments/generators.rb new file mode 100644 index 0000000000..503a281e20 --- /dev/null +++ b/railties/lib/generators/rails/app/templates/config/environments/generators.rb @@ -0,0 +1,19 @@ +# Settings specified here will take precedence over those in config/environment.rb + +# Cache classes and log when you accidentally call methods on nil. +config.cache_classes = false +config.whiny_nils = true + +# We do not need any framework on generators. They are loaded on demand. +config.frameworks.clear + +# Configure generators. Below you have the default values, delete them if you want. +config.generators do |g| + g.helper = true + g.layout = true + g.orm = :active_record + g.stylesheets = true + g.template_engine = :erb + g.test_framework = :test_unit + g.timestamps = true +end diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index fa7d2d5249..be65950a5b 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -572,7 +572,7 @@ Run `rake gems:install` to install the missing gems. # Load generators if RAILS_ENV == "generators" Initializer.default.add :initialize_generators do if RAILS_ENV == "generators" - require 'generators' + require "generators" Rails::Generators.no_color! unless config.generators.colorize_logging Rails::Generators.aliases.merge! config.generators.aliases Rails::Generators.options.merge! config.generators.options |