class Litterbox::Habitat::Package

Habitat package operations

Attributes

name[RW]

Public Class Methods

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

Public Instance Methods

demote(pkg_ident, channel, auth = ENV['HAB_AUTH_TOKEN']) click to toggle source
# 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) click to toggle source
# File lib/litterbox/habitat/package.rb, line 15
def exec(command)
  install
  exec_cmd "hab pkg exec #{@name} #{command}"
end
install(name = @name) click to toggle source
# 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']) click to toggle source
# 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) click to toggle source
# File lib/litterbox/habitat/package.rb, line 20
def upload(pkg, auth)
  Litterbox::Habitat::Upload.new(
    pkg, auth
  ).upload
end

Private Instance Methods

exec_cmd(command) click to toggle source
# File lib/litterbox/habitat/package.rb, line 38
def exec_cmd(command)
  cmd = Litterbox::Command.new(
    command
  )
  cmd.run_command
  cmd
end