Class: LogicalConstruct::UnpackCookbook

Inherits:
Mattock::TaskLib
  • Object
show all
Defined in:
lib/logical-construct/target/unpack-cookbook.rb

Instance Method Summary collapse

Instance Method Details

#default_namespaceObject



3
4
5
# File 'lib/logical-construct/target/unpack-cookbook.rb', line 3

def default_namespace
  :cookbook
end

#default_settings(provision) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/logical-construct/target/unpack-cookbook.rb', line 7

def default_settings(provision)
  settings(
    :construct_dir => provision.construct_dir,
    :cookbook_metadata => nil,
    :cookbook_dir => nil,
    :cookbook_name => "cookbook",
    :cookbook_archive => nil
  )
end

#defineObject



30
31
32
33
34
35
36
37
38
# File 'lib/logical-construct/target/unpack-cookbook.rb', line 30

def define
  in_namespace do
    file cookbook_archive
    file  => cookbook_archive do
      untar_command.run
    end
    task :unpack => 
  end
end

#resolve_settingsObject



17
18
19
20
21
22
# File 'lib/logical-construct/target/unpack-cookbook.rb', line 17

def resolve_settings
  self.cookbook_archive ||= File::join(construct_dir, "cookbook.tbz")
  self.cookbook_dir ||= File::join(construct_dir, cookbook_name)

  self. ||= File::join(cookbook_dir, "metadata.rb")
end

#untar_commandObject



24
25
26
27
28
# File 'lib/logical-construct/target/unpack-cookbook.rb', line 24

def untar_command
  Mattock::CommandLine.new("tar", "-xjf") do |cmd|
    cmd.options << cookbook_archive
  end
end