Sha256: 401240e1455ad4143e12d89a3c2cefd26660851d706086a513008f39ce875ef1

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 Bytes

Contents

# frozen_string_literal: true

module Floe
  class Workflow
    class Runner
      include Logging

      class << self
        attr_writer :docker_runner_klass

        def docker_runner_klass
          @docker_runner_klass ||= const_get(ENV.fetch("DOCKER_RUNNER", "docker").capitalize)
        end

        def for_resource(resource)
          raise ArgumentError, "resource cannot be nil" if resource.nil?

          scheme = resource.split("://").first
          case scheme
          when "docker"
            docker_runner_klass.new
          else
            raise "Invalid resource scheme [#{scheme}]"
          end
        end
      end

      def run!(image, env = {}, secrets = {})
        raise NotImplementedError, "Must be implemented in a subclass"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
floe-0.1.1 lib/floe/workflow/runner.rb
floe-0.1.0 lib/floe/workflow/runner.rb