Class: Stove::Cookbook

Inherits:
Object
  • Object
show all
Defined in:
lib/stove/cookbook.rb,
lib/stove/cookbook/metadata.rb

Defined Under Namespace

Classes: Metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Cookbook

Create a new wrapper around the cookbook object.

Parameters:

  • path (String)

    the relative or absolute path to the cookbook on disk



53
54
55
56
# File 'lib/stove/cookbook.rb', line 53

def initialize(path)
  @path = File.expand_path(path)
  load_metadata!
end

Instance Attribute Details

#changesetString?

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

Returns:

  • (String, nil)

    the changeset for this cookbook



45
46
47
# File 'lib/stove/cookbook.rb', line 45

def changeset
  @changeset
end

#metadataStove::Cookbook::Metadata (readonly)

The metadata for this cookbook.



36
37
38
# File 'lib/stove/cookbook.rb', line 36

def 
  @metadata
end

#nameString (readonly)

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

Returns:

  • (String)


22
23
24
# File 'lib/stove/cookbook.rb', line 22

def name
  @name
end

#pathPathname (readonly)

The path to this cookbook on disk.

Returns:

  • (Pathname)


14
15
16
# File 'lib/stove/cookbook.rb', line 14

def path
  @path
end

#versionString (readonly)

The version of this cookbook (originally).

Returns:

  • (String)


29
30
31
# File 'lib/stove/cookbook.rb', line 29

def version
  @version
end

Instance Method Details

#released?Boolean

Deterine if this cookbook version is released on the Supermarket

Returns:

  • (Boolean)

    true if this cookbook at the current version exists on the community site, false otherwise



82
83
84
85
86
87
# File 'lib/stove/cookbook.rb', line 82

def released?
  Supermarket.cookbook(name, version)
  true
rescue ChefAPI::Error::HTTPNotFound
  false
end

#tag_versionString

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

Examples:

Tag version for 1.0.0

cookbook.tag_version #=> "v1.0.0"

Returns:

  • (String)


67
68
69
# File 'lib/stove/cookbook.rb', line 67

def tag_version
  "v#{version}"
end

#tarball(extended_metadata = false) ⇒ File

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

Returns:

  • (File)


95
96
97
# File 'lib/stove/cookbook.rb', line 95

def tarball( = false)
  @tarball ||= Packager.new(self, ).tarball
end