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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e347e41fcd6d975535e6acb93dae09e600b0b8aa
4
- data.tar.gz: 4de9555a39ed438e94f76c4caef2ac79b0407914
3
+ metadata.gz: 01da1633d41b4a6bd472c904222ece07329a3fc0
4
+ data.tar.gz: eceed845d1ebedbfbe74505d7c4d5726baa9bd50
5
5
  SHA512:
6
- metadata.gz: 2c76600d5243dd598286c17d36f177391cd2f7d1bb820f7c4281599f5b98937479462cf5cf1a5e5860a5f6c31910d9dbfd822030f9e18be9fda2c81c31105fa7
7
- data.tar.gz: f502ff18da072fe8d6c0844b2691de1a72ecbdbe137c4fb68c37801cfbb437588ba6b837e97d005e989a3ba17d186da7e7f667d21660e2c98cdcdd93e379d64d
6
+ metadata.gz: be020d727fe23d9ceafbc4a0e4605e4e3a3c80d5def9824f0ed08d54cc759e32b1363d96ff2dfa45839632690924af3e7787488996a7ebb61f80aa231036359b
7
+ data.tar.gz: de19eae31e9bf2d79b521d0397d8d191252053a51b2e686b7bc6d5737fd2dbb8918babdcd48ea1dc3bd6547688195f264e37f2656a8b9e844a3f3225d5b3df77
@@ -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 => e
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
- Object.const_get(config[:class_overrides][:site])
64
- else
65
- Dimples::Site
66
- end
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
 
@@ -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
- path_sym = path.to_sym
47
- @output_paths[path_sym] = File.join(
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
- @post_class.new(self, path).tap do |post|
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(@config[:date_formats][date_type.to_sym])
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dimples
4
- VERSION = '4.0.0'
4
+ VERSION = '4.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan