diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-11-16 14:40:38 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-11-16 14:40:38 +0100 |
commit | 0ebb0f61c3c66df517c1277265f337a09928da86 (patch) | |
tree | 6e929ad8ccf82e65e650e3cf60cd5dca3052b2ed /railties | |
parent | 9dcf330946a8bef0a0e2fb6e6d1bb92eae62a1da (diff) | |
parent | ce83dc98bb042b71c19bec600c2f3885efa33adf (diff) | |
download | rails-0ebb0f61c3c66df517c1277265f337a09928da86.tar.gz rails-0ebb0f61c3c66df517c1277265f337a09928da86.tar.bz2 rails-0ebb0f61c3c66df517c1277265f337a09928da86.zip |
Merge pull request #22298 from yuki24/make-static-index-part-of-public-file-server-config
Make the `config.static_index` option part of the `config.public_server` option
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 5 | ||||
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/application/default_middleware_stack.rb | 2 | ||||
-rw-r--r-- | railties/test/application/middleware/static_test.rb | 8 |
4 files changed, 12 insertions, 7 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 2fedeac292..aa12708669 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,8 @@ +* Make `static_index` part of the `config.public_file_server` config and + call it `public_file_server.index_name`. + + *Yuki Nishijima* + * Generated `Gemfile`s for new applications include a new dependency on [listen](https://github.com/guard/listen) commented out. diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 6d89caf514..80733c2d90 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -14,7 +14,7 @@ module Rails :eager_load, :exceptions_app, :file_watcher, :filter_parameters, :force_ssl, :helpers_paths, :logger, :log_formatter, :log_tags, :railties_order, :relative_url_root, :secret_key_base, :secret_token, - :ssl_options, :static_index, :public_file_server, + :ssl_options, :public_file_server, :session_options, :time_zone, :reload_classes_only_on_change, :beginning_of_week, :filter_redirect, :x @@ -29,9 +29,9 @@ module Rails @filter_parameters = [] @filter_redirect = [] @helpers_paths = [] - @static_index = "index" @public_file_server = ActiveSupport::OrderedOptions.new @public_file_server.enabled = true + @public_file_server.index_name = "index" @force_ssl = false @ssl_options = {} @session_store = :cookie_store diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb index b0d481c21a..5cb5bfb8b7 100644 --- a/railties/lib/rails/application/default_middleware_stack.rb +++ b/railties/lib/rails/application/default_middleware_stack.rb @@ -21,7 +21,7 @@ module Rails headers = config.public_file_server.headers || {} headers['Cache-Control'.freeze] = config.static_cache_control if config.static_cache_control - middleware.use ::ActionDispatch::Static, paths["public"].first, index: config.static_index, headers: headers + middleware.use ::ActionDispatch::Static, paths["public"].first, index: config.public_file_server.index_name, headers: headers end if rack_cache = load_rack_cache diff --git a/railties/test/application/middleware/static_test.rb b/railties/test/application/middleware/static_test.rb index 5366537dc2..1246e20d94 100644 --- a/railties/test/application/middleware/static_test.rb +++ b/railties/test/application/middleware/static_test.rb @@ -44,7 +44,7 @@ module ApplicationTests assert_equal 'public, max-age=60', last_response.headers["Cache-Control"] end - test "static_index defaults to 'index'" do + test "public_file_server.index_name defaults to 'index'" do app_file "public/index.html", "/index.html" require "#{app_path}/config/environment" @@ -54,10 +54,10 @@ module ApplicationTests assert_equal "/index.html\n", last_response.body end - test "static_index configurable" do + test "public_file_server.index_name configurable" do app_file "public/other-index.html", "/other-index.html" - add_to_config "config.static_index = 'other-index'" - + add_to_config "config.public_file_server.index_name = 'other-index'" + require "#{app_path}/config/environment" get '/' |