Sha256: da957fe7aa41156556f015db43335e837c9f3b82820b33339883717eabb180bb

Contents?: true

Size: 914 Bytes

Versions: 10

Compression:

Stored size: 914 Bytes

Contents

module Eco
  class CLI

    def initialize
      @config = nil
    end

    def args
      ARGV
    end

    def options
      @options ||= {}
    end

    def config
      @config ||= Eco::CLI::Config.new(cli: self)
      @config.tap do |cnf|
        yield(cnf) if block_given?
      end
    end

    def workflow
      @workflow ||= Eco::CLI::Workflow.new(cli: self)
    end

    def run(session:)
      io = Eco::API::UseCases::BaseIO.new(session: session, options: options)
      io = io.new(options: config.options_set.process(io: io))

      session.workflow(io: io) do |wf, io|
        io = wf.run(:load, io: io)
        io = wf.run(:usecases, io: io)
        io = wf.run(:launch_jobs, io: io)
        io = wf.run(:post_launch, io: io)
        io = wf.run(:end, io: io)
      end
    end

  end
end

require_relative 'cli/scripting'
require_relative 'cli/config'

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
eco-helpers-1.0.8 lib/eco/cli.rb
eco-helpers-1.0.7 lib/eco/cli.rb
eco-helpers-1.0.6 lib/eco/cli.rb
eco-helpers-1.0.5 lib/eco/cli.rb
eco-helpers-1.0.4 lib/eco/cli.rb
eco-helpers-1.0.3 lib/eco/cli.rb
eco-helpers-0.9.5 lib/eco/cli.rb
eco-helpers-1.0.2 lib/eco/cli.rb
eco-helpers-0.9.4 lib/eco/cli.rb
eco-helpers-0.9.3 lib/eco/cli.rb