Module: Envkey::Platform
- Defined in:
- lib/envkey/platform.rb
Constant Summary collapse
- OS =
Normalize the platform OS
case os = RbConfig::CONFIG['host_os'].downcase when /linux/ "linux" when /darwin/ "darwin" when /bsd/ "freebsd" when /mingw|mswin/ "windows" else "linux" end
- ARCH =
Normalize the platform CPU
case cpu = RbConfig::CONFIG['host_cpu'].downcase when /amd64|x86_64/ "x86_64" when /i?86|x86|i86pc/ "x86" when /ppc|powerpc/ "powerpc" when /^arm|^aarch/ "arm" else cpu end
Class Method Summary collapse
- .arch_part ⇒ Object
- .ext ⇒ Object
- .fetch_env_path ⇒ Object
- .lib_file_dir ⇒ Object
- .platform_part ⇒ Object
Class Method Details
.arch_part ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/envkey/platform.rb', line 39 def self.arch_part if (platform_part == "darwin" || platform_part == "linux") && ARCH == "arm" "arm64" elsif ARCH == "x86_64" "amd64" else raise "As of 1.3.0, envkey-ruby only supports 64-bit systems. Please use an earlier version for 32-bit support." end end |
.ext ⇒ Object
49 50 51 |
# File 'lib/envkey/platform.rb', line 49 def self.ext platform_part == "windows" ? ".exe" : "" end |
.fetch_env_path ⇒ Object
53 54 55 |
# File 'lib/envkey/platform.rb', line 53 def self.fetch_env_path File.("../../ext/#{lib_file_dir}/envkey-source#{ext}", File.dirname(__FILE__)) end |
.lib_file_dir ⇒ Object
57 58 59 |
# File 'lib/envkey/platform.rb', line 57 def self.lib_file_dir ["envkey-source", Envkey::ENVKEY_SOURCE_VERSION.to_s, platform_part, arch_part].join("_") end |