Class: Litterbox::Habitat::Upload
- Inherits:
-
Object
- Object
- Litterbox::Habitat::Upload
- Defined in:
- lib/litterbox/habitat/upload.rb
Overview
Habitat upload
Instance Method Summary collapse
-
#initialize(pkg, auth) ⇒ Upload
constructor
A new instance of Upload.
- #upload(pkg = @pkg, auth = @auth) ⇒ Object
Constructor Details
#initialize(pkg, auth) ⇒ Upload
Returns a new instance of Upload.
7 8 9 10 |
# File 'lib/litterbox/habitat/upload.rb', line 7 def initialize(pkg, auth) @pkg = pkg @auth = auth end |
Instance Method Details
#upload(pkg = @pkg, auth = @auth) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# 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 |