module NativeExtFetcher::Platform

Constants

HOST_ARCH
HOST_DLEXT
HOST_OS
HOST_STATIC_EXT

Public Class Methods

native_extension_file_ext() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 75
def self.native_extension_file_ext
  ".#{HOST_DLEXT}"
end
native_extension_file_postfix() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 67
def self.native_extension_file_postfix
  "-#{HOST_OS}-#{HOST_ARCH}.#{HOST_DLEXT}"
end
native_extension_key() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 63
def self.native_extension_key
  :"#{HOST_OS}_#{HOST_ARCH}"
end
native_extension_static_file_ext() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 79
def self.native_extension_static_file_ext
  ".#{HOST_STATIC_EXT}"
end
native_extension_static_file_postfix() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 71
def self.native_extension_static_file_postfix
  "-#{HOST_OS}-#{HOST_ARCH}.#{HOST_STATIC_EXT}"
end
native_extension_tuple() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 83
def self.native_extension_tuple
  [HOST_ARCH, HOST_OS]
end

Protected Class Methods

determine_host_arch() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 28
def determine_host_arch
  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/
    'arm'
  else
    cpu
  end
end
determine_host_dlext() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 43
def determine_host_dlext
  RbConfig::CONFIG['DLEXT'].downcase
end
determine_host_os() click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 8
def determine_host_os
  case os = RbConfig::CONFIG['host_os'].downcase
  when /linux/
    'linux'
  when /darwin/
    'darwin'
  when /freebsd/
    'freebsd'
  when /netbsd/
    'netbsd'
  when /openbsd/
    'openbsd'
  when /sunos|solaris/
    'solaris'
  when /mingw|mswin/
    'windows'
  else os
  end
end
determine_host_static_ext(os) click to toggle source
# File lib/native_ext_fetcher/platform.rb, line 47
def determine_host_static_ext(os)
  case os
  when 'windows'
    'lib'
  else
    'a'
  end
end