Sha256: 89ae6674b945e1660decffe1b668d64b6db2fcc9a059216d610773301de52b1c

Contents?: true

Size: 875 Bytes

Versions: 7

Compression:

Stored size: 875 Bytes

Contents

module Aua::OperatingSystems::Linux

  def self.extend?(agent)
    agent.platform_string == "X11" || agent.app_comments_string.match(PATTERN_LINUX)
  end

  PATTERN_LINUX = /(l|L)inux/

  def platform
    :X11
  end

  def os_name
    :Linux
  end

  def os_version
    @os_version ||= if app_comments_string =~ /OpenBSD/
      "OpenBSD"
    elsif products.include?("Ubuntu")
      "Ubuntu"
    elsif products.include?("Red") && products.include?("Hat")
      "Red Hat"
    elsif products.include?("CentOS")
      "CentOS"
    elsif products.include?("Gentoo")
      "Gentoo"
    elsif products.include?("SUSE")
      "SUSE"
    elsif products.include?("Fedora")
      "Fedora"
    elsif app_comments_string =~ /FreeBSD/
      "FreeBSD"
    elsif raw =~ /SunOS/
      "Solaris"
    elsif raw =~ /Debian/
      "Debian"
    elsif raw =~ /Maemo/
      "Maemo"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
aua-0.3.2 lib/aua/operating_systems/linux.rb
aua-0.3.1 lib/aua/operating_systems/linux.rb
aua-0.3.0 lib/aua/operating_systems/linux.rb
aua-0.2.6 lib/aua/operating_systems/linux.rb
aua-0.2.5 lib/aua/operating_systems/linux.rb
aua-0.2.4 lib/aua/operating_systems/linux.rb
aua-0.2.3 lib/aua/operating_systems/linux.rb