Module: Vendorificator::Hooks::ChefCookbookDependencies

Included in:
Vendor::ChefCookbook
Defined in:
lib/vendorificator/hooks/chef_cookbook.rb

Defined Under Namespace

Classes: FakeMetadata

Instance Method Summary collapse

Instance Method Details

#compute_dependencies!Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vendorificator/hooks/chef_cookbook.rb', line 17

def compute_dependencies!
  super

  # Dependencies
  ign = self.args.key?(:ignore_dependencies) ?
    args[:ignore_dependencies] :
      environment.config[:chef_cookbook_ignore_dependencies]

  if !ign || ign.respond_to?(:include?)
     = File.join(work_dir, 'metadata.rb')

    unless File.exist?()
      say_status :quiet, 'WARNING', "Metadata of #{name} does not exist at #{}, could not gather dependencies", :red
      return super
    end

    cbmd = Vendorificator::Hooks::ChefCookbookDependencies..new
    cbmd.from_file()

    basedir = Pathname.new(work_dir).dirname

    # All of cookbook's dependencies
    deps = cbmd.dependencies.map(&:first)

    # Reject ignored dependencies, if there's a list
    deps.reject! { |dep| ign.include?(dep) } if ign

    # Reject dependencies that already have a module
    deps.reject! do |dep|
      dir = basedir.join(dep).to_s
      environment.segments.any? do |vi|
        vi.work_dir == dir
      end
    end

    # Create module for the dependencies
    deps.each do |dep|
      Vendorificator::Vendor::ChefCookbook.new(environment, dep)
    end
  end
end

#initialize(*args) ⇒ Object



11
12
13
14
15
# File 'lib/vendorificator/hooks/chef_cookbook.rb', line 11

def initialize(*args)
  begin
  end
  super
end