maglove 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/maglove/server.rb +16 -0
- data/lib/maglove/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff5d1ae99cc8d4b474c2ba740bf92e44fe3dec08
|
4
|
+
data.tar.gz: 4247ba7aa9b33c14e38dabef3bb2473cf72b3e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80c3a41b527d7e9c3ec05f7fdf7dc1ea8e1f84719a317dc073934591206ab9f29f0f3ed451e21357857ce4e83dcd691da90939ec75b2a4e42458d711254d6c77
|
7
|
+
data.tar.gz: 5d85bed1d547b9636a9e0a885e196ff055b48d9a46a32c5fbffe692c265878c3ca1fdbab3674d51f78efa62fcea6284d883a0df3e888287f8046787ce0ee4a9f
|
data/Gemfile.lock
CHANGED
data/lib/maglove/server.rb
CHANGED
@@ -7,6 +7,7 @@ module MagLove
|
|
7
7
|
self.theme = theme
|
8
8
|
self.port = port
|
9
9
|
self.root = "dist/"
|
10
|
+
@widget_stamps = {}
|
10
11
|
|
11
12
|
# create server
|
12
13
|
self.webrick = WEBrick::HTTPServer.new(
|
@@ -16,10 +17,25 @@ module MagLove
|
|
16
17
|
AccessLog: []
|
17
18
|
)
|
18
19
|
|
20
|
+
# create widget hash maps
|
21
|
+
Dir["widgets/*.rb"].each do |file|
|
22
|
+
@widget_stamps[file] = File.mtime(file).to_i
|
23
|
+
end
|
24
|
+
|
19
25
|
# template view actions
|
20
26
|
templates = theme_config(:templates, self.theme)
|
21
27
|
templates.each do |template|
|
22
28
|
mount("/#{template}") do |req, res|
|
29
|
+
|
30
|
+
Dir["widgets/*.rb"].each do |file|
|
31
|
+
stamp = File.mtime(file).to_i
|
32
|
+
if @widget_stamps[file] and @widget_stamps[file] < stamp
|
33
|
+
@widget_stamps[file] = stamp
|
34
|
+
debug("▸ reloading widget: #{file}")
|
35
|
+
load(file)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
23
39
|
debug("▸ rendering template: #{template}")
|
24
40
|
|
25
41
|
# Prepare variables
|
data/lib/maglove/version.rb
CHANGED