module LuxAssets::Manifest

manifest file

Constants

INTEGRITY
MANIFEST

Public Instance Methods

add(name, path) click to toggle source
# File lib/lux_assets/manifest.rb, line 10
def add name, path
  unless json['files'][name] == path
    json['files'][name]     = path
    write
  end

  !File.exist?('./public'+path)
end
update_integrity() click to toggle source
# File lib/lux_assets/manifest.rb, line 19
def update_integrity
  for name, path in json['files']
    json['integrity'][name] = '%s-%s' % [INTEGRITY, `openssl dgst -#{INTEGRITY} -binary ./public#{path} | openssl base64 -A`.chomp]
  end

  write
end

Private Instance Methods

json() click to toggle source
# File lib/lux_assets/manifest.rb, line 29
def json
  @json ||= JSON.load MANIFEST.read
end
write() click to toggle source
# File lib/lux_assets/manifest.rb, line 33
def write
  MANIFEST.write JSON.pretty_generate(@json)
end