dimples 2.3.0 → 2.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6df1fbadb2ce282909560a859b4d240ce7d6939a
4
- data.tar.gz: 4725d40c3cb0841296a37955128d490c059fcc85
3
+ metadata.gz: bb7fd3887cfdd5e3934eb0f5e918cd93d8e2cf61
4
+ data.tar.gz: a6edfe39f0b5669ec00c5156b746f74e5635bf61
5
5
  SHA512:
6
- metadata.gz: 84bfd84ed05c271558a67203a1ac37173f7cec15283e27f44046eacfcf2d29b15d23d811c9c4822561f15a2b4d7c3629b4b22aabaff55e7a466118f854fd4a7c
7
- data.tar.gz: ec8dbdb51b9bc734339ddefe274de4846e91f760de0c96f21060057ac7e73756fbc67430e4324bcd83c10f17f0d8820c88efe554aa90e9a6a5fa0ceca02089a6
6
+ metadata.gz: 8dcbeea6df70f31a04b4e3b00750f84802c3ec98039cc391108001e83366cb5121a8d6ac155e9439d74d310331d4874b7814f87079c479e6423b08485dd95d57
7
+ data.tar.gz: 995f7e19f86b99ba0eff33bdae2dd6180407b6c6777b0ecbd97144c5648b552d9a41f8eb4b3ae82f19f0e251708c67a33fbb06cdaffcd6c2dbbb09a5946eec3f
data/bin/dimples CHANGED
@@ -36,15 +36,15 @@ end
36
36
  lib_path = File.join(Dir.pwd, options[:lib])
37
37
  config_path = File.join(Dir.pwd, options[:config] || 'config', 'site.yml')
38
38
 
39
- if File.exist?(config_path)
39
+ config_hash = if File.exist?(config_path)
40
40
  begin
41
- config_hash = YAML.load_file(config_path)
41
+ YAML.load_file(config_path) || {}
42
42
  rescue
43
43
  Trollop::die "Invalid or malformed YAML config file"
44
44
  end
45
45
  else
46
46
  Trollop::die "Unable to find config file" if options[:config]
47
- config_hash = {}
47
+ {}
48
48
  end
49
49
 
50
50
  config_hash['verbose_logging'] = true if options[:verbose]
@@ -63,15 +63,23 @@ case command.to_sym
63
63
  when :build
64
64
  Dimples.logger.info("Building site at #{site.output_paths[:site]}...")
65
65
 
66
+ generated = false
67
+
66
68
  result = Benchmark.measure do
67
69
  site.generate
68
70
  end
69
71
 
70
- generation_time = result.real.round(2)
72
+ if site.generated?
73
+ generation_time = result.real.round(2)
71
74
 
72
- message = "\033[92mDone!\033[0m Site built in #{generation_time} second"
73
- message += 's' if generation_time != 1
74
- message += '.'
75
+ message = "\033[92mDone!\033[0m Site built in #{generation_time} second"
76
+ message += 's' if generation_time != 1
77
+ message += '.'
75
78
 
76
- Dimples.logger.info(message)
79
+ Dimples.logger.info(message)
80
+ else
81
+ site.errors.each do |error|
82
+ Dimples.logger.error(error)
83
+ end
84
+ end
77
85
  end
data/lib/dimples/site.rb CHANGED
@@ -11,6 +11,7 @@ module Dimples
11
11
  attr_accessor :latest_post
12
12
  attr_accessor :page_class
13
13
  attr_accessor :post_class
14
+ attr_accessor :errors
14
15
 
15
16
  def initialize(config)
16
17
  @source_paths = {}
@@ -32,6 +33,8 @@ module Dimples
32
33
  @source_paths[:root] = File.expand_path(@config['source_path'])
33
34
  @output_paths[:site] = File.expand_path(@config['destination_path'])
34
35
 
36
+ @errors = []
37
+
35
38
  %w(pages posts public templates).each do |path|
36
39
  @source_paths[path.to_sym] = File.join(@source_paths[:root], path)
37
40
  end
@@ -48,7 +51,11 @@ module Dimples
48
51
  generate_files
49
52
  copy_assets
50
53
  rescue Errors::RenderingError, Errors::PublishingError, Errors::GenerationError => e
51
- Dimples.logger.error("Failed to generate the site: #{e.message}.")
54
+ @errors << "Failed to generate the site: #{e.message}."
55
+ end
56
+
57
+ def generated?
58
+ @errors.count == 0
52
59
  end
53
60
 
54
61
  private
@@ -258,7 +265,7 @@ module Dimples
258
265
  end
259
266
 
260
267
  def paginate(posts:, title: nil, paths:, layout: false, context: {})
261
- raise "'#{layout}' template not found" unless @templates.key?(layout)
268
+ raise Errors::GenerationError.new("'#{layout}' template not found") unless @templates.key?(layout)
262
269
 
263
270
  per_page = @config['pagination']['per_page']
264
271
  page_count = (posts.length.to_f / per_page.to_i).ceil
@@ -315,4 +322,4 @@ module Dimples
315
322
  pagination
316
323
  end
317
324
  end
318
- end
325
+ end
@@ -1,3 +1,3 @@
1
1
  module Dimples
2
- VERSION = '2.3.0'.freeze
2
+ VERSION = '2.3.1'.freeze
3
3
  end
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: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-10 00:00:00.000000000 Z
11
+ date: 2017-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt