Class: Ski::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#credentialsObject (readonly)

Returns the value of attribute credentials.



9
10
11
# File 'lib/project.rb', line 9

def credentials
  @credentials
end

#descriptionObject (readonly)

Returns the value of attribute description.



7
8
9
# File 'lib/project.rb', line 7

def description
  @description
end

#pipelinesObject (readonly)

Returns the value of attribute pipelines.



8
9
10
# File 'lib/project.rb', line 8

def pipelines
  @pipelines
end

#titleObject (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