diff options
Diffstat (limited to 'railties/lib/rails/application')
-rw-r--r-- | railties/lib/rails/application/bootstrap.rb | 14 | ||||
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 18 | ||||
-rw-r--r-- | railties/lib/rails/application/finisher.rb | 9 | ||||
-rw-r--r-- | railties/lib/rails/application/routes_reloader.rb | 2 |
4 files changed, 20 insertions, 23 deletions
diff --git a/railties/lib/rails/application/bootstrap.rb b/railties/lib/rails/application/bootstrap.rb index a1bc95550b..62d57c0cc6 100644 --- a/railties/lib/rails/application/bootstrap.rb +++ b/railties/lib/rails/application/bootstrap.rb @@ -7,13 +7,13 @@ module Rails module Bootstrap include Initializable - initializer :load_environment_hook, :group => :all do end + initializer :load_environment_hook, group: :all do end - initializer :load_active_support, :group => :all do + initializer :load_active_support, group: :all do require "active_support/all" unless config.active_support.bare end - initializer :set_eager_load, :group => :all do + initializer :set_eager_load, group: :all do if config.eager_load.nil? warn <<-INFO config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly: @@ -28,7 +28,7 @@ INFO end # Initialize the logger early in the stack in case we need to log some deprecation. - initializer :initialize_logger, :group => :all do + initializer :initialize_logger, group: :all do Rails.logger ||= config.logger || begin path = config.paths["log"].first unless File.exist? File.dirname path @@ -56,7 +56,7 @@ INFO end # Initialize cache early in the stack so railties can make use of it. - initializer :initialize_cache, :group => :all do + initializer :initialize_cache, group: :all do unless Rails.cache Rails.cache = ActiveSupport::Cache.lookup_store(config.cache_store) @@ -67,11 +67,11 @@ INFO end # Sets the dependency loading mechanism. - initializer :initialize_dependency_mechanism, :group => :all do + initializer :initialize_dependency_mechanism, group: :all do ActiveSupport::Dependencies.mechanism = config.cache_classes ? :require : :load end - initializer :bootstrap_hook, :group => :all do |app| + initializer :bootstrap_hook, group: :all do |app| ActiveSupport.run_load_hooks(:before_initialize, app) end end diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index a7a35c2685..7df517de71 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -6,7 +6,7 @@ require 'rails/engine/configuration' module Rails class Application class Configuration < ::Rails::Engine::Configuration - attr_accessor :asset_host, :asset_path, :assets, :autoflush_log, + attr_accessor :asset_host, :assets, :autoflush_log, :cache_classes, :cache_store, :consider_all_requests_local, :console, :eager_load, :exceptions_app, :file_watcher, :filter_parameters, :force_ssl, :helpers_paths, :logger, :log_formatter, :log_tags, @@ -43,14 +43,14 @@ module Rails @exceptions_app = nil @autoflush_log = true @log_formatter = ActiveSupport::Logger::SimpleFormatter.new - @queue = ActiveSupport::SynchronousQueue - @queue_consumer = ActiveSupport::ThreadedQueueConsumer + @queue = ActiveSupport::SynchronousQueue.new + @queue_consumer = nil @eager_load = nil @assets = ActiveSupport::OrderedOptions.new @assets.enabled = false @assets.paths = [] - @assets.precompile = [ Proc.new { |path| !%w(.js .css).include?(File.extname(path)) }, + @assets.precompile = [ Proc.new { |path, fn| fn =~ /app\/assets/ && !%w(.js .css).include?(File.extname(path)) }, /(?:\/|\\|\A)application\.(css|js)$/ ] @assets.prefix = "/assets" @assets.version = '' @@ -64,10 +64,6 @@ module Rails @assets.logger = nil end - def compiled_asset_path - "/" - end - def encoding=(value) @encoding = value silence_warnings do @@ -79,10 +75,10 @@ module Rails def paths @paths ||= begin paths = super - paths.add "config/database", :with => "config/database.yml" - paths.add "config/environment", :with => "config/environment.rb" + paths.add "config/database", with: "config/database.yml" + paths.add "config/environment", with: "config/environment.rb" paths.add "lib/templates" - paths.add "log", :with => "log/#{Rails.env}.log" + paths.add "log", with: "log/#{Rails.env}.log" paths.add "public" paths.add "public/javascripts" paths.add "public/stylesheets" diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index d2a402aa51..c520f7af9d 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -72,7 +72,7 @@ module Rails # Set app reload just after the finisher hook to ensure # paths added in the hook are still loaded. - initializer :set_clear_dependencies_hook, :group => :all do + initializer :set_clear_dependencies_hook, group: :all do callback = lambda do ActiveSupport::DescendantsTracker.clear ActiveSupport::Dependencies.clear @@ -83,7 +83,7 @@ module Rails self.reloaders << reloader # We need to set a to_prepare callback regardless of the reloader result, i.e. # models should be reloaded if any of the reloaders (i18n, routes) were updated. - ActionDispatch::Reloader.to_prepare(:prepend => true){ reloader.execute } + ActionDispatch::Reloader.to_prepare(prepend: true){ reloader.execute } else ActionDispatch::Reloader.to_cleanup(&callback) end @@ -97,8 +97,9 @@ module Rails end initializer :activate_queue_consumer do |app| - if config.queue == ActiveSupport::Queue - app.queue_consumer = config.queue_consumer.start(app.queue, {logger: Rails.logger}) + if config.queue.class == ActiveSupport::Queue + app.queue_consumer = config.queue_consumer || config.queue.consumer + app.queue_consumer.start at_exit { app.queue_consumer.shutdown } end end diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb index 6f9a200aa9..737977adf9 100644 --- a/railties/lib/rails/application/routes_reloader.rb +++ b/railties/lib/rails/application/routes_reloader.rb @@ -4,7 +4,7 @@ module Rails class Application class RoutesReloader attr_reader :route_sets, :paths - delegate :execute_if_updated, :execute, :updated?, :to => :updater + delegate :execute_if_updated, :execute, :updated?, to: :updater def initialize @paths = [] |