dimples 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dimples +5 -6
- data/lib/dimples/site.rb +14 -12
- data/lib/dimples/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: 01da1633d41b4a6bd472c904222ece07329a3fc0
|
4
|
+
data.tar.gz: eceed845d1ebedbfbe74505d7c4d5726baa9bd50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be020d727fe23d9ceafbc4a0e4605e4e3a3c80d5def9824f0ed08d54cc759e32b1363d96ff2dfa45839632690924af3e7787488996a7ebb61f80aa231036359b
|
7
|
+
data.tar.gz: de19eae31e9bf2d79b521d0397d8d191252053a51b2e686b7bc6d5737fd2dbb8918babdcd48ea1dc3bd6547688195f264e37f2656a8b9e844a3f3225d5b3df77
|
data/bin/dimples
CHANGED
@@ -43,8 +43,7 @@ config_path = options[:config] || File.join(Dir.pwd, 'config.json')
|
|
43
43
|
if File.exist?(config_path)
|
44
44
|
begin
|
45
45
|
config = JSON.parse(File.read(config_path), symbolize_names: true)
|
46
|
-
rescue
|
47
|
-
puts e.inspect
|
46
|
+
rescue
|
48
47
|
Trollop.die "Invalid or malformed config file (#{config_path})"
|
49
48
|
end
|
50
49
|
else
|
@@ -60,10 +59,10 @@ if Dir.exist?(lib_path)
|
|
60
59
|
end
|
61
60
|
|
62
61
|
site_klass = if config[:class_overrides][:site]
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
Object.const_get(config[:class_overrides][:site])
|
63
|
+
else
|
64
|
+
Dimples::Site
|
65
|
+
end
|
67
66
|
|
68
67
|
site = site_klass.new(config)
|
69
68
|
|
data/lib/dimples/site.rb
CHANGED
@@ -14,7 +14,6 @@ module Dimples
|
|
14
14
|
attr_accessor :pages
|
15
15
|
attr_accessor :posts
|
16
16
|
attr_accessor :latest_post
|
17
|
-
attr_accessor :post_class
|
18
17
|
attr_accessor :errors
|
19
18
|
|
20
19
|
def initialize(config = {})
|
@@ -29,12 +28,6 @@ module Dimples
|
|
29
28
|
@archives = { year: {}, month: {}, day: {} }
|
30
29
|
@latest_post = false
|
31
30
|
|
32
|
-
@post_class = if @config[:class_overrides][:post]
|
33
|
-
Object.const_get(config[:class_overrides][:post])
|
34
|
-
else
|
35
|
-
Dimples::Post
|
36
|
-
end
|
37
|
-
|
38
31
|
@source_paths = { root: File.expand_path(@config[:source_path]) }
|
39
32
|
@output_paths = { site: File.expand_path(@config[:destination_path]) }
|
40
33
|
|
@@ -43,9 +36,8 @@ module Dimples
|
|
43
36
|
end
|
44
37
|
|
45
38
|
%w[archives posts categories].each do |path|
|
46
|
-
|
47
|
-
|
48
|
-
@output_paths[:site], @config[:paths][path_sym]
|
39
|
+
@output_paths[path.to_sym] = File.join(
|
40
|
+
@output_paths[:site], @config[:paths][path.to_sym]
|
49
41
|
)
|
50
42
|
end
|
51
43
|
end
|
@@ -126,7 +118,7 @@ module Dimples
|
|
126
118
|
end
|
127
119
|
|
128
120
|
def scan_post(path)
|
129
|
-
|
121
|
+
post_class.new(self, path).tap do |post|
|
130
122
|
post.categories&.each do |slug|
|
131
123
|
@categories[slug] ||= Dimples::Category.new(self, slug)
|
132
124
|
@categories[slug].posts << post
|
@@ -212,11 +204,13 @@ module Dimples
|
|
212
204
|
dates[:day] = day if day
|
213
205
|
|
214
206
|
path = File.join(@output_paths[:archives], dates.values)
|
207
|
+
|
215
208
|
layout = @config[:layouts][date_archives_sym]
|
209
|
+
date_format = @config[:date_formats][date_type.to_sym]
|
216
210
|
|
217
211
|
options = {
|
218
212
|
context: dates,
|
219
|
-
title: posts[0].date.strftime(
|
213
|
+
title: posts[0].date.strftime(date_format)
|
220
214
|
}
|
221
215
|
|
222
216
|
paginate(self, posts, path, layout, options)
|
@@ -276,6 +270,14 @@ module Dimples
|
|
276
270
|
|
277
271
|
private
|
278
272
|
|
273
|
+
def post_class
|
274
|
+
@post_class ||= if @config[:class_overrides][:post]
|
275
|
+
Object.const_get(config[:class_overrides][:post])
|
276
|
+
else
|
277
|
+
Dimples::Post
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
279
281
|
def archive_year(year)
|
280
282
|
@archives[:year][year] ||= []
|
281
283
|
end
|
data/lib/dimples/version.rb
CHANGED