-
Notifications
You must be signed in to change notification settings - Fork 1
/
aineko.rb
44 lines (36 loc) · 928 Bytes
/
aineko.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
44
module Aineko
class << self
attr_accessor :_pap_loading
def papconfig(ctx)
@papconfcont ||= { }
@papconfcont[_pap_loading] = ctx
end
def papconfigcontext
@papconfcont[_pap_loading]
end
end
def papdir(name)
File.expand_path(name, pubdir)
end
def papent(name)
File.expand_path(name+'.rb', papdir(name))
end
def papconf(name)
File.expand_path('config.rb', papdir(name))
end
def boot
# TODO Fix paps order + dots and stuff
Dir.foreach(pubdir) { |pap|
papstart(pap) if File.readable?(papent(pap)) and File.file?(papent(pap))
}
end
def papstart(name)
Aineko._pap_loading = name
load papent(name)
papconfrb = papconf(name)
papconfctx = Aineko.papconfigcontext
eval(File.read(papconfrb), papconfctx) if papconfctx and
File.readable?(papconfrb) and File.file?(papconfrb)
Aineko._pap_loading = nil
end
end