Class: ChefCLI::CookbookMetadata

Inherits:
Chef::Cookbook::Metadata
  • Object
show all
Defined in:
lib/chef-cli/cookbook_metadata.rb

Overview

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_path(path) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/chef-cli/cookbook_metadata.rb', line 27

def self.from_path(path)
   = File.join(path, "metadata.json")
   = File.join(path, "metadata.rb")

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

Instance Method Details

#cookbook_nameObject



40
41
42
# File 'lib/chef-cli/cookbook_metadata.rb', line 40

def cookbook_name
  name
end