class SleepingKingStudios::Tasks::Apps::Ci::StepsTask

Thor task for running each step in the CI suite for each application and generating a report.

Public Class Methods

description() click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/steps_task.rb, line 14
def self.description
  'Runs the configured steps for each application.'
end

Public Instance Methods

call(*applications) click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/steps_task.rb, line 32
def call *applications
  filtered = filter_applications :only => applications
  results  = run_steps(filtered)
  globals  = run_global_steps

  aggregate_results(results) if filtered.count > 1

  (results['Totals'] ||= {}).update(globals)

  say "\n" unless quiet?

  reporter = ResultsReporter.new(self)
  reporter.call(results)

  results
end

Private Instance Methods

aggregate_results(results) click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/steps_task.rb, line 51
def aggregate_results results
  totals = Hash.new { |hsh, key| hsh[key] = 0 }

  results.each do |_, app_results|
    app_results.each do |step, step_results|
      next if step_results.nil?

      next totals[step] = step_results unless totals.key?(step)

      totals[step] = totals[step].merge(step_results)
    end # each
  end # each

  results['Totals'] = totals
end
run_global_steps() click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/steps_task.rb, line 67
def run_global_steps
  opts   = options.merge 'global' => true
  runner = SleepingKingStudios::Tasks::Apps::Ci::StepsRunner.new(opts)

  runner.call(nil)
end
run_steps(applications) click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/steps_task.rb, line 74
def run_steps applications
  results = Hash.new { |hsh, key| hsh[key] = {} }

  applications.each do |name, _|
    results[name] = run_steps_for_application(name)
  end # each

  results
end
run_steps_for_application(name) click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/steps_task.rb, line 84
def run_steps_for_application name
  steps_runner.call(name)
end
steps_runner() click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/steps_task.rb, line 88
def steps_runner
  SleepingKingStudios::Tasks::Apps::Ci::StepsRunner.new(options)
end