Class: Ski::Project
- Inherits:
-
Object
- Object
- Ski::Project
- Defined in:
- lib/project.rb
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#pipelines ⇒ Object
readonly
Returns the value of attribute pipelines.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(config) ⇒ Project
constructor
A new instance of Project.
- #kick_off(pipeline_id) ⇒ Object
Constructor Details
#initialize(config) ⇒ Project
Returns a new instance of Project.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/project.rb', line 11 def initialize(config) @title = config.dig('title') @description = config.dig('description') @pipelines = config.dig('pipelines') @credentials = config.dig('pipelines') @fail = false puts "PROJECT: #{@title}" puts "DESCRIPTION: #{@description}" puts "PIPELINES:" @pipelines.each do |pipeline| puts " ID: #{pipeline.dig('pipeline', 'id')}" puts " DESCRIPTION: #{pipeline.dig('pipeline', 'description')}" puts " TASKS: #{pipeline.dig('pipeline', 'tasks').count}" end end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
9 10 11 |
# File 'lib/project.rb', line 9 def credentials @credentials end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/project.rb', line 7 def description @description end |
#pipelines ⇒ Object (readonly)
Returns the value of attribute pipelines.
8 9 10 |
# File 'lib/project.rb', line 8 def pipelines @pipelines end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/project.rb', line 6 def title @title end |
Instance Method Details
#kick_off(pipeline_id) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/project.rb', line 27 def kick_off(pipeline_id) @pipeline = @pipelines.find { |pipeline| pipeline.dig('pipeline', 'id') == pipeline_id } run(tasks, 'TASK:') if @fail run(error_tasks, 'ERROR:') else run(success_tasks, 'SUCCESS:') end end |