class Litterbox::Habitat::Upload

Habitat upload

Public Class Methods

new(pkg, auth) click to toggle source
# File lib/litterbox/habitat/upload.rb, line 7
def initialize(pkg, auth)
  @pkg = pkg
  @auth = auth
end

Public Instance Methods

upload(pkg = @pkg, auth = @auth) click to toggle source
# File lib/litterbox/habitat/upload.rb, line 12
def upload(pkg = @pkg, auth = @auth)
  raise 'file artifact not found' unless File.exist?(pkg)
  raise 'must pass auth token' unless auth
  cmd = "hab pkg upload #{pkg} -z #{auth}"
  puts cmd
  Open3.popen3(cmd) do |_, out, _, thr|
    while (line = out.gets)
      puts(line)
    end
    return thr.value
  end
end