Module: Mac::Pkg

Includes:
Beaker::CommandFactory
Included in:
Host
Defined in:
lib/beaker/host/mac/pkg.rb

Instance Attribute Summary

Attributes included from Beaker::CommandFactory

#assertions

Instance Method Summary collapse

Methods included from Beaker::CommandFactory

#execute, #fail_test

Instance Method Details

#check_for_package(name) ⇒ Object



4
5
6
# File 'lib/beaker/host/mac/pkg.rb', line 4

def check_for_package(name)
  raise "Package #{name} cannot be queried on #{self}"
end

#deploy_package_repo(path, name, version) ⇒ Object

Deploy configuration generated by the packaging tooling to this host.

This method calls one of #deploy_apt_repo, #deploy_yum_repo, or #deploy_zyp_repo depending on the platform of this Host.



33
34
35
# File 'lib/beaker/host/mac/pkg.rb', line 33

def deploy_package_repo(path, name, version)
  raise "Package repo cannot be deployed on #{self}; the platform is not supported"
end

#determine_if_x86_64Boolean

Examine the host system to determine the architecture

Returns:

  • (Boolean)

    true if x86_64, false otherwise



39
40
41
42
# File 'lib/beaker/host/mac/pkg.rb', line 39

def determine_if_x86_64
  result = exec(Beaker::Command.new("uname -a | grep x86_64"), :expect_all_exit_codes => true)
  result.exit_code == 0
end

#install_package(name, cmdline_args = '', version = nil) ⇒ Object



8
9
10
11
# File 'lib/beaker/host/mac/pkg.rb', line 8

def install_package(name, cmdline_args = '', version = nil)
  execute("hdiutil attach #{name}.dmg")
  execute("installer -pkg /Volumes/#{name}/#{name}.pkg -target /")
end

#uninstall_package(name, cmdline_args = '') ⇒ Object



13
14
15
# File 'lib/beaker/host/mac/pkg.rb', line 13

def uninstall_package(name, cmdline_args = '')
  raise "Package #{name} cannot be uninstalled on #{self}"
end

#upgrade_package(name, cmdline_args = '') ⇒ Object

Upgrade an installed package to the latest available version

Parameters:

  • name (String)

    The name of the package to update

  • cmdline_args (String) (defaults to: '')

    Additional command line arguments for the package manager



22
23
24
# File 'lib/beaker/host/mac/pkg.rb', line 22

def upgrade_package(name, cmdline_args = '')
    raise "Package #{name} cannot be upgraded on #{self}"
end