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
-
scientific
-
sles
-
ubuntu
-
windows
-
solaris
-
aix
-
el
-
cumulus
-
f5
-
netscaler
-
archlinux
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/beaker/platform.rb', line 75 def initialize(name) if name !~ PLATFORMS raise ArgumentError, "Unsupported platform name #{name}" end super @variant, version, @arch = self.split('-', 3) codename_version_hash = PLATFORM_VERSION_CODES[@variant.to_sym] @version = version @codename = nil if 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 end |