Class: Batali::Manifest

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

Overview

Collection of resolved units

Constant Summary

Constants inherited from Utility

Utility::UNC_PREFIX

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Utility

clean_path, join_path

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:



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

def self.build(path)
  path = Utility.join_path(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