Module: OsUtil

Defined in:
lib/osutil.rb

Class Method Summary collapse

Class Method Details

.ftp_download_dir(version) ⇒ Object



54
55
56
# File 'lib/osutil.rb', line 54

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

.linux?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/osutil.rb', line 38

def OsUtil::linux?
  RbConfig::CONFIG['host_os'] =~ /linux/
end

.osx?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/osutil.rb', line 30

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

.p4_executableObject



18
19
20
21
22
23
24
# File 'lib/osutil.rb', line 18

def OsUtil.p4_executable
  if windows?
    'p4.exe'
  else
    'p4'
  end
end

.p4_pathObject



26
27
28
# File 'lib/osutil.rb', line 26

def OsUtil.p4_path
  File.expand_path(File.join(Conventions.working_dir, OsUtil.p4_executable))
end

.p4api_fileObject



58
59
60
61
62
63
64
65
# File 'lib/osutil.rb', line 58

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



67
68
69
# File 'lib/osutil.rb', line 67

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



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/osutil.rb', line 42

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

.windows?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/osutil.rb', line 34

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