Module: DeployPin::Runner

Defined in:
lib/deploy_pin/runner.rb

Class Method Summary collapse

Class Method Details

.list(identifiers:) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/deploy_pin/runner.rb', line 12

def self.list(identifiers:)
  DeployPin::Collector.new(identifiers: identifiers).list do |index, _count, task|
    self.print("======= Task ##{index} ========".white)

    # print details
    task.details.each do |key, value|
      self.print("#{key}:\t\t#{value}")
    end

    self.print('')
    self.print('<<<')
    self.print task.script.strip.green
    self.print('>>>')
    self.print('')
  end
end


35
36
37
# File 'lib/deploy_pin/runner.rb', line 35

def self.print(msg)
  puts(msg) unless Rails.env.test?
end

.run(identifiers:) ⇒ Object



6
7
8
9
10
# File 'lib/deploy_pin/runner.rb', line 6

def self.run(identifiers:)
  DeployPin::Collector.new(identifiers: identifiers).run do |index, count, task, executable|
    self.print("[#{index + 1}/#{count}] Task #{task.title} #{task.uuid}##{task.group} (#{executable ? 'run' : 'skip'})")
  end
end

.summary(identifiers:) ⇒ Object



29
30
31
32
33
# File 'lib/deploy_pin/runner.rb', line 29

def self.summary(identifiers:)
  # print summary
  self.print('======= Summary ========')
  self.print("tasks number: #{DeployPin::Collector.new(identifiers: identifiers).tasks_count}")
end