Class: CiCd::Builder::BuilderBase
- Inherits:
-
Object
- Object
- CiCd::Builder::BuilderBase
- Defined in:
- lib/cicd/builder.rb
Overview
noinspection ALL
Instance Attribute Summary collapse
-
#default_options ⇒ Object
Returns the value of attribute default_options.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#options ⇒ Object
Returns the value of attribute options.
-
#vars ⇒ Object
Returns the value of attribute vars.
Instance Method Summary collapse
-
#getBuilderVersion ⇒ Object
—————————————————————————————————————.
-
#initialize ⇒ BuilderBase
constructor
A new instance of BuilderBase.
-
#run ⇒ Object
—————————————————————————————————————.
-
#setup ⇒ Object
—————————————————————————————————————.
Constructor Details
#initialize ⇒ BuilderBase
Returns a new instance of BuilderBase.
32 33 34 35 36 37 38 39 40 |
# File 'lib/cicd/builder.rb', line 32 def initialize() @vars = { return_code: -1 } @default_options = { builder: ::CiCd::Builder::VERSION, env_keys: %w(JENKINS_HOME BUILD_NUMBER JOB_NAME) } end |
Instance Attribute Details
#default_options ⇒ Object
Returns the value of attribute default_options.
27 28 29 |
# File 'lib/cicd/builder.rb', line 27 def @default_options end |
#logger ⇒ Object
Returns the value of attribute logger.
29 30 31 |
# File 'lib/cicd/builder.rb', line 29 def logger @logger end |
#options ⇒ Object
Returns the value of attribute options.
28 29 30 |
# File 'lib/cicd/builder.rb', line 28 def @options end |
#vars ⇒ Object
Returns the value of attribute vars.
30 31 32 |
# File 'lib/cicd/builder.rb', line 30 def vars @vars end |
Instance Method Details
#getBuilderVersion ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/cicd/builder.rb', line 50 def getBuilderVersion { version: VERSION, major: MAJOR, minor: MINOR, patch: PATCH, } end |
#run ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/cicd/builder.rb', line 67 def run() setup() ret = 0 %w(checkEnvironment getVars).each do |step| @logger.step "#{step}" ret = send(step) break unless ret == 0 end if ret == 0 @vars[:actions].each do |step| @logger.step "#{step}" ret = send(step) break unless ret == 0 end end @vars[:return_code] end |
#setup ⇒ Object
60 61 62 63 64 |
# File 'lib/cicd/builder.rb', line 60 def setup() $stdout.write("CiCd::Builder v#{VERSION}\n") @default_options[:env_keys] = Hash[@default_options[:env_keys].flatten.map.with_index.to_a].keys parseOptions() end |