class Dockmeister::ServiceConfig

Constants

DOCKER_COMPOSE_FILENAME

Attributes

config[R]

Public Class Methods

new(base_path, service) click to toggle source
# File lib/dockmeister/service_config.rb, line 9
def initialize(base_path, service)
  @base_path  = base_path
  @service    = service
  @config     = convert(load_file)
end

Private Instance Methods

adjust_relative_path(service, path) click to toggle source
# File lib/dockmeister/service_config.rb, line 37
def adjust_relative_path(service, path)
  path.sub(/^\.\//, "./#{service}/")
end
convert(config) click to toggle source
# File lib/dockmeister/service_config.rb, line 21
def convert(config)
  config.values.each do |value|
    if value["build"]
      value["build"] = adjust_relative_path(@service, value["build"])
    end

    if value["volumes"]
      value["volumes"] = value["volumes"].map do |volume|
        adjust_relative_path(@service, volume)
      end
    end
  end

  config
end
load_file() click to toggle source
# File lib/dockmeister/service_config.rb, line 17
def load_file
  YAML.load_file(File.join(@base_path, @service, DOCKER_COMPOSE_FILENAME))
end