diff options
-rw-r--r-- | railties/CHANGELOG | 3 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 18 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/application.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_case.rb | 6 | ||||
-rw-r--r-- | railties/test/application/middleware_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 12 | ||||
-rw-r--r-- | railties/test/generators_test.rb | 2 |
8 files changed, 25 insertions, 22 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 6a8db7c4a6..3cd9647799 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,8 @@ *Rails 3.0.0 [Release Candidate] (unreleased)* +* Application generation: --skip-testunit and --skip-activerecord become --skip-test-unit + and --skip-active-record respectively. [fxn] + * Added console to Rails::Railtie as a hook called just after console starts. [José Valim] * Rails no longer autoload code in lib for application. You need to explicitly require it. [José Valim] diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index c99aa3c0cd..1324cc1f67 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -168,7 +168,7 @@ module Rails :desc => "Path to an application builder (can be a filesystem path or URL)" class_option :template, :type => :string, :aliases => "-m", - :desc => "Path to an application template (can be a filesystem path or URL)." + :desc => "Path to an application template (can be a filesystem path or URL)" class_option :dev, :type => :boolean, :default => false, :desc => "Setup the application with Gemfile pointing to your Rails checkout" @@ -179,11 +179,11 @@ module Rails class_option :skip_gemfile, :type => :boolean, :default => false, :desc => "Don't create a Gemfile" - class_option :skip_activerecord, :type => :boolean, :aliases => "-O", :default => false, - :desc => "Skip ActiveRecord files" + class_option :skip_active_record, :type => :boolean, :aliases => "-O", :default => false, + :desc => "Skip Active Record files" - class_option :skip_testunit, :type => :boolean, :aliases => "-T", :default => false, - :desc => "Skip TestUnit files" + class_option :skip_test_unit, :type => :boolean, :aliases => "-T", :default => false, + :desc => "Skip Test::Unit files" class_option :skip_prototype, :type => :boolean, :aliases => "-J", :default => false, :desc => "Skip Prototype files" @@ -205,7 +205,7 @@ module Rails super - if !options[:skip_activerecord] && !DATABASES.include?(options[:database]) + if !options[:skip_active_record] && !DATABASES.include?(options[:database]) raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}." end end @@ -239,8 +239,8 @@ module Rails template "config/boot.rb" end - def create_activerecord_files - return if options[:skip_activerecord] + def create_active_record_files + return if options[:skip_active_record] build(:database_yml) end @@ -281,7 +281,7 @@ module Rails end def create_test_files - build(:test) unless options[:skip_testunit] + build(:test) unless options[:skip_test_unit] end def create_tmp_files diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index 190ab04cf5..7d63e99e05 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -1,6 +1,6 @@ require File.expand_path('../boot', __FILE__) -<% unless options[:skip_activerecord] -%> +<% unless options[:skip_active_record] -%> require 'rails/all' <% else -%> # Pick the frameworks you want: diff --git a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt index 86564031f5..a8f7aeac7d 100644 --- a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt @@ -3,7 +3,7 @@ require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase -<% unless options[:skip_activerecord] -%> +<% unless options[:skip_active_record] -%> # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integration tests diff --git a/railties/lib/rails/generators/test_case.rb b/railties/lib/rails/generators/test_case.rb index 0dfb5cd1c9..36bc542ffe 100644 --- a/railties/lib/rails/generators/test_case.rb +++ b/railties/lib/rails/generators/test_case.rb @@ -51,7 +51,7 @@ module Rails # Sets default arguments on generator invocation. This can be overwritten when # invoking it. # - # arguments %w(app_name --skip-activerecord) + # arguments %w(app_name --skip-active-record) # def self.arguments(array) self.default_arguments = array @@ -214,8 +214,8 @@ module Rails # destination File.expand_path("../tmp", File.dirname(__FILE__)) # teardown :cleanup_destination_root # - # test "database.yml is not created when skipping activerecord" do - # run_generator %w(myapp --skip-activerecord) + # test "database.yml is not created when skipping Active Record" do + # run_generator %w(myapp --skip-active-record) # assert_no_file "config/database.yml" # end # end diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index ed06b4c767..db9f06be5c 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -38,7 +38,7 @@ module ApplicationTests ], middleware end - test "removing activerecord omits its middleware" do + test "removing Active Record omits its middleware" do use_frameworks [] boot! assert !middleware.include?("ActiveRecord::ConnectionAdapters::ConnectionManagement") diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 7018816af0..aca30e92b6 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -65,7 +65,7 @@ class AppGeneratorTest < Rails::Generators::TestCase end def test_options_before_application_name_raises_an_error - content = capture(:stderr){ run_generator(["--skip-activerecord", destination_root]) } + content = capture(:stderr){ run_generator(["--skip-active-record", destination_root]) } assert_equal "Options should be given after the application name. For details run: rails --help\n", content end @@ -117,13 +117,13 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "Gemfile", /^gem\s+["']mysql["']$/ end - def test_config_database_is_not_added_if_skip_activerecord_is_given - run_generator [destination_root, "--skip-activerecord"] + def test_config_database_is_not_added_if_skip_active_record_is_given + run_generator [destination_root, "--skip-active-record"] assert_no_file "config/database.yml" end - def test_activerecord_is_removed_from_frameworks_if_skip_activerecord_is_given - run_generator [destination_root, "--skip-activerecord"] + def test_active_record_is_removed_from_frameworks_if_skip_active_record_is_given + run_generator [destination_root, "--skip-active-record"] assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/ end @@ -137,7 +137,7 @@ class AppGeneratorTest < Rails::Generators::TestCase end def test_prototype_and_test_unit_are_skipped_if_required - run_generator [destination_root, "--skip-prototype", "--skip-testunit"] + run_generator [destination_root, "--skip-prototype", "--skip-test-unit"] assert_file "config/application.rb", /^\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(\)/ assert_file "public/javascripts/application.js" assert_no_file "public/javascripts/prototype.js" diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 74a09d4bde..f93800a5ae 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -108,7 +108,7 @@ class GeneratorsTest < Rails::Generators::TestCase assert_match /^ fixjour$/, output end - def test_rails_generators_does_not_show_activerecord_hooks + def test_rails_generators_does_not_show_active_record_hooks output = capture(:stdout){ Rails::Generators.help } assert_match /ActiveRecord:/, output assert_match /^ active_record:fixjour$/, output |