Method: Beaker::Platform#initialize

Defined in:
lib/beaker/platform.rb

#initialize(name) ⇒ Platform

Creates the Platform object. Checks to ensure that the platform String provided meets the platform formatting rules. Platforms name must be of the format /^OSFAMILY-VERSION-ARCH.*$/ where OSFAMILY is one of:

  • huaweios

  • cisco_nexus

  • cisco_ios_xr

  • freebsd

  • openbsd

  • osx

  • centos

  • fedora

  • debian

  • oracle

  • redhat

  • redhatfips

  • scientific

  • opensuse

  • sles

  • ubuntu

  • windows

  • solaris

  • aix

  • el

  • cumulus

  • f5

  • netscaler

  • archlinux

Raises:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/beaker/platform.rb', line 80

def initialize(name)
  raise ArgumentError, "Unsupported platform name #{name}" if !PLATFORMS.match?(name)

  super

  @variant, version, @arch = self.split('-', 3)
  codename_version_hash = PLATFORM_VERSION_CODES[@variant.to_sym]

  @version = version
  @codename = nil

  return unless codename_version_hash

  if codename_version_hash[version]
    @codename = version
    @version = codename_version_hash[version]
  else
    version = version.delete('.')
    version_codename_hash = codename_version_hash.invert
    @codename = version_codename_hash[version]
  end
end