Class: Dapp::Builder::Chef

Inherits:
Base
  • Object
show all
Defined in:
lib/dapp/builder/chef.rb,
lib/dapp/builder/chef/error.rb,
lib/dapp/builder/chef/berksfile.rb,
lib/dapp/builder/chef/cookbook_metadata.rb

Overview

Chef

Defined Under Namespace

Classes: Berksfile, CookbookMetadata, Error

Constant Summary collapse

LOCAL_COOKBOOK_CHECKSUM_PATTERNS =
%w(
  attributes/**/*
  recipes/**/*
  files/**/*
  templates/**/*
).freeze
DEFAULT_CHEFDK_IMAGE =

TODO: config, DSL, DEFAULT_CHEFDK_IMAGE

'dappdeps/chefdk:0.17.3-1'.freeze

Instance Attribute Summary

Attributes inherited from Base

#dimg

Instance Method Summary collapse

Methods inherited from Base

#before_install, #before_install?, #before_install_checksum, #before_setup, #before_setup?, #before_setup_checksum, #build_artifact, #build_artifact?, #build_artifact_checksum, #initialize, #install, #install?, #install_checksum, #setup, #setup?, #setup_checksum

Constructor Details

This class inherits a constructor from Dapp::Builder::Base

Instance Method Details

#before_dimg_should_be_built_checkObject



49
50
51
52
53
54
55
56
57
58
# File 'lib/dapp/builder/chef.rb', line 49

def before_dimg_should_be_built_check
  super

  %i(before_install install before_setup setup chef_cookbooks).each do |stage|
    unless stage_empty?(stage) || stage_cookbooks_checksum_path(stage).exist?
      raise ::Dapp::Error::Dimg, code: :chef_stage_checksum_not_calculated,
                                 data: { stage: stage }
    end
  end
end

#chef_cookbooks(image) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/dapp/builder/chef.rb', line 40

def chef_cookbooks(image)
  image.add_volume "#{cookbooks_vendor_path(chef_cookbooks_stage: true)}:#{dimg.container_dapp_path('chef_cookbooks')}"
  image.add_command(
    "#{dimg.project.mkdir_bin} -p /usr/share/dapp/chef_repo",
    ["#{dimg.project.cp_bin} -a #{dimg.container_dapp_path('chef_cookbooks')} ",
     '/usr/share/dapp/chef_repo/cookbooks'].join
  )
end

#chef_cookbooks_checksumObject



36
37
38
# File 'lib/dapp/builder/chef.rb', line 36

def chef_cookbooks_checksum
  stage_cookbooks_checksum(:chef_cookbooks)
end