Sha256: 363c10e6de800502ed2742f453b42cedb64ea3f77be7b888fe39147ee4c33e7f

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require 'psychic/runner/version'

autoload :YAML, 'yaml'

module Psychic
  autoload :Util,   'psychic/util'
  autoload :Logger, 'psychic/logger'
  autoload :Shell,  'psychic/shell'
  class Runner
    autoload :BaseRunner, 'psychic/runner/base_runner'
    autoload :SampleRunner, 'psychic/runner/sample_runner'
    autoload :HotRunner, 'psychic/runner/hot_runner'
    autoload :CompoundRunner, 'psychic/runner/compound_runner'
    autoload :ColdRunnerRegistry, 'psychic/runner/cold_runner_registry'
    class TaskNotImplementedError < NotImplementedError; end
    ColdRunnerRegistry.autoload_runners!

    include BaseRunner
    include SampleRunner
    attr_reader :runners, :hot_runner, :cold_runners

    def initialize(opts = { cwd: Dir.pwd })
      fail 'cwd is required' unless opts[:cwd]
      super
      @hot_runner = HotRunner.new(opts)
      @cold_runners = ColdRunnerRegistry.active_runners(opts)
      @runners = [@hot_runner, @cold_runners].flatten
      @known_tasks = @runners.map(&:known_tasks).uniq
    end

    def [](task_name)
      runner = runners.find { |r| r.command_for_task(task_name) }
      return nil unless runner
      runner[task_name]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
psychic-runner-0.0.5 lib/psychic/runner.rb
psychic-runner-0.0.4 lib/psychic/runner.rb
psychic-runner-0.0.3 lib/psychic/runner.rb
psychic-runner-0.0.2 lib/psychic/runner.rb