Class: Litterbox::Habitat::Package

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

Overview

Habitat package operations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Package

Returns a new instance of Package.



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

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/litterbox/habitat/package.rb', line 5

def name
  @name
end

Instance Method Details

#demote(pkg_ident, channel, auth = ENV['HAB_AUTH_TOKEN']) ⇒ Object



32
33
34
# File 'lib/litterbox/habitat/package.rb', line 32

def demote(pkg_ident, channel, auth = ENV['HAB_AUTH_TOKEN'])
  exec_cmd "hab pkg demote #{pkg_ident} #{channel} -z #{auth}"
end

#exec(command) ⇒ Object



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

def exec(command)
  install
  exec_cmd "hab pkg exec #{@name} #{command}"
end

#install(name = @name) ⇒ Object



11
12
13
# File 'lib/litterbox/habitat/package.rb', line 11

def install(name = @name)
  exec_cmd "hab pkg install #{name}"
end

#promote(pkg_ident, channel, auth = ENV['HAB_AUTH_TOKEN']) ⇒ Object



26
27
28
29
30
# File 'lib/litterbox/habitat/package.rb', line 26

def promote(pkg_ident, channel, auth = ENV['HAB_AUTH_TOKEN'])
  Litterbox::Habitat::Promote.new(
    pkg_ident, channel, auth
  ).promote
end

#upload(pkg, auth) ⇒ Object



20
21
22
23
24
# File 'lib/litterbox/habitat/package.rb', line 20

def upload(pkg, auth)
  Litterbox::Habitat::Upload.new(
    pkg, auth
  ).upload
end