alula 0.4.0b → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/alula/cli.rb +5 -0
- data/lib/alula/compressors.rb +3 -1
- data/lib/alula/config.rb +4 -3
- data/lib/alula/content.rb +25 -36
- data/lib/alula/contents/item.rb +42 -22
- data/lib/alula/core_ext/tags/image.rb +3 -3
- data/lib/alula/core_ext/tags/video.rb +2 -2
- data/lib/alula/generators/feedbuilder.rb +17 -7
- data/lib/alula/generators/paginate.rb +4 -3
- data/lib/alula/generators/sitemap.rb +12 -6
- data/lib/alula/processor.rb +1 -0
- data/lib/alula/processors/video.rb +1 -1
- data/lib/alula/processors/zencoder.rb +8 -5
- data/lib/alula/site.rb +28 -10
- data/lib/alula/storages/filestorage.rb +1 -1
- data/lib/alula/support/commonlogger.rb +6 -2
- data/lib/alula/theme.rb +1 -1
- data/template/Gemfile.erb +1 -1
- data/vendor/static/favicon.ico +0 -0
- metadata +10 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.0
|
data/lib/alula/cli.rb
CHANGED
data/lib/alula/compressors.rb
CHANGED
@@ -36,7 +36,9 @@ module Alula
|
|
36
36
|
|
37
37
|
class HTMLCompressor
|
38
38
|
def initialize
|
39
|
-
@compressor = HtmlCompressor::Compressor.new
|
39
|
+
@compressor = HtmlCompressor::Compressor.new({
|
40
|
+
remove_surrounding_spaces: HtmlCompressor::Compressor::BLOCK_TAGS_MAX + ",source",
|
41
|
+
})
|
40
42
|
end
|
41
43
|
|
42
44
|
def compress(content)
|
data/lib/alula/config.rb
CHANGED
@@ -86,14 +86,15 @@ module Alula
|
|
86
86
|
},
|
87
87
|
feedbuilder: {
|
88
88
|
items: 10,
|
89
|
+
name: "feed.xml",
|
90
|
+
slug: "feed",
|
91
|
+
template: "/:locale/:name",
|
89
92
|
},
|
90
93
|
sitemap: {}
|
91
94
|
},
|
92
95
|
|
93
96
|
# Plugins
|
94
|
-
plugins: {
|
95
|
-
emphasis: {},
|
96
|
-
},
|
97
|
+
plugins: {},
|
97
98
|
|
98
99
|
# Blog Content options
|
99
100
|
content: {
|
data/lib/alula/content.rb
CHANGED
@@ -43,53 +43,21 @@ module Alula
|
|
43
43
|
|
44
44
|
private
|
45
45
|
def read_content(*types)
|
46
|
-
@@lock = Mutex.new
|
47
46
|
# Load all posts if requested
|
48
47
|
if (types.include?(:posts))
|
49
|
-
|
50
|
-
@site.progress.create :load_posts, title: "Loading posts", total: @site.storage.posts.count
|
51
|
-
@site.progress.display
|
52
|
-
@site.storage.posts.each do |item|
|
53
|
-
name, entry = item
|
54
|
-
post = Post.load(item: entry, site: @site)
|
55
|
-
@posts << post unless post.nil?
|
56
|
-
@@lock.synchronize { @site.progress.step :load_posts }
|
57
|
-
end
|
58
|
-
# Sort
|
48
|
+
@posts = _read_content_type(Post, @site.storage.posts, "Loading Posts")
|
59
49
|
@posts.sort!.reverse!
|
60
|
-
@site.progress.finish :load_posts
|
61
50
|
end
|
62
51
|
|
63
52
|
# Load all pages if requested
|
64
53
|
if (types.include?(:pages))
|
65
|
-
@
|
66
|
-
@site.progress.display
|
67
|
-
|
68
|
-
@site.storage.pages.each do |item|
|
69
|
-
name, entry = item
|
70
|
-
page = Page.load(item: entry, site: @site)
|
71
|
-
@pages << page unless page.nil?
|
72
|
-
|
73
|
-
@@lock.synchronize { @site.progress.step :load_pages }
|
74
|
-
end
|
54
|
+
@pages = _read_content_type(Page, @site.storage.pages, "Loading Pages")
|
75
55
|
@pages.sort!
|
76
|
-
@site.progress.finish :load_pages
|
77
56
|
end
|
78
57
|
|
79
|
-
# Load all
|
58
|
+
# Load all attachments if requested
|
80
59
|
if (types.include?(:attachments))
|
81
|
-
@
|
82
|
-
@site.progress.display
|
83
|
-
|
84
|
-
@site.storage.attachments.each do |item|
|
85
|
-
name, entry = item
|
86
|
-
attachment = Attachment.load(item: entry, site: @site)
|
87
|
-
@attachments << attachment unless attachment.nil?
|
88
|
-
|
89
|
-
@@lock.synchronize { @site.progress.step :load_attachments }
|
90
|
-
end
|
91
|
-
|
92
|
-
@site.progress.finish :load_attachments
|
60
|
+
@attachments = _read_content_type(Attachment, @site.storage.attachments, "Loading Attachments")
|
93
61
|
end
|
94
62
|
|
95
63
|
# Load all statics
|
@@ -109,5 +77,26 @@ module Alula
|
|
109
77
|
end
|
110
78
|
end
|
111
79
|
end
|
80
|
+
|
81
|
+
def _read_content_type(type, items, title)
|
82
|
+
@@lock ||= Mutex.new
|
83
|
+
|
84
|
+
@collection = []
|
85
|
+
|
86
|
+
@site.progress.create "load_#{type.to_s}", title: title, total: items.count
|
87
|
+
@site.progress.display
|
88
|
+
|
89
|
+
items.each do |item|
|
90
|
+
name, entry = item
|
91
|
+
itm = type.load(item: entry, site: @site)
|
92
|
+
@collection << itm unless itm.nil?
|
93
|
+
@@lock.synchronize { @site.progress.step "load_#{type.to_s}" }
|
94
|
+
end
|
95
|
+
|
96
|
+
# Sort
|
97
|
+
@site.progress.finish "load_#{type.to_s}"
|
98
|
+
|
99
|
+
@collection
|
100
|
+
end
|
112
101
|
end
|
113
102
|
end
|
data/lib/alula/contents/item.rb
CHANGED
@@ -55,7 +55,19 @@ module Alula
|
|
55
55
|
@name = opts.delete(:name) || @item.name
|
56
56
|
|
57
57
|
# Set up method overrides
|
58
|
-
@hooks =
|
58
|
+
@hooks = {}
|
59
|
+
# @hooks = hooks
|
60
|
+
hooks.each do |name, blk|
|
61
|
+
hook_id = blk.hash.to_s(36)
|
62
|
+
hook_name = "#{name}_#{hook_id}"
|
63
|
+
prev_hook_name = "#{name}_without_#{hook_id}"
|
64
|
+
(class << self; self; end).send(:define_method, hook_name) do |*args|
|
65
|
+
previous_hook = self.method(prev_hook_name)
|
66
|
+
instance_exec(previous_hook, args, &blk)
|
67
|
+
end
|
68
|
+
(class << self; self; end).send(:alias_method, prev_hook_name, name)
|
69
|
+
(class << self; self; end).send(:alias_method, name, hook_name)
|
70
|
+
end
|
59
71
|
# hooks.each do |name, impl|
|
60
72
|
# self.class.send(:define_method, name, &impl)
|
61
73
|
# end
|
@@ -74,7 +86,8 @@ module Alula
|
|
74
86
|
@metadata = Metadata.new({
|
75
87
|
# Defaults
|
76
88
|
date: Time.new(0),
|
77
|
-
pin: 500,
|
89
|
+
pin: 500, # Default sorting pin
|
90
|
+
sidebar: true, # Display item in sidebar (if page etc)
|
78
91
|
layout: 'default',
|
79
92
|
view: (self.class.to_s == "Alula::Content::Page" ? "page" : "post"),
|
80
93
|
|
@@ -131,9 +144,9 @@ module Alula
|
|
131
144
|
self.current_locale = locale
|
132
145
|
|
133
146
|
# Flush if we have generator
|
134
|
-
if @hooks[:render]
|
135
|
-
|
136
|
-
end
|
147
|
+
# if @hooks[:render]
|
148
|
+
# instance_exec(locale, &@hooks[:render])
|
149
|
+
# end
|
137
150
|
|
138
151
|
# Make sure our content is parsed
|
139
152
|
parse_liquid(locale)
|
@@ -218,13 +231,19 @@ module Alula
|
|
218
231
|
items = self.site.config.content.sidebar.collect do |item|
|
219
232
|
case item
|
220
233
|
when :pages
|
221
|
-
self.site.content.pages
|
234
|
+
self.site.content.pages
|
235
|
+
.select{|p| p.languages.include?(locale) }
|
236
|
+
.reject{|p| p.metadata.sidebar == false}
|
222
237
|
when :languages
|
223
|
-
|
238
|
+
# Get index page titles
|
239
|
+
index_page = site.content.by_slug("index")
|
240
|
+
index_page.languages
|
224
241
|
.reject{|lang| lang == locale}
|
225
|
-
.collect{|lang| Hashie::Mash.new({url: url(lang), title: I18n.t('language_name', locale: lang)}) }
|
242
|
+
.collect{|lang| Hashie::Mash.new({url: index_page.url(lang), title: I18n.t('language_name', locale: lang)}) }
|
243
|
+
when Hash
|
244
|
+
item
|
226
245
|
else
|
227
|
-
|
246
|
+
self.site.content.by_slug(item)
|
228
247
|
end
|
229
248
|
end
|
230
249
|
items.flatten.select {|i| !i.nil?}
|
@@ -267,21 +286,22 @@ module Alula
|
|
267
286
|
end
|
268
287
|
|
269
288
|
def previous(locale = nil)
|
270
|
-
if @hooks[:previous]
|
271
|
-
|
272
|
-
end
|
289
|
+
# if @hooks[:previous]
|
290
|
+
# instance_exec(locale, &@hooks[:previous])
|
291
|
+
# end
|
273
292
|
end
|
274
293
|
|
275
294
|
def next(locale = nil)
|
276
|
-
if @hooks[:next]
|
277
|
-
|
278
|
-
|
295
|
+
# if @hooks[:next]
|
296
|
+
# binding.pry
|
297
|
+
# instance_exec(locale, &@hooks[:next])
|
298
|
+
# end
|
279
299
|
end
|
280
300
|
|
281
301
|
def navigation(locale = nil)
|
282
|
-
if @hooks[:navigation]
|
283
|
-
|
284
|
-
end
|
302
|
+
# if @hooks[:navigation]
|
303
|
+
# instance_exec(locale, &@hooks[:navigation])
|
304
|
+
# end
|
285
305
|
end
|
286
306
|
|
287
307
|
#
|
@@ -337,10 +357,10 @@ module Alula
|
|
337
357
|
|
338
358
|
private
|
339
359
|
def _last_modified
|
340
|
-
if @hooks[:last_modified]
|
341
|
-
|
342
|
-
end
|
343
|
-
|
360
|
+
# if @hooks[:last_modified]
|
361
|
+
# return instance_exec(locale, &@hooks[:next])
|
362
|
+
# end
|
363
|
+
#
|
344
364
|
return unless self.class.to_s[/Page|Post/]
|
345
365
|
mtime = nil
|
346
366
|
unless @item.nil?
|
@@ -16,7 +16,7 @@ module Alula
|
|
16
16
|
def content
|
17
17
|
hires = hires_url(@source, :image)
|
18
18
|
tag = "<a href=\"#{attachment_url(@source, :image)}\""
|
19
|
-
tag += " data-hires=\"#{hires}\"" if context.site.config.attachments["image"]["hires"] and hires
|
19
|
+
tag += " data-hires=\"#{hires}\"" if context.site.config.attachments["image"]["hires"] and hires and self.context.item.metadata.renderer.class.to_s != "Alula::Generator::FeedBuilder"
|
20
20
|
tag += ">"
|
21
21
|
tag += imagetag(@source, :thumbnail)
|
22
22
|
tag += "</a>"
|
@@ -32,13 +32,13 @@ module Alula
|
|
32
32
|
tag += " alt=\"#{@options["alternative"]}\"" if @options["alternative"]
|
33
33
|
tag += " title=\"#{@options["title"]}\"" if @options["title"]
|
34
34
|
tag += " class=\"#{classes.join(" ")}\""
|
35
|
-
if context.site.config.attachments.image.lazyload
|
35
|
+
if context.site.config.attachments.image.lazyload and self.context.item.metadata.renderer.class.to_s != "Alula::Generator::FeedBuilder"
|
36
36
|
tag += " src=\"#{asset_url("grey.gif")}\""
|
37
37
|
tag += " data-original=\"#{src}\""
|
38
38
|
else
|
39
39
|
tag += " src=\"#{src}\""
|
40
40
|
end
|
41
|
-
tag += " data-hires=\"#{hires}\"" if context.site.config.attachments.image.hires and hires
|
41
|
+
tag += " data-hires=\"#{hires}\"" if context.site.config.attachments.image.hires and hires and self.context.item.metadata.renderer.class.to_s != "Alula::Generator::FeedBuilder"
|
42
42
|
tag += " width=\"#{info(source, type).width}\" height=\"#{info(source, type).height}\""
|
43
43
|
tag += " />"
|
44
44
|
end
|
@@ -37,7 +37,7 @@ module Alula
|
|
37
37
|
|
38
38
|
def sources
|
39
39
|
@sources ||= begin
|
40
|
-
variants.collect {|variant|
|
40
|
+
sources = variants.collect {|variant|
|
41
41
|
name = @source.gsub(/#{File.extname(@source)}$/, variant[:ext])
|
42
42
|
{
|
43
43
|
name: name,
|
@@ -46,7 +46,7 @@ module Alula
|
|
46
46
|
hires: variant[:hires],
|
47
47
|
mobile: variant[:mobile]
|
48
48
|
}
|
49
|
-
}
|
49
|
+
}.reject{|source| source[:url].nil? }
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -5,7 +5,7 @@ module Alula
|
|
5
5
|
def generate
|
6
6
|
# Loop all languages and count posts per language
|
7
7
|
@languages = {}
|
8
|
-
self.site.content.posts.each do |post|
|
8
|
+
(self.site.content.posts + self.site.content.pages).each do |post|
|
9
9
|
post.languages.each do |lang|
|
10
10
|
@languages[lang] ||= []
|
11
11
|
@languages[lang] << post
|
@@ -22,15 +22,25 @@ module Alula
|
|
22
22
|
generator: self,
|
23
23
|
posts: posts,
|
24
24
|
title: titles,
|
25
|
-
name:
|
26
|
-
slug:
|
27
|
-
|
25
|
+
name: self.options.name,
|
26
|
+
slug: self.options.slug,
|
27
|
+
sidebar: false,
|
28
|
+
template: self.options.template,
|
28
29
|
site: self.site,
|
29
30
|
layout: "feed",
|
30
31
|
},
|
31
|
-
:previous => ->(locale) { nil },
|
32
|
-
:next => ->(locale) { nil },
|
33
|
-
:navigation => ->(locale) { nil },
|
32
|
+
:previous => ->(hook, locale) { nil },
|
33
|
+
:next => ->(hook, locale) { nil },
|
34
|
+
:navigation => ->(hook, locale) { nil },
|
35
|
+
:write => ->(hook, locale) {
|
36
|
+
begin
|
37
|
+
_old_renderer = self.posts.collect{|p| p.metadata.renderer}
|
38
|
+
self.posts.cycle(1) { |p| p.flush; p.metadata.renderer = self.generator;}
|
39
|
+
hook.call
|
40
|
+
ensure
|
41
|
+
self.posts.cycle(1) {|p| p.metadata.renderer = _old_renderer.shift }
|
42
|
+
end
|
43
|
+
},
|
34
44
|
)
|
35
45
|
self.site.content.pages << @feed_page
|
36
46
|
|
@@ -34,11 +34,12 @@ module Alula
|
|
34
34
|
title: titles,
|
35
35
|
name: "page-#{(page + 1)}",
|
36
36
|
slug: "page-#{(page + 1)}",
|
37
|
+
sidebar: false,
|
37
38
|
template: self.options.template,
|
38
39
|
site: self.site,
|
39
40
|
view: self.options.view || "paginate",
|
40
41
|
},
|
41
|
-
:previous => ->(locale) {
|
42
|
+
:previous => ->(hook, locale) {
|
42
43
|
pos = self.navigation(locale).index(self)
|
43
44
|
if pos and pos < (self.navigation(locale).count - 1)
|
44
45
|
self.navigation(locale)[pos + 1]
|
@@ -46,7 +47,7 @@ module Alula
|
|
46
47
|
nil
|
47
48
|
end
|
48
49
|
},
|
49
|
-
:next => ->(locale) {
|
50
|
+
:next => ->(hook, locale) {
|
50
51
|
pos = self.navigation(locale).index(self)
|
51
52
|
if pos and pos > 0
|
52
53
|
self.navigation(locale)[pos - 1]
|
@@ -54,7 +55,7 @@ module Alula
|
|
54
55
|
nil
|
55
56
|
end
|
56
57
|
},
|
57
|
-
:navigation => ->(locale) {
|
58
|
+
:navigation => ->(hook, locale) {
|
58
59
|
locale ||= self.current_locale || self.site.config.locale
|
59
60
|
@navigation[locale] ||= self.site.content.pages.select { |item| item.metadata.generator == self.generator and item.languages.include?(locale) }
|
60
61
|
}
|
@@ -3,20 +3,26 @@ require 'builder' # For Tilt
|
|
3
3
|
module Alula
|
4
4
|
class Generator::Sitemap < Generator
|
5
5
|
def generate
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
urls_callback = ->(context) {
|
7
|
+
(context.site.content.posts + context.site.content.pages)
|
8
|
+
.reject {|content| content.generator == self }
|
9
|
+
.collect { |content|
|
10
10
|
content.languages.collect{|lang| {
|
11
11
|
url: content.url(lang),
|
12
12
|
lastmod: content.last_modified,
|
13
13
|
priority: content.generator.nil? ? 0.5 : 0.3,
|
14
14
|
}
|
15
|
-
}
|
16
|
-
|
15
|
+
}
|
16
|
+
}.flatten
|
17
|
+
}
|
18
|
+
|
19
|
+
self.site.content.pages << Alula::Content::Page.new({
|
20
|
+
generator: self,
|
21
|
+
urls: urls_callback,
|
17
22
|
title: "Sitemap",
|
18
23
|
name: "sitemap.xml",
|
19
24
|
slug: "sitemap",
|
25
|
+
sidebar: false,
|
20
26
|
template: self.options.template || "/:locale/:name",
|
21
27
|
site: self.site,
|
22
28
|
layout: "sitemap",
|
data/lib/alula/processor.rb
CHANGED
@@ -39,7 +39,7 @@ module Alula
|
|
39
39
|
.select {|tn| !tn[:hires] or (tn[:hires] and self.site.config.attachments.image.hires)}
|
40
40
|
.select{|tn|
|
41
41
|
width, height = tn[:size].split("x").collect{|i| i.to_i};
|
42
|
-
!File.exists?(tn[:output]) and !((width > self.info.width and height > self.info.height) and
|
42
|
+
!File.exists?(tn[:output]) and !((width > self.info.width and height > self.info.height) and tn[:hires])
|
43
43
|
}
|
44
44
|
|
45
45
|
thumbnails = Hash[thumbnails.collect{|tn| [tn[:label], tn]}]
|
@@ -14,11 +14,13 @@ module Alula
|
|
14
14
|
def initialize(item, opts)
|
15
15
|
super
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
@@lock.synchronize do
|
18
|
+
::Zencoder.api_key = options.token
|
19
|
+
@s3 = ::AWS::S3.new({
|
20
|
+
:access_key_id => options.key_id,
|
21
|
+
:secret_access_key => options.access_key,
|
22
|
+
})
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
26
|
def cleanup
|
@@ -102,6 +104,7 @@ module Alula
|
|
102
104
|
end
|
103
105
|
|
104
106
|
def zencoder_encode(job)
|
107
|
+
File.open('cache/job.yml', 'w') {|io| io.write job.to_yaml}
|
105
108
|
response = ::Zencoder::Job.create(job)
|
106
109
|
return false if response.code != "201"
|
107
110
|
|
data/lib/alula/site.rb
CHANGED
@@ -17,6 +17,7 @@ require 'sprockets'
|
|
17
17
|
require 'i18n'
|
18
18
|
require 'parallel'
|
19
19
|
require 'hashie/mash'
|
20
|
+
require 'json'
|
20
21
|
|
21
22
|
# Silence Tilt
|
22
23
|
require 'sass'
|
@@ -221,7 +222,7 @@ module Alula
|
|
221
222
|
# Theme, plugins, vendor and customisation
|
222
223
|
[
|
223
224
|
self.theme.path,
|
224
|
-
*plugins.collect{|name, plugin| plugin.
|
225
|
+
*plugins.collect{|name, plugin| plugin.path},
|
225
226
|
::File.join(File.dirname(__FILE__), "..", "..", "vendor"),
|
226
227
|
].each do |path|
|
227
228
|
%w{javascripts stylesheets images}.each {|p|
|
@@ -273,9 +274,8 @@ module Alula
|
|
273
274
|
progress.finish(:attachments)
|
274
275
|
progress.hide
|
275
276
|
|
276
|
-
#
|
277
|
-
|
278
|
-
File.open(self.storage.path(:cache) + "/mapping.json", 'w') {|io| io.puts self.attachments.mapping.to_json}
|
277
|
+
# Output mapping information
|
278
|
+
File.open(self.storage.path(:cache) + "/mapping.yml", 'w') {|io| io.puts JSON(self.attachments.mapping.to_json).to_yaml}
|
279
279
|
end
|
280
280
|
|
281
281
|
def compile_assets
|
@@ -337,7 +337,7 @@ module Alula
|
|
337
337
|
|
338
338
|
@manifest = Manifest.new(@environment, @storage.path(:assets))
|
339
339
|
@manifest.progress = -> { progress.step(:assets) }
|
340
|
-
|
340
|
+
|
341
341
|
@manifest.compile
|
342
342
|
|
343
343
|
progress.finish(:assets)
|
@@ -362,9 +362,26 @@ module Alula
|
|
362
362
|
progress.finish(:render)
|
363
363
|
|
364
364
|
# Copy static content
|
365
|
-
|
366
|
-
|
367
|
-
|
365
|
+
# Create directory path
|
366
|
+
static_dirs = [
|
367
|
+
::File.join(File.dirname(__FILE__), "..", "..", "vendor"),
|
368
|
+
*plugins.collect{|name, plugin| plugin.path},
|
369
|
+
self.theme.path,
|
370
|
+
]
|
371
|
+
statics = static_dirs.collect{|path|
|
372
|
+
Dir[File.join(path, "static", "**", "*")].collect{|p|
|
373
|
+
{path: File.join(path, "static"), item: p}
|
374
|
+
}
|
375
|
+
}.flatten
|
376
|
+
|
377
|
+
progress.create :static, title: "Copy statics", total: self.content.statics.count + statics.count
|
378
|
+
(statics + self.content.statics).each do |static|
|
379
|
+
if static.kind_of?(Hash)
|
380
|
+
name = static[:item].gsub(/^#{static[:path]}\//, '')
|
381
|
+
@storage.output_public(name) {|io| File.read(static[:item]) }
|
382
|
+
else
|
383
|
+
@storage.output_public(static.name) { |io| static.read }
|
384
|
+
end
|
368
385
|
|
369
386
|
progress.step :static
|
370
387
|
end
|
@@ -383,10 +400,11 @@ module Alula
|
|
383
400
|
.collect{|u| File.join(asset_path, u.digest_path)}
|
384
401
|
outputted = @storage.outputted.reject{|o|o[/^#{asset_path}/]}
|
385
402
|
|
386
|
-
keep = assets + outputted
|
403
|
+
keep = (assets + outputted).collect{|p| File.expand_path(p)}
|
404
|
+
|
387
405
|
Dir[File.join(@storage.path(:public), "**", "*")].each do |entry|
|
388
406
|
next unless File.file?(entry)
|
389
|
-
FileUtils.rm entry if File.file?(entry) and !keep.include?(entry)
|
407
|
+
FileUtils.rm entry if File.file?(entry) and !keep.include?(File.expand_path(entry))
|
390
408
|
end
|
391
409
|
|
392
410
|
# Clean up empty directories
|
@@ -3,7 +3,7 @@ module Alula
|
|
3
3
|
# Common Log Format: http://httpd.apache.org/docs/1.3/logs.html#common
|
4
4
|
# lilith.local - - [07/Aug/2006 23:58:02] "GET / HTTP/1.1" 500 -
|
5
5
|
# %{%s - %s [%s] "%s %s%s %s" %d %s\n} %
|
6
|
-
FORMAT = %{[%s] %s %s\n}
|
6
|
+
# FORMAT = %{[%s] %s %s\n}
|
7
7
|
|
8
8
|
def initialize(app, logger=nil)
|
9
9
|
@app = app
|
@@ -11,8 +11,10 @@ module Alula
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(env)
|
14
|
+
request_start = Time.now
|
14
15
|
status, header, body = @app.call(env)
|
15
16
|
header = Rack::Utils::HeaderHash.new(header)
|
17
|
+
env["REQUEST_TIME"] = (Time.now - request_start) * 1000.0
|
16
18
|
body = Rack::BodyProxy.new(body) { log(env, status, header) }
|
17
19
|
[status, header, body]
|
18
20
|
end
|
@@ -21,9 +23,11 @@ module Alula
|
|
21
23
|
|
22
24
|
def log(env, status, header)
|
23
25
|
logger = @logger || env['rack.errors']
|
24
|
-
logger.write
|
26
|
+
logger.write %{[%s] %s %d %.3fms %s\n} % [
|
25
27
|
env["REMOTE_ADDR"],
|
26
28
|
env["REQUEST_METHOD"],
|
29
|
+
status,
|
30
|
+
env["REQUEST_TIME"],
|
27
31
|
Rack::Utils.unescape(env["PATH_INFO"])]
|
28
32
|
end
|
29
33
|
end
|
data/lib/alula/theme.rb
CHANGED
data/template/Gemfile.erb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mikko Kokkonen
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parallel
|
@@ -627,6 +627,7 @@ files:
|
|
627
627
|
- vendor/assets/javascripts/lazyload.js.coffee
|
628
628
|
- vendor/layouts/feed.xml.builder
|
629
629
|
- vendor/layouts/sitemap.xml.builder
|
630
|
+
- vendor/static/favicon.ico
|
630
631
|
- vendor/views/feed_post.html.haml
|
631
632
|
homepage: http://owlforestry.github.com/alula
|
632
633
|
licenses: []
|
@@ -642,13 +643,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
642
643
|
version: '0'
|
643
644
|
segments:
|
644
645
|
- 0
|
645
|
-
hash:
|
646
|
+
hash: 935586330715583609
|
646
647
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
647
648
|
none: false
|
648
649
|
requirements:
|
649
|
-
- - ! '
|
650
|
+
- - ! '>='
|
650
651
|
- !ruby/object:Gem::Version
|
651
|
-
version:
|
652
|
+
version: '0'
|
653
|
+
segments:
|
654
|
+
- 0
|
655
|
+
hash: 935586330715583609
|
652
656
|
requirements: []
|
653
657
|
rubyforge_project:
|
654
658
|
rubygems_version: 1.8.23
|