Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed ActionDispatch::Static, but left empty MiddlewareStack to uni…

…fy app method between Engine and Application
  • Loading branch information...
commit 3939d6bb51fc36ac863f0e4766ed8d87fad98297 1 parent 7d7263b
@drogus drogus authored
View
6 railties/lib/rails/application.rb
@@ -147,12 +147,6 @@ def load_console(sandbox=false)
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)
View
2  railties/lib/rails/application/configuration.rb
@@ -11,7 +11,7 @@ class Configuration < ::Rails::Engine::Configuration
: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(*)
View
14 railties/lib/rails/engine.rb
@@ -124,6 +124,11 @@ def find_root_with_flag(flag, default=nil)
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 @@ def endpoint
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 @@ def initializers
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
View
5 railties/lib/rails/engine/configurable.rb
@@ -21,11 +21,6 @@ def inherited(base)
def instance
@instance ||= new
end
-
- def endpoint(endpoint = nil)
- @endpoint = endpoint if endpoint
- @endpoint
- end
end
def config
View
3  railties/lib/rails/engine/configuration.rb
@@ -5,12 +5,11 @@ class Engine
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
View
25 railties/test/railties/engine_test.rb
@@ -126,30 +126,5 @@ class Engine < ::Rails::Engine
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
Please sign in to comment.
Something went wrong with that request. Please try again.