class Binpkgbot::Tasks::Include

Public Instance Methods

run() click to toggle source
# File lib/binpkgbot/tasks/include.rb, line 7
def run
  name = @options[:name]
  raise ArgumentError, "include task is missing :name -- what to include?" unless name
  Dir.glob[name].sort.each do |path|
    yaml = YAML.load_file(path)
    if yaml.kind_of?(Array)
      raise ArgumentError, "#{path} should be an array of task definitions"
    end
    yaml.each do |task_def|
      Tasks.from_definition(task_def, config: @config).execute
    end
  end
end