Sha256: 7409ed2076cda966dd75879c2c3196851222cb6c425939798ce9f86a2eb7483c

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 KB

Contents

module Windows::Pkg
  include Beaker::CommandFactory

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

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

  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

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

  # Examine the host system to determine the architecture, overrides default host determine_if_x86_64 so that wmic is used
  # @return [Boolean] true if x86_64, false otherwise
  def determine_if_x86_64
    identify_windows_architecture.include?('64')
  end

  private

  # @api private
  def identify_windows_architecture
    platform.arch.include?('64') ? '64' : '32'
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
beaker-6.4.1 lib/beaker/host/windows/pkg.rb
beaker-6.4.0 lib/beaker/host/windows/pkg.rb
beaker-6.3.0 lib/beaker/host/windows/pkg.rb
beaker-6.2.0 lib/beaker/host/windows/pkg.rb
beaker-6.1.0 lib/beaker/host/windows/pkg.rb
beaker-5.8.1 lib/beaker/host/windows/pkg.rb
beaker-5.8.0 lib/beaker/host/windows/pkg.rb
beaker-5.7.0 lib/beaker/host/windows/pkg.rb
beaker-5.6.0 lib/beaker/host/windows/pkg.rb
beaker-5.5.0 lib/beaker/host/windows/pkg.rb
beaker-5.4.0 lib/beaker/host/windows/pkg.rb
beaker-5.3.1 lib/beaker/host/windows/pkg.rb
beaker-5.3.0 lib/beaker/host/windows/pkg.rb
beaker-5.2.0 lib/beaker/host/windows/pkg.rb
beaker-5.1.0 lib/beaker/host/windows/pkg.rb
beaker-5.0.0 lib/beaker/host/windows/pkg.rb