Class: Ridley::Cookbook

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/ridley/resources/cookbook.rb

Overview

Author:

Class Method Summary collapse

Methods included from Resource

#<=>, #==, #attribute, #attribute=, #attribute?, #attributes, #attributes=, #chef_id, #eql?, #from_hash, #from_json, #hash, #initialize, #reload, #save, #to_hash, #to_json, #to_s

Class Method Details

.save(connection, name, version, manifest, options = {}) ⇒ Hash

Save a new Cookbook Version of the given name, version with the given manifest of files and checksums.

Parameters:

  • connection (Ridley::Connection)
  • name (String)
  • version (String)
  • manifest (String)

    a JSON blob containing file names, file paths, and checksums for each that describe the cookbook version being uploaded.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :freeze (Boolean)
  • :force (Boolean)

Returns:

  • (Hash)


21
22
23
24
25
26
27
28
29
# File 'lib/ridley/resources/cookbook.rb', line 21

def save(connection, name, version, manifest, options = {})
  freeze = options.fetch(:freeze, false)
  force  = options.fetch(:force, false)

  url = "cookbooks/#{name}/#{version}"
  url << "?force=true" if force

  connection.put(url, manifest)
end