Class: Rubius::Rails

Inherits:
Object
  • Object
show all
Defined in:
lib/rubius/rails.rb

Class Method Summary collapse

Class Method Details

.init(root = nil, env = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rubius/rails.rb', line 3

def self.init(root = nil, env = nil)
  base_dir = root
  if root.nil?
    root = defined?(::Rails) ?  ::Rails.root : FileUtils.pwd
    base_dir = File.expand_path(File.join(root, 'config'))
  end
  
  if env.nil?
    env = defined?(::Rails) ? ::Rails.env : 'development'
  end
  
  config_file = File.join(base_dir, 'rubius.yml')
  Rubius::Authenticator.instance.init_from_config(config_file, env)
end