Class: Version
- Inherits:
-
Object
- Object
- Version
- Defined in:
- lib/HMC/Version.rb
Instance Attribute Summary collapse
-
#base_version ⇒ Object
readonly
Returns the value of attribute base_version.
-
#hmcBuildLevel ⇒ Object
readonly
Returns the value of attribute hmcBuildLevel.
-
#patches ⇒ Object
readonly
Returns the value of attribute patches.
-
#patches_raw ⇒ Object
readonly
Returns the value of attribute patches_raw.
-
#release ⇒ Object
readonly
Returns the value of attribute release.
-
#servicePack ⇒ Object
readonly
Returns the value of attribute servicePack.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #hasFix?(fix_name) ⇒ Boolean
-
#initialize(string = '') ⇒ Version
constructor
A new instance of Version.
- #parse(string) ⇒ Object
- #parse_patches(string) ⇒ Object
- #version_cmd ⇒ Object
Constructor Details
Instance Attribute Details
#base_version ⇒ Object (readonly)
Returns the value of attribute base_version.
7 8 9 |
# File 'lib/HMC/Version.rb', line 7 def base_version @base_version end |
#hmcBuildLevel ⇒ Object (readonly)
Returns the value of attribute hmcBuildLevel.
6 7 8 |
# File 'lib/HMC/Version.rb', line 6 def hmcBuildLevel @hmcBuildLevel end |
#patches ⇒ Object (readonly)
Returns the value of attribute patches.
8 9 10 |
# File 'lib/HMC/Version.rb', line 8 def patches @patches end |
#patches_raw ⇒ Object (readonly)
Returns the value of attribute patches_raw.
9 10 11 |
# File 'lib/HMC/Version.rb', line 9 def patches_raw @patches_raw end |
#release ⇒ Object (readonly)
Returns the value of attribute release.
4 5 6 |
# File 'lib/HMC/Version.rb', line 4 def release @release end |
#servicePack ⇒ Object (readonly)
Returns the value of attribute servicePack.
5 6 7 |
# File 'lib/HMC/Version.rb', line 5 def servicePack @servicePack end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/HMC/Version.rb', line 3 def version @version end |
Instance Method Details
#hasFix?(fix_name) ⇒ Boolean
76 77 78 |
# File 'lib/HMC/Version.rb', line 76 def hasFix?(fix_name) @patches.key?(fix_name) end |
#parse(string) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/HMC/Version.rb', line 17 def parse(string) regexp_all = %r{Version:\s(\d)\s+ \s+Release:\s+(\d\.\d\.\d)\s+ \s+Service\sPack:\s+(\d+)\s+ \s+HMC\sBuild\slevel\s([\d\.]+)\s* (.*)\s*\"\,\"base_version=(V\dR\d\.\d\.\d)\s+ \s+\"}x regexp = %r{Version:\s(\d)\s+ \s+Release:\s+(\d\.\d\.\d)\s+ \s+Service\sPack:\s+(\d+)\s+ HMC\sBuild\slevel\s([\d\.]+)\s* (.*)\s* \"\,\"base_version=(V\dR\d\.\d\.\d)\s+ }x match = regexp.match(string) if match @version = match[1] @release = match[2] @servicePack = match[3] @hmcBuildLevel = match[4] @patches_raw = match[5] @base_version = match[6] parse_patches(@patches_raw) unless @patches_raw.empty? else puts string puts regexp puts match puts "regexp couldn't decode string #{string}" raise end end |
#parse_patches(string) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/HMC/Version.rb', line 57 def parse_patches(string) regexp = %r{(MH\d{5})\:(.*)} match = regexp.match(string) if match version = match[1] description = match[2] @patches[version] = description else puts string puts regexp puts match puts "regexp couldn't decode string #{string}" raise end end |
#version_cmd ⇒ Object
80 81 82 |
# File 'lib/HMC/Version.rb', line 80 def version_cmd 'lshmc -V' end |