Sha256: 478cc6e7f070b5655ee90cbbc07a8544a535438c7ba03ddcef8423b5a3707600

Contents?: true

Size: 1.27 KB

Versions: 13

Compression:

Stored size: 1.27 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.p4_executable
    if windows?
      'p4.exe'
    else
      'p4'
    end
  end

  def OsUtil.p4_path
    File.expand_path(File.join(Conventions.working_dir, OsUtil.p4_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

13 entries across 13 versions & 1 rubygems

Version Path
p4util-0.4.3 ./lib/osutil.rb
p4util-0.4.2 ./lib/osutil.rb
p4util-0.4.1 ./lib/osutil.rb
p4util-0.4 ./lib/osutil.rb
p4util-0.3.1 ./lib/osutil.rb
p4util-0.3.0 ./lib/osutil.rb
p4util-0.2 ./lib/osutil.rb
p4util-0.1.6 ./lib/osutil.rb
p4util-0.1.5 ./lib/osutil.rb
p4util-0.1.4 ./lib/osutil.rb
p4util-0.1.3 ./lib/osutil.rb
p4util-0.1.1 ./lib/osutil.rb
p4util-0.1.0 ./lib/osutil.rb