diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/configuration.rb | 21 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/application.rb | 8 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/boot.rb | 9 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 3 | ||||
-rw-r--r-- | railties/test/application/initializer_test.rb | 4 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 9 | ||||
-rw-r--r-- | railties/test/initializer/path_test.rb | 4 |
8 files changed, 24 insertions, 38 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 5419b46f19..88f10727c5 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -273,7 +273,9 @@ module Rails # For each framework, search for instrument file with Notifications hooks. # initializer :load_notifications_hooks do - config.frameworks.each do |framework| + frameworks = [ :active_record, :action_controller, :action_view, + :action_mailer, :active_resource ] + frameworks.each do |framework| begin require "#{framework}/notifications" rescue LoadError => e diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 086f67a419..12bf076f61 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -59,7 +59,7 @@ module Rails attr_writer :cache_store, :controller_paths, :database_configuration_file, :eager_load_paths, - :frameworks, :framework_root_path, :i18n, :load_paths, + :i18n, :load_paths, :log_level, :log_path, :paths, :routes_configuration_file, :view_path @@ -134,21 +134,6 @@ module Rails self end - def framework_paths - paths = %w(railties railties/lib activesupport/lib) - paths << 'actionpack/lib' if frameworks.include?(:action_controller) || frameworks.include?(:action_view) - - [:active_record, :action_mailer, :active_resource, :action_web_service].each do |framework| - paths << "#{framework.to_s.gsub('_', '')}/lib" if frameworks.include?(framework) - end - - paths.map { |dir| "#{framework_root_path}/#{dir}" }.select { |dir| File.directory?(dir) } - end - - def framework_root_path - defined?(::RAILS_FRAMEWORK_ROOT) ? ::RAILS_FRAMEWORK_ROOT : "#{root}/vendor/rails" - end - # Loads and returns the contents of the #database_configuration_file. The # contents of the file are processed via ERB before being sent through # YAML::load. @@ -239,10 +224,6 @@ module Rails @log_level ||= RAILS_ENV == 'production' ? :info : :debug end - def frameworks - @frameworks ||= [ :active_record, :action_controller, :action_view, :action_mailer, :active_resource ] - end - def i18n @i18n ||= begin i18n = ActiveSupport::OrderedOptions.new 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 15dc553e53..ec0729db04 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -13,16 +13,8 @@ module <%= app_name.classify %> # :all can be used as a placeholder for all plugins not explicitly named # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - # Skip frameworks you're not going to use. To use Rails without a database, - # you must remove the Active Record framework. -<% if options[:skip_activerecord] -%> - config.frameworks -= [ :active_record ] -<% else -%> - # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] - # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector, :forum_observer -<% end -%> # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. 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 5aa49ca5e6..221421855c 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb @@ -14,3 +14,12 @@ else end require 'rails' +# To skip frameworks you're not going to use, remove require "rails" and +# list the frameworks that you are going to use. +# +# require "active_model/rails" +# require "active_record/rails" +# require "action_controller/rails" +# require "action_view/rails" +# require "action_mailer/rails" +# require "active_resource/rails"
\ No newline at end of file diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index ece41f9de8..a7df1e09ab 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -75,10 +75,11 @@ module ApplicationTests test "the application can be marked as threadsafe when there are no frameworks" do FileUtils.rm_rf("#{app_path}/config/environments") add_to_config <<-RUBY - config.frameworks = [] config.threadsafe! RUBY + use_frameworks [] + assert_nothing_raised do require "#{app_path}/config/application" end diff --git a/railties/test/application/initializer_test.rb b/railties/test/application/initializer_test.rb index 42fc416faa..e03f9ffb00 100644 --- a/railties/test/application/initializer_test.rb +++ b/railties/test/application/initializer_test.rb @@ -7,7 +7,6 @@ module ApplicationTests def setup build_app boot_rails - require "rails" end test "initializing an application adds the application paths to the load path" do @@ -51,8 +50,9 @@ module ApplicationTests assert_nothing_raised NameError do add_to_config <<-RUBY config.root = "#{app_path}" - config.frameworks = [] RUBY + + use_frameworks [] require "#{app_path}/config/environment" end end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 567555fdc5..2cba42551e 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -63,10 +63,11 @@ class AppGeneratorTest < GeneratorsTestCase assert_no_file "config/database.yml" end - 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 + # 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_prototype_and_test_unit_are_added_by_default run_generator diff --git a/railties/test/initializer/path_test.rb b/railties/test/initializer/path_test.rb index 3bbf9617a0..73d1b1a125 100644 --- a/railties/test/initializer/path_test.rb +++ b/railties/test/initializer/path_test.rb @@ -7,14 +7,14 @@ module InitializerTests def setup build_app boot_rails - require "rails" add_to_config <<-RUBY config.root = "#{app_path}" - config.frameworks = [:action_controller, :action_view, :action_mailer, :active_record] config.after_initialize do ActionController::Base.session_store = nil end RUBY + use_frameworks [:action_controller, :action_view, :action_mailer, :active_record] + require "rails" require "#{app_path}/config/environment" @paths = Rails.application.config.paths end |