Module: Builderator::Util::Berkshim

Defined in:
lib/builderator/util/berkshim.rb

Instance Method Summary collapse

Instance Method Details

#shims ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/builderator/util/berkshim.rb', line 9

def shims

  ## Root cookbook sources
   if ENV['BERKS_INSTALL_FROM'] == 'source'

  if ENV['BERKS_INSTALL_FROM'] == 'release'
    cookbook_spec = [].tap do |arguments|
      arguments << Util::Cookbook..name
      arguments << ENV['VERSION'] if ENV.include?('VERSION')

      arguments << {}.tap do |options|
        options[:path] = ENV['COOKBOOK_PATH'] if ENV.include?('COOKBOOK_PATH')
        options[:git] = ENV['COOKBOOK_REPO'] if ENV.include?('COOKBOOK_REPO')
        options[:github] = ENV['COOKBOOK_GITHUB'] if ENV.include?('COOKBOOK_GITHUB')
        options[:branch] = ENV['COOKBOOK_BRANCH'] if ENV.include?('COOKBOOK_BRANCH')
        options[:ref] = ENV['COOKBOOK_REF'] if ENV.include?('COOKBOOK_REF')
        options[:tag] = ENV['COOKBOOK_TAG'] if ENV.include?('COOKBOOK_TAG')
      end
    end

    cookbook(*cookbook_spec)
  end
end