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:
-
amazon
-
amazonfips
-
freebsd
-
openbsd
-
osx
-
centos
-
fedora
-
debian
-
oracle
-
redhat
-
redhatfips
-
scientific
-
opensuse
-
sles
-
ubuntu
-
windows
-
solaris
-
aix
-
el
-
archlinux
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/beaker/platform.rb', line 60 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 |