Module: Ohajiki::Config

Defined in:
lib/ohajiki/config.rb

Class Method Summary collapse

Class Method Details

.const_missing(id) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ohajiki/config.rb', line 13

def self.const_missing(id)
  # Default settings
  case id
  when :LOG_PATH 
    '/tmp/ohajiki.log'
  when :REMOTE_REPO_URL 
    raise ConfigNotFound, "require REMOTE_REPO_URL in config file"  
  when :SYNC_DIR_PATH 
    raise ConfigNotFound, "require SYNC_DIR_PATH in config file"  
  when :SYNC_INTERVAL_SEC
    10 
  else
    super
  end
end

.load(path) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/ohajiki/config.rb', line 5

def self.load(path)
  conf = File.read(path)
  proc { 
    conf = "$SAFE = 2;"+conf
    self.module_eval conf 
  }.call
end