class Indocker::BuildContextHelper

Attributes

build_server[R]
configuration[R]

Public Class Methods

new(configuration, build_server) click to toggle source
# File lib/indocker/build_context_helper.rb, line 4
def initialize(configuration, build_server)
  @configuration = configuration
  @build_server = build_server
  @cloned_repositories = Hash.new(false)
end

Public Instance Methods

container_enabled?(container) click to toggle source
# File lib/indocker/build_context_helper.rb, line 44
def container_enabled?(container)
  @configuration.enabled_containers.include?(container.name)
end
containers() click to toggle source
# File lib/indocker/build_context_helper.rb, line 102
def containers
  @containers ||= Containers.new(@configuration)
end
get_binding() click to toggle source
# File lib/indocker/build_context_helper.rb, line 106
def get_binding
  binding
end
global_build_args() click to toggle source
# File lib/indocker/build_context_helper.rb, line 40
def global_build_args
  @global_build_args = Indocker::ContextArgs.new(nil, @configuration.global_build_args, nil)
end
image_url(image_sym) click to toggle source
# File lib/indocker/build_context_helper.rb, line 10
def image_url(image_sym)
  path = Indocker.image_files.fetch(image_sym) do
    Indocker.logger.error("image :#{image_sym} was not found in configuration :#{@configuration.name}")
    exit 1
  end

  require path

  image = @configuration.images.detect do |i|
    i.name == image_sym
  end

  if image.nil?
    raise ArgumentError.new("image :#{image_sym} was not found in configuration")
  end

  image.registry_url
end
repository(name) click to toggle source
# File lib/indocker/build_context_helper.rb, line 34
def repository(name)
  @configuration.repositories.fetch(name) do
    raise ArgumentError.new("repository :#{name} is not defined in configuration")
  end
end
repository_path(name) click to toggle source
# File lib/indocker/build_context_helper.rb, line 29
def repository_path(name)
  repo = repository(name)
  repo.clone_path
end