class Stove::Cookbook

Attributes

changeset[RW]

The changeset for this cookbook. This is written by the changelog generator and read by various plugins.

@return [String, nil]

the changeset for this cookbook
metadata[R]

The metadata for this cookbook.

@return [Stove::Cookbook::Metadata]

name[R]

The name of the cookbook (must correspond to the name of the cookbook on the Supermarket).

@return [String]

path[R]

The path to this cookbook on disk.

@return [Pathname]

version[R]

The version of this cookbook (originally).

@return [String]

Public Class Methods

new(path) click to toggle source

Create a new wrapper around the cookbook object.

@param [String] path

the relative or absolute path to the cookbook on disk
# File lib/stove/cookbook.rb, line 53
def initialize(path)
  @path = File.expand_path(path)
  load_metadata!
end

Public Instance Methods

released?() click to toggle source

Deterine if this cookbook version is released on the Supermarket

@warn

This is a fairly expensive operation and the result cannot be
reliably cached!

@return [Boolean]

true if this cookbook at the current version exists on the community
site, false otherwise
# File lib/stove/cookbook.rb, line 82
def released?
  Supermarket.cookbook(name, version)
  true
rescue ChefAPI::Error::HTTPNotFound
  false
end
tag_version() click to toggle source

The tag version. This is just the current version prefixed with the letter “v”.

@example Tag version for 1.0.0

cookbook.tag_version #=> "v1.0.0"

@return [String]

# File lib/stove/cookbook.rb, line 67
def tag_version
  "v#{version}"
end
tarball(extended_metadata = false) click to toggle source

So there's this really really crazy bug that the tmp directory could be deleted mid-request…

@return [File]

# File lib/stove/cookbook.rb, line 95
def tarball(extended_metadata = false)
  @tarball ||= Packager.new(self, extended_metadata).tarball
end

Private Instance Methods

load_metadata!() click to toggle source

Load the metadata and set the @metadata instance variable.

@raise [ArgumentError]

if there is no metadata.rb

@return [String]

the path to the metadata file
# File lib/stove/cookbook.rb, line 107
def load_metadata!
  metadata_path = File.join(path, 'metadata.rb')

  @metadata = Stove::Cookbook::Metadata.from_file(metadata_path)
  @name     = @metadata.name
  @version  = @metadata.version

  metadata_path
end
Also aliased as: reload_metadata!
reload_metadata!()
Alias for: load_metadata!