dimples 1.2.5 → 1.2.6
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.
- checksums.yaml +4 -4
- data/lib/dimples.rb +1 -0
- data/lib/dimples/category.rb +18 -0
- data/lib/dimples/site.rb +18 -7
- data/lib/dimples/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1736eb52dc11b031fa9a1b6cff9a5e52a16e8a90
|
4
|
+
data.tar.gz: 8d2ca4393894d87537c247f78441ea34ecef79d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f9ef86dd1d02349c99e2b8825e016fcba6a10aa6d280bf3f1e7bc63fa65c8110836d30aab4643df215094f5c7b7b18cc46eecbfee1010e9ab0f8d56e1d6fd02
|
7
|
+
data.tar.gz: 4f4be16cd059884d030a8a7f0ae0f55faf7978d79d84953087cc8fc2c6e8dd38f3db3f78c8125e0fd7cf96d0e2b4b9e98878e4f2229efa991c392b7db6a78d3b
|
data/lib/dimples.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Dimples
|
2
|
+
class Category
|
3
|
+
include Frontable
|
4
|
+
|
5
|
+
attr_accessor :slug
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :posts
|
8
|
+
|
9
|
+
def initialize(slug, path = nil)
|
10
|
+
@slug = slug
|
11
|
+
@name = @slug.capitalize
|
12
|
+
|
13
|
+
read_with_yaml(path) if path
|
14
|
+
|
15
|
+
@posts = []
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/dimples/site.rb
CHANGED
@@ -32,7 +32,7 @@ module Dimples
|
|
32
32
|
@source_paths[:root] = File.expand_path(@config['source_path'])
|
33
33
|
@output_paths[:site] = File.expand_path(@config['destination_path'])
|
34
34
|
|
35
|
-
%w{pages posts templates
|
35
|
+
%w{categories pages posts public templates}.each do |path|
|
36
36
|
@source_paths[path.to_sym] = File.join(@source_paths[:root], path)
|
37
37
|
end
|
38
38
|
|
@@ -64,6 +64,7 @@ module Dimples
|
|
64
64
|
|
65
65
|
def scan_files
|
66
66
|
scan_templates
|
67
|
+
scan_categories
|
67
68
|
scan_pages
|
68
69
|
scan_posts
|
69
70
|
end
|
@@ -75,6 +76,15 @@ module Dimples
|
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
79
|
+
def scan_categories
|
80
|
+
Dir.glob(File.join(@source_paths[:categories], '*.*')).each do |path|
|
81
|
+
slug = File.basename(path, File.extname(path))
|
82
|
+
category = Dimples::Category.new(slug, path)
|
83
|
+
|
84
|
+
@categories[category.slug] = category
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
78
88
|
def scan_pages
|
79
89
|
Dir.glob(File.join(@source_paths[:pages], '**', '*.*')).each do |path|
|
80
90
|
@pages << @page_class.new(self, path)
|
@@ -85,8 +95,9 @@ module Dimples
|
|
85
95
|
Dir.glob(File.join(@source_paths[:posts], '*.*')).reverse.each do |path|
|
86
96
|
post = @post_class.new(self, path)
|
87
97
|
|
88
|
-
post.categories.each do |
|
89
|
-
|
98
|
+
post.categories.each do |slug|
|
99
|
+
@categories[slug] ||= Dimples::Category.new(slug)
|
100
|
+
@categories[slug].posts << post
|
90
101
|
end
|
91
102
|
|
92
103
|
%w[year month day].each do |date_type|
|
@@ -135,8 +146,8 @@ module Dimples
|
|
135
146
|
end
|
136
147
|
|
137
148
|
def generate_categories
|
138
|
-
@categories.
|
139
|
-
paginate(posts: posts, title:
|
149
|
+
@categories.each_value do |category|
|
150
|
+
paginate(posts: category.posts, title: category.name, paths: [@output_paths[:posts], category.slug], layout: @config['layouts']['category'])
|
140
151
|
end
|
141
152
|
end
|
142
153
|
|
@@ -173,8 +184,8 @@ module Dimples
|
|
173
184
|
end
|
174
185
|
|
175
186
|
def generate_category_feeds
|
176
|
-
@categories.
|
177
|
-
generate_feed(File.join(@output_paths[:posts], slug), {posts: posts[0..@config['pagination']['per_page'] - 1], category: slug})
|
187
|
+
@categories.each_value do |category|
|
188
|
+
generate_feed(File.join(@output_paths[:posts], category.slug), {posts: category.posts[0..@config['pagination']['per_page'] - 1], category: category.slug})
|
178
189
|
end
|
179
190
|
end
|
180
191
|
|
data/lib/dimples/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dimples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bogan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|
@@ -32,6 +32,7 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- lib/dimples.rb
|
35
|
+
- lib/dimples/category.rb
|
35
36
|
- lib/dimples/configuration.rb
|
36
37
|
- lib/dimples/errors.rb
|
37
38
|
- lib/dimples/frontable.rb
|