Sha256: 2d79a4008d529fc082c3be0d31dbfac388d766e8baa39970b8ab6539c865c83d

Contents?: true

Size: 932 Bytes

Versions: 10

Compression:

Stored size: 932 Bytes

Contents

class Indocker::ImagesCompiler
  def initialize(logger)
    @logger = logger
  end

  def compile(configuration:, image_list:, skip_dependent:)
    preload_images(configuration, image_list)

    build_context = Indocker::BuildContext.new(
      configuration: configuration,
      build_server:  nil,
      logger: Indocker.logger
    )

    image_compiler = Indocker::Images::ImageCompiler.new

    image_list.each do |image_name|
      image = Indocker.configuration.images.detect do |i|
        i.name == image_name
      end

      image_compiler.compile(build_context, image, skip_dependent)
    end
  end

  private

  def preload_images(configuration, image_list)
    image_list.each do |image_name|
      image_path = Indocker.image_files.fetch(image_name) do
        @logger.error("image not found :#{image_name} in configuration :#{configuration.name}")
        exit 1
      end

      require image_path
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
indocker-0.1.9 lib/indocker/images_compiler.rb
indocker-0.1.8 lib/indocker/images_compiler.rb
indocker-0.1.7 lib/indocker/images_compiler.rb
indocker-0.1.6 lib/indocker/images_compiler.rb
indocker-0.1.5 lib/indocker/images_compiler.rb
indocker-0.1.4 lib/indocker/images_compiler.rb
indocker-0.1.3 lib/indocker/images_compiler.rb
indocker-0.1.2 lib/indocker/images_compiler.rb
indocker-0.1.1 lib/indocker/images_compiler.rb
indocker-0.1.0 lib/indocker/images_compiler.rb