diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-03-15 19:46:03 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-03-15 19:46:03 +0000 |
commit | 03a62f4afedbef8bda72c8fdf9a0092273c0f2b0 (patch) | |
tree | 2155b65750757d26e3c8c8e0655ad32cc89d6c2e /railties/lib | |
parent | f53fddf3665e6582768f4ab0c82b286b39e7fb19 (diff) | |
parent | a594a22267bfd3346e00923742c4aa7edad0cef7 (diff) | |
download | rails-03a62f4afedbef8bda72c8fdf9a0092273c0f2b0.tar.gz rails-03a62f4afedbef8bda72c8fdf9a0092273c0f2b0.tar.bz2 rails-03a62f4afedbef8bda72c8fdf9a0092273c0f2b0.zip |
Merge remote branch 'mainstream/master'
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/generators/rails/app/app_generator.rb | 5 | ||||
-rw-r--r-- | railties/lib/generators/rails/app/templates/script/rails | 7 | ||||
-rw-r--r-- | railties/lib/rails/commands.rb | 8 | ||||
-rw-r--r-- | railties/lib/rails/generators.rb | 4 |
4 files changed, 18 insertions, 6 deletions
diff --git a/railties/lib/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb index 92e0d37436..1e1acc1141 100644 --- a/railties/lib/generators/rails/app/app_generator.rb +++ b/railties/lib/generators/rails/app/app_generator.rb @@ -178,7 +178,8 @@ module Rails::Generators end def bundle_if_dev_or_edge - run "bundle install" if dev_or_edge? + bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle') + run "#{bundle_command} install" if dev_or_edge? end protected @@ -220,6 +221,8 @@ module Rails::Generators raise Error, "Invalid application name #{app_name}. Please give a name which does not start with numbers." elsif RESERVED_NAMES.include?(app_name) raise Error, "Invalid application name #{app_name}. Please give a name which does not match one of the reserved rails words." + elsif Object.const_defined?(app_const_base) + raise Error, "Invalid application name #{app_name}, constant #{app_const_base} is already in use. Please choose another application name." end end diff --git a/railties/lib/generators/rails/app/templates/script/rails b/railties/lib/generators/rails/app/templates/script/rails index 199fe1a6d3..b01d1ee183 100644 --- a/railties/lib/generators/rails/app/templates/script/rails +++ b/railties/lib/generators/rails/app/templates/script/rails @@ -1,5 +1,8 @@ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. -ENV_PATH = File.expand_path('../../config/environment', __FILE__) -require File.expand_path('../../config/boot', __FILE__) +ENV_PATH = File.expand_path('../../config/environment', __FILE__) +BOOT_PATH = File.expand_path('../../config/boot', __FILE__) +APP_PATH = File.expand_path('../../config/application', __FILE__) + +require BOOT_PATH require 'rails/commands' diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb index d4558be00f..12748da18b 100644 --- a/railties/lib/rails/commands.rb +++ b/railties/lib/rails/commands.rb @@ -34,13 +34,15 @@ when 'c', 'console' Rails::Console.start(Rails::Application) when 's', 'server' require 'rails/commands/server' + # Initialize the server first, so environment options are set server = Rails::Server.new - require ENV_PATH + require APP_PATH + Dir.chdir(Rails::Application.root) server.start when 'db', 'dbconsole' require 'rails/commands/dbconsole' - require ENV_PATH + require APP_PATH Rails::DBConsole.start(Rails::Application) when 'application' @@ -55,7 +57,7 @@ when 'profiler' require ENV_PATH require 'rails/commands/performance/profiler' when 'plugin' - require ENV_PATH + require APP_PATH require 'rails/commands/plugin' when 'runner' require 'rails/commands/runner' diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 3c902ce0d4..9a51171cf5 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -202,6 +202,10 @@ module Rails rails.delete("app") print_list("rails", rails) + groups.delete("active_record") if options[:rails][:orm] == :active_record + groups.delete("test_unit") if options[:rails][:test_framework] == :test_unit + groups.delete("erb") if options[:rails][:template_engine] == :erb + groups.sort.each { |b, n| print_list(b, n) } end |