Method: ChefCLI::Policyfile::DSL#metadata

Defined in:
lib/chef-cli/policyfile/dsl.rb

#metadataObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/chef-cli/policyfile/dsl.rb', line 141

def 
  cookbook_root = storage_config.relative_paths_root
  unless File.exist?(File.join(cookbook_root, "metadata.rb")) || File.exist?(File.join(cookbook_root, "metadata.json"))
    raise PolicyfileMissingCookbookMetadata.new(cookbook_root)
  end

  begin
    cookbook_name = CookbookMetadata.from_path(cookbook_root).cookbook_name
  rescue Exception => e
    raise PolicyfileBadCookbookMetadata.new(cookbook_root, e)
  end
  name cookbook_name if name.nil?
  cookbook(cookbook_name, path: ".")
end