提交 17882d2a 编写于 作者: S Santiago Pastorino

Copy assets to nondigested filenames too

上级 89e98e27
...@@ -19,10 +19,10 @@ namespace :assets do ...@@ -19,10 +19,10 @@ namespace :assets do
# Ensure that action view is loaded and the appropriate sprockets hooks get executed # Ensure that action view is loaded and the appropriate sprockets hooks get executed
ActionView::Base ActionView::Base
# Always compile files
Rails.application.config.assets.compile = true
config = Rails.application.config config = Rails.application.config
config.assets.compile = true
config.assets.digest = false if ENV["RAILS_ASSETS_NONDIGEST"]
env = Rails.application.assets env = Rails.application.assets
target = File.join(Rails.public_path, config.assets.prefix) target = File.join(Rails.public_path, config.assets.prefix)
...@@ -32,8 +32,12 @@ namespace :assets do ...@@ -32,8 +32,12 @@ namespace :assets do
manifest_path = config.assets.manifest || target manifest_path = config.assets.manifest || target
FileUtils.mkdir_p(manifest_path) FileUtils.mkdir_p(manifest_path)
File.open("#{manifest_path}/manifest.yml", 'wb') do |f| unless ENV["RAILS_ASSETS_NONDIGEST"]
YAML.dump(manifest, f) 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 end
end end
......
...@@ -63,7 +63,9 @@ def precompile! ...@@ -63,7 +63,9 @@ def precompile!
precompile! precompile!
files = Dir["#{app_path}/public/assets/application-*.js"] 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 << Dir["#{app_path}/public/assets/foo/application.js"].first
files.each do |file| files.each do |file|
assert_not_nil file, "Expected application.js asset to be generated, but none found" assert_not_nil file, "Expected application.js asset to be generated, but none found"
assert_equal "alert()", File.read(file) assert_equal "alert()", File.read(file)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册