Class: Bixby::Provision::System

Inherits:
Base
  • Object
show all
Defined in:
lib/bixby/provision/dsl/system.rb

Constant Summary collapse

EXPORTS =
[:refresh_packages, :upgrade_system, :package, :repo]

Constants inherited from Base

Base::PATH

Instance Attribute Summary collapse

Attributes inherited from Base

#manifest, #proxy

Instance Method Summary collapse

Methods inherited from Base

#get_gid, #get_group, #get_uid, #get_user, #tap, #tempfile

Methods included from Util::File

#chmod, #chown, #sha256sum, #which

Constructor Details

#initialize(*args) ⇒ System

Returns a new instance of System.



16
17
18
19
20
21
22
23
# File 'lib/bixby/provision/dsl/system.rb', line 16

def initialize(*args)
  super
  @packager = if ubuntu? then
    Packager::Apt.new(self)
  elsif centos? or amazon? then
    Packager::Yum.new(self)
  end
end

Instance Attribute Details

#packagerObject (readonly)

Returns the value of attribute packager.



14
15
16
# File 'lib/bixby/provision/dsl/system.rb', line 14

def packager
  @packager
end

Instance Method Details

#package(*packages) ⇒ Object Also known as: packages



35
36
37
38
39
# File 'lib/bixby/provision/dsl/system.rb', line 35

def package(*packages)
  packages.flatten!
  logger.info "[sys] installing packages: " + packages.join(" ")
  packager.install(*packages)
end

#refresh_packagesObject



25
26
27
28
# File 'lib/bixby/provision/dsl/system.rb', line 25

def refresh_packages
  logger.info "[sys] refresh_packages"
  packager.refresh
end

#repo(name, opts = {}) ⇒ Object



42
43
44
45
46
# File 'lib/bixby/provision/dsl/system.rb', line 42

def repo(name, opts={})
  if packager.install_repo(name, opts) then
    refresh_packages
  end
end

#upgrade_systemObject



30
31
32
33
# File 'lib/bixby/provision/dsl/system.rb', line 30

def upgrade_system
  logger.info "[sys] upgrade_system"
  packager.upgrade_system
end