Sha256: e9e335a42ffcf8be50f417dec7f203ead0db0cd0cb72bc4e0216cc362b9aca1d

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

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::linux?
    RbConfig::CONFIG['host_os'] =~ /linux/
  end

  def OsUtil.platform_dir_prefix
    if osx?
      'darwin90'
    elsif windows?
      'nt'
    elsif linux?
      'linux26'
    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

1 entries across 1 versions & 1 rubygems

Version Path
p4util-0.0.3 ./lib/osutil.rb