Sha256: 5a17116550dcd073e2e104b15e661ccbaf632673e02d4fc3d7fca8b89a81b895

Contents?: true

Size: 965 Bytes

Versions: 4

Compression:

Stored size: 965 Bytes

Contents

require 'construi/container'
require 'construi/image'
require 'construi/target'

require 'construi/version'

require 'colorize'
require 'docker'

module Construi
  # Runs Construi
  class Runner
    def initialize(config)
      @config = config
    end

    def setup_docker
      docker_host = ENV['DOCKER_HOST']
      Docker.url = docker_host if docker_host

      puts "Docker url: #{Docker.url}"

      Excon.defaults[:ssl_verify_peer] = false

      Docker.validate_version!

      # Don't time out. We can't differentiate between a long running
      # task and a time out.
      Docker.options[:read_timeout] = nil

      # Low chunk size as we wish to receive streaming output ASAP
      Docker.options[:chunk_size] = 8
    end

    def run(targets)
      puts "Construi version: #{Construi::VERSION}"

      setup_docker

      puts "Current directory: #{Dir.pwd}"

      targets.map { |t| Target.new t, @config.target(t) } .each(&:run)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
construi-0.39.0 lib/construi/runner.rb
construi-0.38.0 lib/construi/runner.rb
construi-0.37.0 lib/construi/runner.rb
construi-0.36.0 lib/construi/runner.rb