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
# File 'lib/project.rb', line 11

def initialize(config)
  @targets = config.dig('targets')
  @title = config.dig('title')
  @description = config.dig('description')
  @pipelines = config.dig('pipelines')
  @credentials = config.dig('pipelines')
  @fail = false
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_name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/project.rb', line 20

def kick_off(pipeline_name)
  @pipeline = @pipelines.dig(pipeline_name) || nil
  if @pipeline.nil?
    puts 'ERROR: Pipeline does not exist!'
    exit 255
  end
  puts "PROJECT: #{@title}"
  puts "DESCRIPTION: #{@description}"
  puts "PIPELINE: #{pipeline_name}"
  puts "DESCRIPTION: #{@pipeline.dig('description')}"
  puts "TASKS: #{@pipeline.dig('tasks').count}"
  run(tasks, 'TASK:')
  if @fail
    run(error_tasks, 'CATCH:')
  else
    run(success_tasks, 'THEN:')
  end
end