class DockerizeRails::DRNameSpace

Attributes

namespace[R]

Public Class Methods

add_hash(hash) click to toggle source
# File lib/dockerize_rails/dr_name_space.rb, line 35
def self.add_hash(hash)
  hash.map do |key, value|
    @namespace.send("#{key}=", value)
  end
end
eval_i() click to toggle source
# File lib/dockerize_rails/dr_name_space.rb, line 41
def self.eval_i
  @namespace.instance_eval { binding }
end
load() click to toggle source
# File lib/dockerize_rails/dr_name_space.rb, line 7
def self.load
  DRConfig.load_dockerize_rails_config
  load_from_app_config
  load_from_dockerize_rails_config
end

Private Class Methods

load_from_app_config() click to toggle source
# File lib/dockerize_rails/dr_name_space.rb, line 13
def self.load_from_app_config
  app_c = ConfigLoader.app_config
  databases = {}
  app_c.keys.each do |env|
    adapter = app_c[env]['adapter']
    databases[env] =
      if adapter.start_with?('mysql')
        'mysql'
      elsif adapter.start_with?('postgresql')
        'postgresql'
      elsif adapter.start_with?('sqlite')
        'sqlite'
      end
  end
  @namespace.databases = databases
  DRConfig.databases = databases
end
load_from_dockerize_rails_config() click to toggle source
# File lib/dockerize_rails/dr_name_space.rb, line 31
def self.load_from_dockerize_rails_config
  add_hash DRConfig.to_hash
end