Class: HelmWrapper::Shared::Binary
- Inherits:
-
Object
- Object
- HelmWrapper::Shared::Binary
- Includes:
- Logging
- Defined in:
- lib/helm-wrapper/shared/binary.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#name ⇒ Object
Returns the value of attribute name.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #check ⇒ Object
- #executable ⇒ Object
- #exists ⇒ Object
-
#initialize(options:) ⇒ Binary
constructor
A new instance of Binary.
- #path ⇒ Object
Methods included from Logging
configure_logger_for, logger_for
Constructor Details
#initialize(options:) ⇒ Binary
Returns a new instance of Binary.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/helm-wrapper/shared/binary.rb', line 30 def initialize(options:) logger.fatal("Binary base path must be a string!") unless ["base"].kind_of?(String) logger.fatal("Binary base path must not be blank!") if ["base"].strip.empty? @base = ["base"] logger.fatal("Binary version must be a string!") unless ["version"].kind_of?(String) logger.fatal("Binary version must not be blank!") if ["version"].strip.empty? @version = ["version"] @platform = platform_detect @directory = File.join(@base, @version, @platform) @name = "helm" end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
23 24 25 |
# File 'lib/helm-wrapper/shared/binary.rb', line 23 def base @base end |
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
24 25 26 |
# File 'lib/helm-wrapper/shared/binary.rb', line 24 def directory @directory end |
#name ⇒ Object
Returns the value of attribute name.
19 20 21 |
# File 'lib/helm-wrapper/shared/binary.rb', line 19 def name @name end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
25 26 27 |
# File 'lib/helm-wrapper/shared/binary.rb', line 25 def platform @platform end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
26 27 28 |
# File 'lib/helm-wrapper/shared/binary.rb', line 26 def version @version end |
Instance Method Details
#check ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/helm-wrapper/shared/binary.rb', line 49 def check() result = false if exists and executable then result = system("\"#{path}\" version --short") || false end return result end |
#executable ⇒ Object
67 68 69 |
# File 'lib/helm-wrapper/shared/binary.rb', line 67 def executable() return File.executable?(path) end |
#exists ⇒ Object
61 62 63 |
# File 'lib/helm-wrapper/shared/binary.rb', line 61 def exists() return File.exist?(path) end |
#path ⇒ Object
73 74 75 |
# File 'lib/helm-wrapper/shared/binary.rb', line 73 def path() return File.join(@directory, @name) end |