class ChefCLI::CookbookMetadata

by CookbookOmnifetch
Subclass of Chef’s Cookbook::Metadata class that provides the API expected

def self.from_path(path)

def self.from_path(path)
  metadata_json_path = File.join(path, "metadata.json")
  metadata_rb_path = File.join(path, "metadata.rb")
  if File.exist?(metadata_json_path)
    new.tap { |m| m.from_json(File.read(metadata_json_path)) }
  elsif File.exist?(metadata_rb_path)
    new.tap { |m| m.from_file(metadata_rb_path) }
  else
    raise MalformedCookbook, "Cookbook at #{path} has neither metadata.json or metadata.rb"
  end
end

def cookbook_name

def cookbook_name
  name
end