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



45
46
47
# File 'lib/litterbox.rb', line 45

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

#export(exporter = 'docker') ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/litterbox.rb', line 72

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



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/litterbox.rb', line 55

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

#versionObject



50
51
52
# File 'lib/litterbox.rb', line 50

def version
  puts Litterbox::VERSION
end