Class: Builderator::Tasks::Berkshelf

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

Overview

Wrap Berkshelf commands

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Thor::Actions

#run_with_input, #template

Class Method Details

.exit_on_failure? ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/builderator/tasks/berkshelf.rb', line 14

def self.exit_on_failure?
  true
end

Instance Method Details

#clean ⇒ Object



57
58
59
60
61
# File 'lib/builderator/tasks/berkshelf.rb', line 57

def clean
  remove_dir Interface.berkshelf.vendor
  remove_file Interface.berkshelf.source
  remove_file Interface.berkshelf.lockfile
end

#configure ⇒ Object



19
20
21
# File 'lib/builderator/tasks/berkshelf.rb', line 19

def configure
  Interface.berkshelf.write
end

#uncache ⇒ Object



52
53
54
# File 'lib/builderator/tasks/berkshelf.rb', line 52

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

#upload ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/builderator/tasks/berkshelf.rb', line 39

def upload
  vendor

  command = "#{Interface.berkshelf.command} upload "
  command << "-c #{Interface.berkshelf.berkshelf_config} "
  command << "-b #{Interface.berkshelf.source}"

  inside Interface.berkshelf.directory do
    run command
  end
end

#vendor ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/builderator/tasks/berkshelf.rb', line 24

def vendor
  invoke :configure, [], options
  empty_directory Interface.berkshelf.vendor

  command = "#{Interface.berkshelf.command} vendor #{Interface.berkshelf.vendor} "
  command << "-c #{Interface.berkshelf.berkshelf_config} "
  command << "-b #{Interface.berkshelf.source}"

  inside Interface.berkshelf.directory do
    remove_file Interface.berkshelf.lockfile
    run command
  end
end