class Superhosting::Base

Attributes

config[R]
lib[R]

Public Class Methods

new(config_path: '/etc/sx', lib_path: '/var/sx', logger: nil, docker_api: nil, dry_run: nil, debug: nil, **kwargs) click to toggle source
# File lib/superhosting/base.rb, line 7
def initialize(config_path: '/etc/sx', lib_path: '/var/sx', logger: nil, docker_api: nil, dry_run: nil, debug: nil, **kwargs)
  @config_path = Pathname.new(config_path)
  @lib_path = Pathname.new(lib_path)
  @config = PathMapper.new(config_path)
  @lib = PathMapper.new(lib_path)
  Thread.current[:logger] ||= logger
  Thread.current[:debug] ||= debug
  Thread.current[:dry_run] ||= dry_run

  @docker_api = docker_api || DockerApi.new(socket: @config.f('docker_socket', default: nil))
end

Public Instance Methods

get_base_controller_options() click to toggle source
# File lib/superhosting/base.rb, line 19
def get_base_controller_options
  {
      config_path: @config_path.to_s,
      lib_path: @lib_path.to_s,
      docker_api: @docker_api,
  }
end
get_controller(controller, **kwargs) click to toggle source
# File lib/superhosting/base.rb, line 27
def get_controller(controller, **kwargs)
  controller.new(**self.get_base_controller_options.merge!(kwargs))
end