Module: OsUtil

Defined in:
lib/osutil.rb

Class Method Summary collapse

Class Method Details

.ftp_download_dir(version) ⇒ Object



36
37
38
# File 'lib/osutil.rb', line 36

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

.osx?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/osutil.rb', line 18

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

.p4api_fileObject



40
41
42
43
44
45
46
47
# File 'lib/osutil.rb', line 40

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

.p4api_pathObject



49
50
51
# File 'lib/osutil.rb', line 49

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

.p4d_executableObject



6
7
8
9
10
11
12
# File 'lib/osutil.rb', line 6

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

.p4d_pathObject



14
15
16
# File 'lib/osutil.rb', line 14

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

.platform_dir_prefixObject



26
27
28
29
30
31
32
33
34
# File 'lib/osutil.rb', line 26

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

.windows?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/osutil.rb', line 22

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