Sha256: 6c6ca900e33fc1594f4a9fc75eff155fd99c5a806369524514601b5473894742
Contents?: true
Size: 755 Bytes
Versions: 5
Compression:
Stored size: 755 Bytes
Contents
# manifest file module LuxAssets::Manifest INTEGRITY = 'sha512' MANIFEST = Pathname.new(ENV.fetch('ASSETS_MANIFEST') { './public/manifest.json' }) MANIFEST.write '{"files":{},"integrity":{}}' unless MANIFEST.exist? extend self def add name, path unless json['files'][name] == path json['files'][name] = path write end !File.exist?('./public'+path) end 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 def json @json ||= JSON.load MANIFEST.read end def write MANIFEST.write JSON.pretty_generate(@json) end end
Version data entries
5 entries across 5 versions & 1 rubygems