class Aspera::Environment
detect OS, architecture, and OS specific stuff
Constants
- CPU_LIST
- CPU_PPC64
- CPU_PPC64LE
- CPU_S390
- CPU_X86_64
- OS_AIX
- OS_LINUX
- OS_LIST
- OS_WINDOWS
- OS_X
Public Class Methods
architecture()
click to toggle source
# File lib/aspera/environment.rb, line 47 def self.architecture return "#{os}-#{cpu}" end
cpu()
click to toggle source
# 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()
click to toggle source
# File lib/aspera/environment.rb, line 51 def self.exe_extension return '.exe' if os.eql?(OS_WINDOWS) return '' end
fix_home()
click to toggle source
on Windows, the env var %USERPROFILE% provides the path to user's home more reliably than %HOMEDRIVE%%HOMEPATH%
# 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()
click to toggle source
# 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