Class: Sprockets::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/non-stupid-digest-assets.rb

Instance Method Summary collapse

Instance Method Details

#compile_with_non_digest(*args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/non-stupid-digest-assets.rb', line 27

def compile_with_non_digest *args
  paths = compile_without_non_digest *args

  NonStupidDigestAssets.files(files).each do |(digest_path, info)|
    full_digest_path = File.join dir, digest_path
    full_digest_gz_path = "#{full_digest_path}.gz"
    full_non_digest_path = File.join dir, info['logical_path']
    full_non_digest_gz_path = "#{full_non_digest_path}.gz"

    if File.exists? full_digest_path
      logger.debug "Writing #{full_non_digest_path}"
      FileUtils.copy_file full_digest_path, full_non_digest_path, :preserve_attributes
    else
      logger.debug "Could not find: #{full_digest_path}"
    end
    if File.exists? full_digest_gz_path
      logger.debug "Writing #{full_non_digest_gz_path}"
      FileUtils.copy_file full_digest_gz_path, full_non_digest_gz_path, :preserve_attributes
    else
      logger.debug "Could not find: #{full_digest_gz_path}"
    end
  end
  paths
end