Class: Aspera::Environment
- Inherits:
-
Object
- Object
- Aspera::Environment
- Defined in:
- lib/aspera/environment.rb
Overview
a simple binary data repository
Constant Summary collapse
- OS_WINDOWS =
:windows- OS_X =
:osx- OS_LINUX =
:linux- OS_AIX =
:aix- OS_LIST =
[OS_WINDOWS,OS_X,OS_LINUX,OS_AIX]
- CPU_X86_64 =
:x86_64- CPU_PPC64 =
:ppc64- CPU_PPC64LE =
:ppc64le- CPU_S390 =
:s390- CPU_LIST =
[CPU_X86_64,CPU_PPC64,CPU_PPC64LE,CPU_S390]
Class Method Summary collapse
- .architecture ⇒ Object
- .cpu ⇒ Object
- .exe_extension ⇒ Object
-
.fix_home ⇒ Object
on Windows, the env var %USERPROFILE% provides the path to user’s home more reliably then %HOMEDRIVE%%HOMEPATH%.
- .os ⇒ Object
Class Method Details
.architecture ⇒ Object
47 48 49 |
# File 'lib/aspera/environment.rb', line 47 def self.architecture return "#{os}-#{cpu}" end |
.cpu ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/aspera/environment.rb', line 33 def self.cpu case RbConfig::CONFIG['host_cpu'] when /x86_64/,/x64/ return :x86_64 when /powerpc/ return :ppc64le if os.eql?(OS_LINUX) return :ppc64 when /s390/ return :s390 else # other raise "Unknown CPU: #{RbConfig::CONFIG['host_cpu']}" end end |
.exe_extension ⇒ Object
51 52 53 54 |
# File 'lib/aspera/environment.rb', line 51 def self.exe_extension return '.exe' if os.eql?(OS_WINDOWS) return '' end |
.fix_home ⇒ Object
on Windows, the env var %USERPROFILE% provides the path to user’s home more reliably then %HOMEDRIVE%%HOMEPATH%
57 58 59 60 61 62 63 64 |
# File 'lib/aspera/environment.rb', line 57 def self.fix_home if os.eql?(OS_WINDOWS) if ENV.has_key?('USERPROFILE') and Dir.exist?(ENV['USERPROFILE']) ENV['HOME']=ENV['USERPROFILE'] Log.log.debug("Windows: set home to USERPROFILE: #{ENV['HOME']}") end end end |
.os ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/aspera/environment.rb', line 13 def self.os case RbConfig::CONFIG['host_os'] when /mswin/,/msys/,/mingw/,/cygwin/,/bccwin/,/wince/,/emc/ return OS_WINDOWS when /darwin/,/mac os/ return OS_X when /linux/ return OS_LINUX when /aix/ return OS_AIX else raise "Unknown OS: #{RbConfig::CONFIG['host_os']}" end end |