diff options
| author | Santiago Pastorino <santiago@wyeworks.com> | 2011-09-26 13:50:20 -0300 | 
|---|---|---|
| committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-09-26 13:54:06 -0300 | 
| commit | 17882d2a9e8e93a5f6dbe2278deb73269fff30c9 (patch) | |
| tree | 5b96280b74efb37108f860458ce93a52eb1412ba | |
| parent | 89e98e278abe8564b80953855fcb4bcb9871c51c (diff) | |
| download | rails-17882d2a9e8e93a5f6dbe2278deb73269fff30c9.tar.gz rails-17882d2a9e8e93a5f6dbe2278deb73269fff30c9.tar.bz2 rails-17882d2a9e8e93a5f6dbe2278deb73269fff30c9.zip  | |
Copy assets to nondigested filenames too
| -rw-r--r-- | actionpack/lib/sprockets/assets.rake | 14 | ||||
| -rw-r--r-- | railties/test/application/assets_test.rb | 2 | 
2 files changed, 11 insertions, 5 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake index 65f0ad4cc8..1e72d29ca2 100644 --- a/actionpack/lib/sprockets/assets.rake +++ b/actionpack/lib/sprockets/assets.rake @@ -19,10 +19,10 @@ namespace :assets do        # Ensure that action view is loaded and the appropriate sprockets hooks get executed        ActionView::Base -      # Always compile files -      Rails.application.config.assets.compile = true -        config = Rails.application.config +      config.assets.compile = true +      config.assets.digest = false if ENV["RAILS_ASSETS_NONDIGEST"] +        env    = Rails.application.assets        target = File.join(Rails.public_path, config.assets.prefix) @@ -32,8 +32,12 @@ namespace :assets do        manifest_path = config.assets.manifest || target        FileUtils.mkdir_p(manifest_path) -      File.open("#{manifest_path}/manifest.yml", 'wb') do |f| -        YAML.dump(manifest, f) +      unless ENV["RAILS_ASSETS_NONDIGEST"] +        File.open("#{manifest_path}/manifest.yml", 'wb') do |f| +          YAML.dump(manifest, f) +        end +        ENV["RAILS_ASSETS_NONDIGEST"] = "true" +        ruby $0, *ARGV        end      end    end diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index e9985fa643..12466a3296 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -63,7 +63,9 @@ module ApplicationTests        precompile!        files = Dir["#{app_path}/public/assets/application-*.js"] +      files << Dir["#{app_path}/public/assets/application.js"].first        files << Dir["#{app_path}/public/assets/foo/application-*.js"].first +      files << Dir["#{app_path}/public/assets/foo/application.js"].first        files.each do |file|          assert_not_nil file, "Expected application.js asset to be generated, but none found"          assert_equal "alert()", File.read(file)  | 
