Class: Litterbox::Habitat::Export

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

Overview

Habitat upload

Instance Method Summary collapse

Constructor Details

#initialize(pkg, exporter = 'docker') ⇒ Export

Returns a new instance of Export.



7
8
9
10
# File 'lib/litterbox/habitat/export.rb', line 7

def initialize(pkg, exporter = 'docker')
  @pkg = pkg
  @exporter = exporter
end

Instance Method Details

#upload(pkg = @pkg, exporter = @exporter) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/litterbox/habitat/export.rb', line 12

def upload(pkg = @pkg, exporter = @exporter)
  raise 'file artifact not found' unless File.exist?(pkg)
  Open3.popen3("hab pkg export #{exporter} #{pkg}") do |_, out, _, thr|
    while (line = out.gets)
      puts(line)
    end
    return thr.value
  end
end