Class: Litterbox::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/litterbox.rb

Overview

CLI for litterbox

Instance Method Summary collapse

Instance Method Details

#build(path = '.') ⇒ Object



16
17
18
# File 'lib/litterbox.rb', line 16

def build(path = '.')
  Litterbox::Habitat::Build.new(path).build
end

#export(exporter = 'docker') ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/litterbox.rb', line 38

def export(exporter = 'docker')
  path ||= find_last_build
  raise "Could not find last_build.env in #{locations}" unless path

  path = File.join(LAST_BUILD) unless path.include?(LAST_BUILD)
  last_build = Litterbox.last_build(
    path
  )

  Litterbox::Habitat::Export.new(
    File.join(plan_dir, 'results', last_build.pkg_artifact),
    exporter
  ).upload
end

#upload(path = find_last_build) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/litterbox.rb', line 21

def upload(path = find_last_build)
  raise "Could not find last_build.env in #{locations}" unless path
  path = File.join(path, LAST_BUILD) unless path.include?(LAST_BUILD)
  last_build = Litterbox.last_build(
    path
  )
  plan_dir = path.dup
  plan_dir.slice! LAST_BUILD
  artifact = File.join(plan_dir, last_build.pkg_artifact)

  Litterbox::Habitat::Upload.new(
    artifact,
    ENV['HAB_AUTH_TOKEN']
  ).upload
end