Sha256: ab00beb37efa98fe8a603e1c1e16968ec28a5d145e8260477211fb455103d118

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

require 'chef/cookbook/metadata'

module Vendorificator::Hooks
  module ChefCookbookDependencies
    # Add required Chef cookbooks to vendor modules
    def dependencies
      ignored = Vendorificator::Config[:chef_cookbook_ignore_dependencies] || []
      metadata = File.join(self.work_dir, 'metadata.rb')

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

      cbmd = Chef::Cookbook::Metadata.new
      cbmd.from_file(metadata)

      super + cbmd.dependencies.
        reject { |name, version| ignored.include?(name) }.
        map { |name, version| Vendorificator::Vendor::ChefCookbook.new(name) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vendorificator-0.0.1 lib/vendorificator/hooks/chef_cookbook.rb