Sha256: 6d26ddee467c575302c303d67eea848f15b0803d13fe04973daba69a50cae971

Contents?: true

Size: 843 Bytes

Versions: 1

Compression:

Stored size: 843 Bytes

Contents

module Windows::Pkg
  include Beaker::CommandFactory

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

  def install_package name
    cygwin = ""
    rootdir = ""
    result = exec(Beaker::Command.new("wmic os get osarchitecture | grep 32"), :acceptable_exit_codes => (0...127))
    if result.exit_code == 0 #32 bit version
      rootdir = "c:\\\\cygwin"
      cygwin = "setup-x86.exe"
    else  #64 bit version
      rootdir = "c:\\\\cygwin64"
      cygwin = "setup-x86_64.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 #{rootdir} -s http://cygwin.osuosl.org -P #{name}") 
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beaker-0.0.0 lib/beaker/host/windows/pkg.rb