Method: Hwid::Base#get_platform

Defined in:
lib/hwid/base.rb

#get_platformObject

returns array of platforms



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/hwid/base.rb', line 23

def get_platform
  platform=[]
  testos=`uname -a`
  puts "osname is #{testos}"
  platform << "raspberry" if (/arm-linux/ =~ RUBY_PLATFORM) != nil and `uname -a`.include?('armv6')
  platform << "raspberry" if `uname -a`.include?('armv6')
  platform << "raspberry 2" if (/armv7l-linux/ =~ RUBY_PLATFORM) != nil and !`uname -a`.include?('armv6')
  platform << "mac" if (/darwin/ =~ RUBY_PLATFORM) != nil
  platform << "arm" if (/arm/ =~ RUBY_PLATFORM) != nil
  platform << "x86" if (/x86/ =~ RUBY_PLATFORM) != nil
  platform << "i686" if (/i686/ =~ RUBY_PLATFORM) != nil
  platform << "microsoft" if testos.include?('Microsoft')
  platform << "debian" if  testos.include?('Debian')
  platform << "ubuntu" if  testos.include?('Ubuntu')
  platform << "linux" if (/linux/ =~ RUBY_PLATFORM) != nil
  platform
end