Class: Batali::Manifest

Inherits:
Utility
  • Object
show all
Includes:
Bogo::Memoization
Defined in:
lib/batali/manifest.rb

Overview

Collection of resolved units

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(path) ⇒ Manifest

Build manifest from given path. If no file exists, empty manifest will be provided.

Parameters:

  • path (String)

    path to manifest

Returns:



18
19
20
21
22
23
24
# File 'lib/batali/manifest.rb', line 18

def self.build(path)
  if(File.exist?(path))
    new(Bogo::Config.new(path).data.merge(:path => path))
  else
    new(:path => path)
  end
end

Instance Method Details

#include?(unit) ⇒ TrueClass, FalseClass

Check for unit within manifest

Parameters:

Returns:

  • (TrueClass, FalseClass)


30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/batali/manifest.rb', line 30

def include?(unit)
  memoize(unit.inspect) do
    if(cookbook)
      !!cookbook.detect do |ckbk|
        ckbk.name == unit.name &&
          ckbk.version == unit.version
      end
    else
      false
    end
  end
end