config.assets.enabled is now true by default

This commit is contained in:
David Heinemeier Hansson 2013-01-05 17:55:57 +01:00
parent fada87e916
commit 201f8d7753
5 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,11 @@
## Rails 4.0.0 (unreleased) ## ## Rails 4.0.0 (unreleased) ##
* config.assets.enabled is now true by default. If you're upgrading from a Rails 3.x app
that does not use the asset pipeline, you'll be required to add `config.assets.enabled = false`
to your application.rb. If you don't want the asset pipeline on a new app use --skip-sprockets
*DHH*
* Environment name can be a start substring of the default environment names * Environment name can be a start substring of the default environment names
(production, development, test). For example: tes, pro, prod, dev, devel. (production, development, test). For example: tes, pro, prod, dev, devel.
Fix #8628. Fix #8628.

View File

@ -48,12 +48,12 @@ module Rails
@secret_key_base = nil @secret_key_base = nil
@assets = ActiveSupport::OrderedOptions.new @assets = ActiveSupport::OrderedOptions.new
@assets.enabled = false @assets.enabled = true
@assets.paths = [] @assets.paths = []
@assets.precompile = [ Proc.new { |path, fn| fn =~ /app\/assets/ && !%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)$/ ] /(?:\/|\\|\A)application\.(css|js)$/ ]
@assets.prefix = "/assets" @assets.prefix = "/assets"
@assets.version = '' @assets.version = '1.0'
@assets.debug = false @assets.debug = false
@assets.compile = true @assets.compile = true
@assets.digest = false @assets.digest = false

View File

@ -31,12 +31,9 @@ module <%= app_const_base %>
# like if you have constraints or database-specific column types. # like if you have constraints or database-specific column types.
# config.active_record.schema_format = :sql # config.active_record.schema_format = :sql
<% unless options.skip_sprockets? -%> <% if options.skip_sprockets? -%>
# Enable the asset pipeline. # Disable the asset pipeline.
config.assets.enabled = true config.assets.enabled = false
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
<% end -%> <% end -%>
end end
end end

View File

@ -32,6 +32,9 @@
# Generate digests for assets URLs. # Generate digests for assets URLs.
config.assets.digest = true config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
<%- end -%> <%- end -%>
# Specifies the header that your server uses for sending files. # Specifies the header that your server uses for sending files.

View File

@ -56,7 +56,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application"/ assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application"/
assert_file "app/views/layouts/application.html.erb", /javascript_include_tag\s+"application"/ assert_file "app/views/layouts/application.html.erb", /javascript_include_tag\s+"application"/
assert_file "app/assets/stylesheets/application.css" assert_file "app/assets/stylesheets/application.css"
assert_file "config/application.rb", /config\.assets\.enabled = true/
end end
def test_invalid_application_name_raises_an_error def test_invalid_application_name_raises_an_error