class Sprockets::Manifest

def initialize(*args)


Manifest.new(environment, "./public/assets/manifest.json")

".sprockets-manifest-*.json" file in that directory.
Otherwise, if the path is a directory, the filename will default a random
dirname of the `filename` will be used to write compiled assets to.
path to the manifest json file. The file may or may not already exist. The
Create new Manifest associated with an `environment`. `filename` is a full
def initialize(*args)
  if args.first.is_a?(Base) || args.first.nil?
    @environment = args.shift
  end
  @directory, @filename = args[0], args[1]
  # Whether the manifest file is using the old manifest-*.json naming convention
  @legacy_manifest = false
  # Expand paths
  @directory = File.expand_path(@directory) if @directory
  @filename  = File.expand_path(@filename) if @filename
  # If filename is given as the second arg
  if @directory && File.extname(@directory) != ""
    @directory, @filename = nil, @directory
  end
  # Default dir to the directory of the filename
  @directory ||= File.dirname(@filename) if @filename
  # If directory is given w/o filename, pick a random manifest location
  @rename_filename = nil
  if @directory && @filename.nil?
    @filename = find_directory_manifest(@directory)
    # If legacy manifest name autodetected, mark to rename on save
    if File.basename(@filename).start_with?("manifest")
      @rename_filename = File.join(@directory, generate_manifest_path)
    end
  end
  unless @directory && @filename
    raise ArgumentError, "manifest requires output filename"
  end
  data = {}
  begin
    if File.exist?(@filename)
      data = json_decode(File.read(@filename))
    end
  rescue JSON::ParserError => e
    logger.error "#{@filename} is invalid: #{e.class} #{e.message}"
  end
  @data = data
end