class FaucetPipelineRails::Manifest

Public Instance Methods

fetch(asset_name) click to toggle source
# File lib/faucet_pipeline_rails/manifest.rb, line 7
def fetch(asset_name)
  manifest.fetch(asset_name)
rescue KeyError
  raise "The asset '#{asset_name}' was not in the manifest"
end

Private Instance Methods

manifest() click to toggle source
# File lib/faucet_pipeline_rails/manifest.rb, line 15
def manifest
  return parsed_manifest unless Rails.env.production?
  @manifest ||= parsed_manifest
end
manifest_path() click to toggle source
# File lib/faucet_pipeline_rails/manifest.rb, line 32
def manifest_path
  Rails.configuration.faucet_pipeline.manifest_path
end
parsed_manifest() click to toggle source
# File lib/faucet_pipeline_rails/manifest.rb, line 20
def parsed_manifest
  JSON.parse(unparsed_manifest)
rescue JSON::ParserError
  raise "The manifest file '#{manifest_path}' is invalid JSON"
end
unparsed_manifest() click to toggle source
# File lib/faucet_pipeline_rails/manifest.rb, line 26
def unparsed_manifest
  File.read(manifest_path)
rescue Errno::ENOENT
  raise "The manifest file '#{manifest_path}' is missing"
end