-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.rb
43 lines (36 loc) · 800 Bytes
/
env.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$: << File.expand_path("..", __FILE__)
module Env
class << self
def load_all
Dir[File.expand_path("../lib/**/*", __FILE__)].each do |f|
require f
end
load_once_env
load_each_env
:ok
end
def reload_all
Dir[File.expand_path("../lib/**/*", __FILE__)].each do |f|
load f
end
load_each_env
:ok
end
def reauth
if File.exist?('.geekauth')
BggTools::GeekAuth.set(File.read('.geekauth').rstrip)
end
end
private
def load_once_env
@cache = BggTools::FSCache.new
BggTools::Cache.set_cache(@cache)
end
def load_each_env
reauth
if File.exist?('.collid')
BggTools::Collection.set_collid(File.read('.collid').rstrip)
end
end
end
end