aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-01-17 02:04:38 +0330
committerJosé Valim <jose.valim@gmail.com>2010-01-17 14:55:11 +0100
commite3898bda9cb0e6d7e63cd8f6d4ecec96209bfd4d (patch)
tree7d67fcd61efa04cc8faf56c71b891b90d0bea9d9 /railties
parentcf109342a710e64fbaabc97c90e4af84f7c20a32 (diff)
downloadrails-e3898bda9cb0e6d7e63cd8f6d4ecec96209bfd4d.tar.gz
rails-e3898bda9cb0e6d7e63cd8f6d4ecec96209bfd4d.tar.bz2
rails-e3898bda9cb0e6d7e63cd8f6d4ecec96209bfd4d.zip
Take --skip-activerecord into account boot.rb requires. [#3711 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/boot.rb13
-rw-r--r--railties/test/generators/app_generator_test.rb9
3 files changed, 17 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index d58d245168..4b73576b07 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -87,7 +87,7 @@ module Rails::Generators
end
def create_boot_file
- copy_file "config/boot.rb"
+ template "config/boot.rb"
end
def create_activerecord_files
diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
index 6de1725260..466e1e50ec 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
@@ -13,7 +13,9 @@ else
require 'rubygems'
end
+<% unless options[:skip_activerecord] -%>
require 'rails/all'
+
# To pick the frameworks you want, remove 'require "rails/all"'
# and list the framework railties that you want:
#
@@ -22,4 +24,13 @@ require 'rails/all'
# require "action_controller/railtie"
# require "action_view/railtie"
# require "action_mailer/railtie"
-# require "active_resource/railtie" \ No newline at end of file
+# require "active_resource/railtie"
+<% else -%>
+# Pick the frameworks you want:
+# require "active_record/railtie"
+require "active_model/railtie"
+require "action_controller/railtie"
+require "action_view/railtie"
+require "action_mailer/railtie"
+require "active_resource/railtie"
+<% end -%> \ No newline at end of file
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 62ea07f14e..5fab233c8d 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -80,11 +80,10 @@ class AppGeneratorTest < GeneratorsTestCase
assert_no_file "config/database.yml"
end
- # TODO: Bring this back using requires
- # def test_activerecord_is_removed_from_frameworks_if_skip_activerecord_is_given
- # run_generator ["--skip-activerecord"]
- # assert_file "config/application.rb", /config\.frameworks \-= \[ :active_record \]/
- # end
+ def test_activerecord_is_removed_from_frameworks_if_skip_activerecord_is_given
+ run_generator [destination_root, "--skip-activerecord"]
+ assert_file "config/boot.rb", /# require "active_record\/railtie"/
+ end
def test_prototype_and_test_unit_are_added_by_default
run_generator