Browse Source

webshims issue

pull/1/head
Nicolae Claudius 11 years ago
parent
commit
2623ab55db
  1. 2
      Gemfile
  2. 4
      Gemfile.lock
  3. 29
      lib/tasks/assets_nondigest.rake

2
Gemfile

@ -24,7 +24,7 @@ gem 'unicorn', '~> 4.6.3'
gem 'sass-rails', '~> 4.0.0' gem 'sass-rails', '~> 4.0.0'
gem 'compass-rails', github: 'milgner/compass-rails', branch: 'rails4' gem 'compass-rails', github: 'milgner/compass-rails', branch: 'rails4'
gem 'bootstrap-sass', github: 'thomas-mcdonald/bootstrap-sass', branch: '3' gem 'bootstrap-sass', github: 'thomas-mcdonald/bootstrap-sass', branch: '3'
gem 'webshims-rails', '~> 1.10.10' gem 'webshims-rails', '~> 1.11.1'
gem 'detect_timezone_rails', '~> 0.0.3' gem 'detect_timezone_rails', '~> 0.0.3'
gem 'nprogress-rails', '~> 0.1.2.2' gem 'nprogress-rails', '~> 0.1.2.2'
gem 'animate-rails', '~> 1.0.0' gem 'animate-rails', '~> 1.0.0'

4
Gemfile.lock

@ -263,7 +263,7 @@ GEM
raindrops (~> 0.7) raindrops (~> 0.7)
warden (1.2.3) warden (1.2.3)
rack (>= 1.0) rack (>= 1.0)
webshims-rails (1.10.11) webshims-rails (1.11.1)
rails (> 3.1.0) rails (> 3.1.0)
xpath (2.0.0) xpath (2.0.0)
nokogiri (~> 1.3) nokogiri (~> 1.3)
@ -318,4 +318,4 @@ DEPENDENCIES
unicorn (~> 4.6.3) unicorn (~> 4.6.3)
userstamp (~> 2.0.2)! userstamp (~> 2.0.2)!
validates_hostname (~> 1.0.0)! validates_hostname (~> 1.0.0)!
webshims-rails (~> 1.10.10) webshims-rails (~> 1.11.1)

29
lib/tasks/assets_nondigest.rake

@ -0,0 +1,29 @@
# Needed for webshims
# https://github.com/whatcould/webshims-rails
# https://gist.github.com/eric1234/5692456
require 'fileutils'
desc "Create nondigest versions of all digest assets"
task "assets:precompile" do
fingerprint = /\-[0-9a-f]{32}\./
filemap = {}
Dir["public/assets/**/*"].each do |file|
next if file !~ fingerprint
next if File.directory?(file)
next if file.split(File::Separator).last =~ /^manifest/
nondigest = file.sub fingerprint, '.'
if filemap[nondigest]
if File.mtime(file) > filemap[nondigest][:time]
filemap[nondigest] = {file: file, time: File.mtime(file)}
end
else
filemap[nondigest] = {file: file, time: File.mtime(file)}
end
end
filemap.each do |nondigest, v|
FileUtils.cp v[:file], nondigest, verbose: true
end
end
Loading…
Cancel
Save