alula 0.4.8 → 0.4.9
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/attachment_processor.rb +5 -3
- data/lib/alula/config.rb +7 -6
- data/lib/alula/contents/item.rb +5 -5
- data/lib/alula/core_ext/tag.rb +2 -2
- data/lib/alula/processors/magick.rb +8 -3
- data/lib/alula/site.rb +10 -6
- data/lib/alula/theme.rb +39 -22
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.9
|
@@ -22,11 +22,13 @@ module Alula
|
|
22
22
|
@@lock.synchronize do
|
23
23
|
md5 = Digest::MD5.hexdigest(name)
|
24
24
|
asset_hash = md5[0..3]
|
25
|
-
|
26
|
-
|
25
|
+
asset_name = File.join(path + [asset_hash]) + File.extname(name)
|
26
|
+
until !mapping.key(asset_name) or mapping.key(asset_name) == name
|
27
|
+
asset_hash = md5[0..(asset_hash.length)]
|
28
|
+
asset_name = File.join(path + [asset_hash]) + File.extname(name)
|
27
29
|
end
|
28
30
|
|
29
|
-
mapping[name] =
|
31
|
+
mapping[name] = asset_name
|
30
32
|
end
|
31
33
|
|
32
34
|
mapping[name]
|
data/lib/alula/config.rb
CHANGED
@@ -53,7 +53,7 @@ module Alula
|
|
53
53
|
hides_base_locale: true, # Hide default locale
|
54
54
|
|
55
55
|
# Default theme
|
56
|
-
theme: 'minimal',
|
56
|
+
theme: {'minimal' => {}},
|
57
57
|
|
58
58
|
# Template for generating post permalinks
|
59
59
|
permalinks: '/:locale/:year/:month/:title/',
|
@@ -122,11 +122,12 @@ module Alula
|
|
122
122
|
# Attachement Processors
|
123
123
|
attachments: {
|
124
124
|
"image" => {
|
125
|
-
"size"
|
126
|
-
"thumbnail"
|
127
|
-
"
|
128
|
-
"
|
129
|
-
"
|
125
|
+
"size" => "800x600",
|
126
|
+
"thumbnail" => "300x300",
|
127
|
+
"thumbnail_mode" => :square,
|
128
|
+
"keep_tags" => ["CopyrightNotice", "Title", "DateTimeOriginal"],
|
129
|
+
"hires" => true,
|
130
|
+
"lazyload" => true,
|
130
131
|
},
|
131
132
|
"video" => {
|
132
133
|
"size-hd" => "1280x720",
|
data/lib/alula/contents/item.rb
CHANGED
@@ -371,11 +371,11 @@ module Alula
|
|
371
371
|
mtime = nil
|
372
372
|
unless @item.nil?
|
373
373
|
mtime = @item.mtime
|
374
|
-
if self.site.git
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
end
|
374
|
+
# if self.site.git
|
375
|
+
# rev = %x{git rev-list -n 1 HEAD #{Shellwords.escape(@item.filepath)}}.strip
|
376
|
+
# time = %x{git show --pretty=format:%ai --abbrev-commit #{rev}|head -1}.strip
|
377
|
+
# mtime = Time.parse(time) rescue nil
|
378
|
+
# end
|
379
379
|
end
|
380
380
|
mtime
|
381
381
|
end
|
data/lib/alula/core_ext/tag.rb
CHANGED
@@ -26,8 +26,8 @@ module Alula
|
|
26
26
|
@options = {}
|
27
27
|
|
28
28
|
# Parse tag options
|
29
|
-
if m = /^([\"
|
30
|
-
@source = m[1].gsub(/^[
|
29
|
+
if m = /^([\"][\S\. ]+[\"]|[\S\.]+)(.*)$/.match(@markup)
|
30
|
+
@source = m[1].gsub(/^["]?([^"]+)["]?$/, '\1')
|
31
31
|
@source = "" if @source == '""'
|
32
32
|
@options["source"] = @source unless @source.empty?
|
33
33
|
|
@@ -9,11 +9,16 @@ module Alula
|
|
9
9
|
mimetype "image/jpeg", "image/png", "image/gif"
|
10
10
|
|
11
11
|
def resize_image(opts)
|
12
|
-
output = opts
|
13
|
-
width, height = opts
|
12
|
+
output = opts[:output]
|
13
|
+
width, height = opts[:size]
|
14
14
|
|
15
15
|
# Generate resized image
|
16
|
-
resized = self.image.
|
16
|
+
resized = case self.site.config.attachments.image.thumbnail_mode
|
17
|
+
when :square
|
18
|
+
self.image.resize_to_fill(width, height)
|
19
|
+
else
|
20
|
+
self.image.resize_to_fit(width, height)
|
21
|
+
end
|
17
22
|
# Make it progressive
|
18
23
|
resized.interlace = ::Magick::PlaneInterlace
|
19
24
|
|
data/lib/alula/site.rb
CHANGED
@@ -176,6 +176,7 @@ module Alula
|
|
176
176
|
def banner
|
177
177
|
puts ""
|
178
178
|
puts "Alula #{Alula::VERSION}"
|
179
|
+
puts ""
|
179
180
|
end
|
180
181
|
|
181
182
|
def load_plugins
|
@@ -188,7 +189,6 @@ module Alula
|
|
188
189
|
if @plugins
|
189
190
|
puts "Plugins: " + @plugins.collect {|name, plugin| "#{name} #{plugin.version}"}.join(" ")
|
190
191
|
end
|
191
|
-
puts ""
|
192
192
|
end
|
193
193
|
|
194
194
|
def load_filters
|
@@ -209,8 +209,11 @@ module Alula
|
|
209
209
|
@context = Alula::Context.new(site: self, storage: self.storage)
|
210
210
|
@context.send(:extend, Helpers)
|
211
211
|
|
212
|
-
@theme = Alula::Theme.load(site: self)
|
213
|
-
|
212
|
+
# @theme = Alula::Theme.load(config.theme, site: self)
|
213
|
+
@theme = Alula::Theme.load(config.theme.to_a.last[0], config.theme.to_a.last[1])
|
214
|
+
|
215
|
+
puts " Theme: #{@theme.name} #{@theme.version}"
|
216
|
+
puts ""
|
214
217
|
|
215
218
|
# Create our asset environment
|
216
219
|
@environment = Environment.new
|
@@ -279,7 +282,8 @@ module Alula
|
|
279
282
|
|
280
283
|
@@lock = Mutex.new
|
281
284
|
|
282
|
-
Parallel.map(self.content.attachments, :in_threads => Parallel.processor_count) do |attachment|
|
285
|
+
# Parallel.map(self.content.attachments, :in_threads => Parallel.processor_count) do |attachment|
|
286
|
+
self.content.attachments.each do |attachment|
|
283
287
|
if processor = attachments.get(attachment)
|
284
288
|
processor.process
|
285
289
|
end
|
@@ -303,7 +307,7 @@ module Alula
|
|
303
307
|
io.puts "/*"
|
304
308
|
|
305
309
|
# Theme style
|
306
|
-
io.puts " *= require #{
|
310
|
+
io.puts " *= require #{@theme.name}"
|
307
311
|
|
308
312
|
# Plugins
|
309
313
|
@plugins.each do |name, plugin|
|
@@ -328,7 +332,7 @@ module Alula
|
|
328
332
|
io.puts "/*"
|
329
333
|
|
330
334
|
# Theme scripts
|
331
|
-
io.puts " *= require #{
|
335
|
+
io.puts " *= require #{@theme.name}"
|
332
336
|
|
333
337
|
# Plugins
|
334
338
|
@plugins.each do |name, plugin|
|
data/lib/alula/theme.rb
CHANGED
@@ -2,6 +2,19 @@ require 'alula/theme/layout'
|
|
2
2
|
|
3
3
|
module Alula
|
4
4
|
class Theme
|
5
|
+
def self.register(name, klass); themes[name.to_s] = klass; end
|
6
|
+
def self.themes; @@themes ||= {}; end
|
7
|
+
def themes; self.class.themes; end
|
8
|
+
|
9
|
+
def self.load(name, options)
|
10
|
+
if themes[name] and !(!!options == options and !options)
|
11
|
+
theme = themes[name]
|
12
|
+
return theme.new(options) if theme.install(options)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.install(options); true; end
|
17
|
+
|
5
18
|
attr_reader :version
|
6
19
|
attr_reader :site
|
7
20
|
attr_reader :theme
|
@@ -9,35 +22,39 @@ module Alula
|
|
9
22
|
attr_reader :layouts
|
10
23
|
attr_reader :context
|
11
24
|
|
12
|
-
def self.register(theme, path, version)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
25
|
+
# def self.register(theme, path, version)
|
26
|
+
# @@themes ||= {}
|
27
|
+
# @@themes[theme.to_s] = ::File.join(path, theme.to_s)
|
28
|
+
#
|
29
|
+
# @@theme_versions ||= {}
|
30
|
+
# @@theme_versions[theme.to_s] = version
|
31
|
+
# end
|
19
32
|
|
20
|
-
def self.load(opts)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def initialize(
|
31
|
-
@site =
|
32
|
-
@theme = theme
|
33
|
-
@path = @@themes[theme]
|
33
|
+
# def self.load(opts)
|
34
|
+
# return nil unless self.class_variable_defined?(:@@themes)
|
35
|
+
# site = opts[:site]
|
36
|
+
#
|
37
|
+
# theme_name = site.config.theme
|
38
|
+
# return self.new(theme_name, opts) if @@themes.has_key?(theme_name)
|
39
|
+
#
|
40
|
+
# return nil
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
def initialize(opts)
|
44
|
+
@site = Site.instance
|
45
|
+
# @theme = theme
|
46
|
+
# @path = @@themes[theme]
|
34
47
|
|
35
48
|
@context = @site.context
|
36
49
|
|
37
50
|
@layouts = {}
|
38
51
|
@views = {}
|
39
52
|
|
40
|
-
@version = @@theme_versions[theme]
|
53
|
+
# @version = @@theme_versions[theme]
|
54
|
+
end
|
55
|
+
|
56
|
+
def name
|
57
|
+
themes.key(self.class)
|
41
58
|
end
|
42
59
|
|
43
60
|
def searchpath(type, name)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parallel
|
@@ -644,7 +644,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
644
644
|
version: '0'
|
645
645
|
segments:
|
646
646
|
- 0
|
647
|
-
hash:
|
647
|
+
hash: 2079066484659239768
|
648
648
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
649
649
|
none: false
|
650
650
|
requirements:
|
@@ -653,7 +653,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
653
653
|
version: '0'
|
654
654
|
segments:
|
655
655
|
- 0
|
656
|
-
hash:
|
656
|
+
hash: 2079066484659239768
|
657
657
|
requirements: []
|
658
658
|
rubyforge_project:
|
659
659
|
rubygems_version: 1.8.23
|