Class: Stove::Cookbook

Inherits:
Object
  • Object
show all
Includes:
Logify
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



55
56
57
58
# File 'lib/stove/cookbook.rb', line 55

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



47
48
49
# File 'lib/stove/cookbook.rb', line 47

def changeset
  @changeset
end

#metadataStove::Cookbook::Metadata (readonly)

The metadata for this cookbook.



38
39
40
# File 'lib/stove/cookbook.rb', line 38

def 
  @metadata
end

#nameString (readonly)

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

Returns:

  • (String)


24
25
26
# File 'lib/stove/cookbook.rb', line 24

def name
  @name
end

#pathPathname (readonly)

The path to this cookbook on disk.

Returns:

  • (Pathname)


16
17
18
# File 'lib/stove/cookbook.rb', line 16

def path
  @path
end

#versionString (readonly)

The version of this cookbook (originally).

Returns:

  • (String)


31
32
33
# File 'lib/stove/cookbook.rb', line 31

def version
  @version
end

Instance Method Details

#released?Boolean

Deterine if this cookbook version is released on the community site

Returns:

  • (Boolean)

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



84
85
86
87
88
89
# File 'lib/stove/cookbook.rb', line 84

def released?
  Community.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)


69
70
71
# File 'lib/stove/cookbook.rb', line 69

def tag_version
  "v#{version}"
end

#tarballFile

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

Returns:

  • (File)


97
98
99
# File 'lib/stove/cookbook.rb', line 97

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