Class: KnifeCookbookDependencies::Cookbookfile

Inherits:
Object
  • Object
show all
Extended by:
DSL
Defined in:
lib/kcd/cookbookfile.rb

Class Method Summary collapse

Methods included from DSL

cookbook, group

Class Method Details

.process_install(without = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/kcd/cookbookfile.rb', line 13

def process_install(without=nil)
  # TODO: friendly error message when the file doesn't exist
  
  filename = KCD::DEFAULT_FILENAME + ".lock"
  lockfile = false

  if File.exist?(filename)
    lockfile = true
  else
    filename = KCD::DEFAULT_FILENAME unless File.exist?(filename)
  end

  begin
    read File.read(filename)
  rescue Errno::ENOENT => e
    KCD.ui.fatal ErrorMessages.missing_cookbookfile
    exit 100
  end

  KCD.shelf.exclude(without)
  KCD.shelf.resolve_dependencies
  KCD.shelf.populate_cookbooks_directory
  KCD.shelf.write_lockfile unless lockfile
end

.read(content) ⇒ Object



6
7
8
9
10
11
# File 'lib/kcd/cookbookfile.rb', line 6

def read(content)
  # This will populate KnifeCookbookDependencies.shelf. TODO: consider making this
  # build and return the shelf rather than building the shelf as
  # a side effect.
  instance_eval(content)
end