class SleepingKingStudios::Tasks::Ci::StepsRunner
Abstract base class for running a sequence of tasks from a configured list.
Public Instance Methods
call(*args)
click to toggle source
# File lib/sleeping_king_studios/tasks/ci/steps_runner.rb, line 8 def call *args results = {} filtered_steps.each do |name, config| next if skip_step?(name, config) title = config.fetch(:title, name) results[title] = call_step(config, args) end # reduce results end
Private Instance Methods
call_step(config, args)
click to toggle source
# File lib/sleeping_king_studios/tasks/ci/steps_runner.rb, line 28 def call_step config, args class_name = config[:class] require_path = config.fetch(:require, require_path(class_name)) require require_path if require_path step_class = Object.const_get(class_name) instance = step_class.new(options) instance.call(*args) end
ci_steps()
click to toggle source
# File lib/sleeping_king_studios/tasks/ci/steps_runner.rb, line 24 def ci_steps [] end
filtered_steps()
click to toggle source
rubocop:disable Metrics/AbcSize
# File lib/sleeping_king_studios/tasks/ci/steps_runner.rb, line 41 def filtered_steps filtered = ci_steps if options.key?('except') && !options['except'].empty? filtered = filtered.reject { |key, _| options['except'].include?(key.to_s) } end # if if options.key?('only') && !options['only'].empty? filtered = filtered.select { |key, _| options['only'].include?(key.to_s) } end # if filtered end
require_path(class_name)
click to toggle source
rubocop:enable Metrics/AbcSize
# File lib/sleeping_king_studios/tasks/ci/steps_runner.rb, line 58 def require_path class_name class_name. split('::'). map { |str| tools.str.underscore(str) }. join '/' end
skip_step?(_name, _config)
click to toggle source
# File lib/sleeping_king_studios/tasks/ci/steps_runner.rb, line 65 def skip_step? _name, _config false end