Module: Windows::Pkg

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

Instance Method Summary collapse

Methods included from Beaker::CommandFactory

#execute, #fail_test

Instance Method Details

#check_for_package(name) ⇒ Object



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

def check_for_package(name)
  result = exec(Beaker::Command.new("which #{name}"), :acceptable_exit_codes => (0...127))
  result.exit_code == 0 
end

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



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

def install_package(name, cmdline_args = '')
  cygwin = ""
  rootdir = ""

  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

  if not check_for_package(cygwin)
    execute("curl --retry 5 http://cygwin.com/#{cygwin} -o /cygdrive/c/Windows/System32/#{cygwin}")
  end
  execute("#{cygwin} -q -n -N -d -R #{cmdline_args} #{rootdir} -s http://cygwin.osuosl.org -P #{name}") 
end

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



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

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