class Dapp::Dimg::Builder::Chef::Berksfile
Attributes
builder[RW]
cookbook_path[R]
local_cookbooks[R]
Public Class Methods
from_conf(cookbook_path:, cookbooks:)
click to toggle source
# File lib/dapp/dimg/builder/chef/berksfile.rb, line 50 def from_conf(cookbook_path:, cookbooks:) new(cookbook_path).tap do |berksfile| berksfile.builder = FromConfBuilder.new(berksfile, cookbooks) end end
from_file(cookbook_path:, berksfile_file_path:)
click to toggle source
# File lib/dapp/dimg/builder/chef/berksfile.rb, line 44 def from_file(cookbook_path:, berksfile_file_path:) new(cookbook_path).tap do |berksfile| berksfile.builder = FromFileBuilder.new(berksfile, berksfile_file_path) end end
new(cookbook_path)
click to toggle source
# File lib/dapp/dimg/builder/chef/berksfile.rb, line 8 def initialize(cookbook_path) @cookbook_path = Pathname.new(cookbook_path) @local_cookbooks = {} end
Protected Class Methods
new(*args, &blk)
click to toggle source
Calls superclass method
# File lib/dapp/dimg/builder/chef/berksfile.rb, line 58 def new(*args, &blk) super(*args, &blk) end
Public Instance Methods
add_local_cookbook_path(name, path)
click to toggle source
# File lib/dapp/dimg/builder/chef/berksfile.rb, line 17 def add_local_cookbook_path(name, path) raise(Error::Chef, code: :berksfile_absolute_path_forbidden, data: {cookbook: name, path: path}) if path.start_with? '/' desc = { name: name, path: cookbook_path.join(path), chefignore: [] } if desc[:path].join('chefignore').exist? chefignore_patterns = desc[:path].join('chefignore').read.split("\n").map(&:strip) desc[:chefignore] = Dir[*chefignore_patterns.map {|pattern| desc[:path].join(pattern)}] .map(&Pathname.method(:new)) end @local_cookbooks[name] = desc end
dump()
click to toggle source
# File lib/dapp/dimg/builder/chef/berksfile.rb, line 13 def dump builder.send(:dump) # "friend class" end
local_cookbook(name)
click to toggle source
# File lib/dapp/dimg/builder/chef/berksfile.rb, line 39 def local_cookbook(name) local_cookbooks[name] end
local_cookbook?(name)
click to toggle source
# File lib/dapp/dimg/builder/chef/berksfile.rb, line 35 def local_cookbook?(name) local_cookbooks.key? name end