module Docker::Stack

Constants

VERSION

Public Class Methods

env() click to toggle source
# File lib/docker/stack.rb, line 23
def env
  @env ||= begin
    ((rails? && Rails.env))
  rescue NoMethodError
    ActiveSupport::StringInquirer.new(
      ENV['RAILS_ENV'].presence || ENV['RACK_ENV'].presence || 'development'
    )
  end
end
port_for(service, environment = env) click to toggle source
# File lib/docker/stack.rb, line 10
def port_for(service, environment = env)
  port_map[service.to_s][environment.to_s]
end
port_map() click to toggle source
# File lib/docker/stack.rb, line 14
def port_map
  return @port_map unless @port_map.nil?
  config_file = [
    root.join('config', 'stack.yml'),
    File.expand_path('../../config/stack.yml', __dir__)
  ].find { |f| File.exist?(f.to_s) }
  @port_map = YAML.safe_load(File.read(config_file))
end
root() click to toggle source
# File lib/docker/stack.rb, line 33
def root
  @root ||= begin
    ((rails? && Rails.root) || Pathname.pwd)
  rescue NoMethodError
    Pathname.pwd
  end
end

Private Class Methods

rails?() click to toggle source
# File lib/docker/stack.rb, line 43
def rails?
  defined?(Rails)
end