Module: DeployPin::Runner
- Defined in:
- lib/deploy_pin/runner.rb
Overview
executes tasks
Class Method Summary collapse
Class Method Details
.list(group:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/deploy_pin/runner.rb', line 14 def self.list(group:) pending(group: group).each_with_index do |task, index| puts "======= Task ##{index} ========" puts task.script puts "" end puts "======= summary ========" puts "tasks number: #{pending(group: group).count}" end |
.pending(group:) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/deploy_pin/runner.rb', line 25 def self.pending(group:) files = Dir["#{DeployPin.tasks_path}/*.rb"] records = DeployPin::Record.pluck(:uuid) files.map do |file| task = DeployPin::Task.new(file) task.parse_file task unless records.include?(task.uuid) || task.group != group end.compact end |
.run(group:) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/deploy_pin/runner.rb', line 5 def self.run(group:) tasks = pending(group: group) tasks.each_with_index do |task, index| puts "[#{index + 1}/#{tasks.count}] Task UUID #{task.uuid}" task.run puts "" end end |