Module: Windows::Pkg

Includes:
Beaker::CommandFactory
Included in:
Host
Defined in:
lib/beaker/host/windows/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_command(name) ⇒ Object



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

def check_for_command(name)
  result = exec(Beaker::Command.new("which #{name}"), :accept_all_exit_codes => true)
  result.exit_code == 0
end

#check_for_package(name) ⇒ Object



9
10
11
12
# File 'lib/beaker/host/windows/pkg.rb', line 9

def check_for_package(name)
  result = exec(Beaker::Command.new("cygcheck #{name}"), :accept_all_exit_codes => true)
  result.exit_code == 0
end

#determine_if_x86_64Boolean

Examine the host system to determine the architecture, overrides default host determine_if_x86_64 so that wmic is used

Returns:

  • (Boolean)

    true if x86_64, false otherwise



34
35
36
# File 'lib/beaker/host/windows/pkg.rb', line 34

def determine_if_x86_64
  identify_windows_architecture.include?('64')
end

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



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/beaker/host/windows/pkg.rb', line 14

def install_package(name, cmdline_args = '')
  arch = identify_windows_architecture

  if arch == '64'
    rootdir = "c:\\\\cygwin64"
    cygwin = "setup-x86_64.exe"
  else # 32 bit version
    rootdir = "c:\\\\cygwin"
    cygwin = "setup-x86.exe"
  end

  execute("#{cygwin} -q -n -N -d -R #{rootdir} -s http://cygwin.osuosl.org -P #{name} #{cmdline_args}")
end

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



28
29
30
# File 'lib/beaker/host/windows/pkg.rb', line 28

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