Sha256: 3f97ed9afb96e3fe02fd12d908e21ba2d0a74695c4de488a00b0760ac8d2127e

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

require 'rbconfig'

module OsUtil

  def OsUtil.p4d_executable
    if windows?
      'p4d.exe'
    else
      'p4d'
    end
  end

  def OsUtil.p4d_path
    File.expand_path(File.join(Conventions.working_dir, OsUtil.p4d_executable))
  end

  def OsUtil.osx?
    RbConfig::CONFIG['host_os'] =~ /darwin/
  end

  def OsUtil.windows?
    RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
  end

  def OsUtil.platform_dir_prefix
    if osx?
      'darwin90'
    elsif windows?
      'nt'
    else
      raise "OsUtil doesn't know platform: #{RbConfig::CONFIG['host_os']}"
    end
  end

  def OsUtil.ftp_download_dir(version)
    "perforce/#{version}/bin.#{platform_dir_prefix}#{RbConfig::CONFIG['build_cpu']}"
  end

  def OsUtil.p4api_file
    if windows?
      raise 'hey you need a visual studio version defined somehow'
      'p4api.zip'
    else
      'p4api.tgz'
    end
  end

  def OsUtil.p4api_path
    File.expand_path(File.join(Conventions.working_dir, OsUtil.p4api_file))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
p4util-0.0.2 ./lib/osutil.rb
p4util-0.0.1 ./lib/osutil.rb