diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-07-08 12:07:25 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:04 +0200 |
commit | 3939d6bb51fc36ac863f0e4766ed8d87fad98297 (patch) | |
tree | cd41ace282d00be3f6d46ba516eb56cc20554c1d /railties | |
parent | 7d7263bf9dbf814f10803f5ec553ac2b0190b6a9 (diff) | |
download | rails-3939d6bb51fc36ac863f0e4766ed8d87fad98297.tar.gz rails-3939d6bb51fc36ac863f0e4766ed8d87fad98297.tar.bz2 rails-3939d6bb51fc36ac863f0e4766ed8d87fad98297.zip |
Removed ActionDispatch::Static, but left empty MiddlewareStack to unify app method between Engine and Application
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 14 | ||||
-rw-r--r-- | railties/lib/rails/engine/configurable.rb | 5 | ||||
-rw-r--r-- | railties/lib/rails/engine/configuration.rb | 3 | ||||
-rw-r--r-- | railties/test/railties/engine_test.rb | 25 |
6 files changed, 10 insertions, 45 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index a21b560084..05a26b64a8 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -147,12 +147,6 @@ module Rails self end - def app - @app ||= begin - config.middleware = config.middleware.merge_into(default_middleware_stack) - config.middleware.build(routes) - end - end alias :build_middleware_stack :app def call(env) diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 14669f47b7..a20208f8d5 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -11,7 +11,7 @@ module Rails :encoding, :consider_all_requests_local, :dependency_loading, :filter_parameters, :log_level, :logger, :preload_frameworks, :reload_plugins, - :secret_token, :session_options, + :secret_token, :serve_static_assets, :session_options, :time_zone, :whiny_nils def initialize(*) diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 409502cb08..a602dac5ff 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -124,6 +124,11 @@ module Rails Pathname.new(root).expand_path : Pathname.new(root).realpath end + def endpoint(endpoint = nil) + @endpoint = endpoint if endpoint + @endpoint + end + protected def method_missing(*args, &block) @@ -162,12 +167,6 @@ module Rails self.class.endpoint || routes end - def default_middleware_stack - ActionDispatch::MiddlewareStack.new.tap do |middleware| - middleware.use ::ActionDispatch::Static, paths.public.to_a.first if config.serve_static_assets - end - end - def call(env) app.call(env) end @@ -251,6 +250,9 @@ module Rails end protected + def default_middleware_stack + ActionDispatch::MiddlewareStack.new + end def _all_autoload_paths @_all_autoload_paths ||= (config.autoload_paths + config.eager_load_paths + config.autoload_once_paths).uniq diff --git a/railties/lib/rails/engine/configurable.rb b/railties/lib/rails/engine/configurable.rb index 0af01cace2..e668911913 100644 --- a/railties/lib/rails/engine/configurable.rb +++ b/railties/lib/rails/engine/configurable.rb @@ -21,11 +21,6 @@ module Rails def instance @instance ||= new end - - def endpoint(endpoint = nil) - @endpoint = endpoint if endpoint - @endpoint - end end def config diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb index b1adbe1f22..06e7222753 100644 --- a/railties/lib/rails/engine/configuration.rb +++ b/railties/lib/rails/engine/configuration.rb @@ -5,12 +5,11 @@ module Rails class Configuration < ::Rails::Railtie::Configuration attr_reader :root attr_writer :eager_load_paths, :autoload_once_paths, :autoload_paths - attr_accessor :middleware, :plugins, :serve_static_assets + attr_accessor :middleware, :plugins def initialize(root=nil) super() @root = root - @serve_static_assets = true @middleware = Rails::Configuration::MiddlewareStackProxy.new end diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index eeebbcc01f..39189edaa3 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -126,30 +126,5 @@ module RailtiesTest assert Bukkits::Engine.config.yaffle_loaded end - - test "engine can serve files" do - @plugin.write "lib/bukkits.rb", <<-RUBY - class Bukkits - class Engine < ::Rails::Engine - config.serve_static_assets = true - end - end - RUBY - - @plugin.write "public/omg.txt", <<-RUBY - OMG - RUBY - - boot_rails - - Rails::Application.routes.draw do |map| - mount(Bukkits::Engine => "/bukkits") - end - - env = Rack::MockRequest.env_for("/bukkits/omg.txt") - response = Rails::Application.call(env) - - assert_equal response[2].path, File.join(@plugin.path, "public/omg.txt") - end end end |