Class: Builderator::Tasks::Berks

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/builderator/tasks/berks.rb

Instance Method Summary collapse

Instance Method Details

#clean(path = Util::Cookbook::DEFAULT_VENDOR) ⇒ Object



63
64
65
# File 'lib/builderator/tasks/berks.rb', line 63

def clean(path = Util::Cookbook::DEFAULT_VENDOR)
  remove_dir path
end

#local(path = Util::Cookbook::DEFAULT_VENDOR.to_s) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/builderator/tasks/berks.rb', line 17

def local(path = Util::Cookbook::DEFAULT_VENDOR.to_s)
  Util::Cookbook.path(options['cookbook'])

  command = 'BERKS_INSTALL_FROM=source'
  command << " berks vendor #{ path }"
  command << " -c #{ options['config'] }" if options.include?('config')
  command << " -b #{ Util::Cookbook.berksfile }"

  remove_file File.expand_path('Berksfile.lock', Util::Cookbook.path)
  invoke Tasks::Cookbook, 'metadata', [], options
  run command
end

#uncache ⇒ Object



58
59
60
# File 'lib/builderator/tasks/berks.rb', line 58

def uncache
  remove_dir File.join(ENV['HOME'], '.berkshelf/cookbooks')
end

#upload(path = Util::Cookbook::DEFAULT_VENDOR.to_s) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/builderator/tasks/berks.rb', line 45

def upload(path = Util::Cookbook::DEFAULT_VENDOR.to_s)
  command = 'BERKS_INSTALL_FROM=source'
  command << " berks upload"
  command << " -c #{ options['config'] }" if options.include?('config')
  command << " -b #{ Util::Cookbook.berksfile }"

  invoke Tasks::Berks, :local, [path], options

  return say_status :dryrun, command if options['dry-run']
  run command
end

#vendor(path = Util::Cookbook::DEFAULT_VENDOR.to_s) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/builderator/tasks/berks.rb', line 31

def vendor(path = Util::Cookbook::DEFAULT_VENDOR.to_s)
  Util::Cookbook.path(options['cookbook'])

  command = 'BERKS_INSTALL_FROM=release'
  command << " berks vendor #{ path }"
  command << " -c #{ options['config'] }" if options.include?('config')
  command << " -b #{ Util::Cookbook.berksfile }"

  remove_file File.expand_path('Berksfile.lock', Util::Cookbook.path)
  run command
end