Module: LuxAssets::Manifest

Extended by:
Manifest
Included in:
Manifest
Defined in:
lib/lux_assets/manifest.rb

Overview

manifest file

Constant Summary collapse

INTEGRITY =
'sha512'
MANIFEST =
Pathname.new(ENV.fetch('ASSETS_MANIFEST') { './public/manifest.json' })

Instance Method Summary collapse

Instance Method Details

#add(name, path) ⇒ Object



10
11
12
13
14
15
16
17
# 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_integrityObject



19
20
21
22
23
24
25
# 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