dimples 6.5.1 → 6.5.2

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
  SHA256:
3
- metadata.gz: 40268561d3fcd161f8dc7321670df7083d56f8e66a77d2380723e3fd9be31eb8
4
- data.tar.gz: cbb449143625711925e78856ff3fe1b4b2e6848792348240e0c9323f6ffcd895
3
+ metadata.gz: 9a6f8617d58941c5af9745c1bd0ceaf12ecaaafc7bd4e79e2b1b2f40f5b0bd0c
4
+ data.tar.gz: db3408502d32f1404de50d050a2cec1d055b505ad2f4195fb00ef60500cd4f75
5
5
  SHA512:
6
- metadata.gz: 10d6c371b26817b5c460d18375348b967c7c308b15e522c77d3f3dd0c801bd47c282d48d93f320d52efa3e23592aefa0290d8bffa81d6caae16bc964f470387d
7
- data.tar.gz: b9ea582360edfd2b29dfcc07c2161b7d9cfc9c1ad33e0a9743a9d0b6fa3f3efa3fbacc516c8e4843e8566cf50c765c3eaef0a731bfc962c465c216d9b121f230
6
+ metadata.gz: 3a48b54049b77629a6996ac98d850a02d6a780e13ef2b6a93a380f712dbb423153a0cad78b05a9c4abc3da2fa2ad6dae1f384dd40b36670c97d9e0eace8a16cb
7
+ data.tar.gz: 1f197dc175792163a2bda5ecfcf4b359fbf28412dacfe53fa1f3c0f73174867744fc9b65137656a0ba62e19769b63e055cc8aed8bf6baf2707485f08346390cb
@@ -29,7 +29,6 @@ Options:
29
29
  opt :config, 'Config file path', type: :string
30
30
  opt :source, 'Source directory', type: :string
31
31
  opt :destination, 'Destination directory', type: :string
32
- opt :verbose, 'Verbose mode', default: false
33
32
  end
34
33
 
35
34
  Optimist.educate if ARGV.empty?
@@ -47,19 +46,19 @@ source_path = if options[:source]
47
46
 
48
47
  config_path = options[:config] || File.join(source_path, 'config.json')
49
48
 
50
- if File.exist?(config_path)
51
- begin
52
- file_contents = File.read(config_path)
53
- Optimist.die "Config file is empty (#{config_path})" if file_contents.empty?
54
-
55
- config = JSON.parse(file_contents, symbolize_names: true)
56
- rescue JSON::ParserError
57
- Optimist.die "Invalid or malformed config file (#{config_path})"
58
- end
59
- else
49
+ unless File.exist?(config_path)
60
50
  Optimist.die "Unable to find config file (#{config_path})"
61
51
  end
62
52
 
53
+ begin
54
+ file_contents = File.read(config_path)
55
+ Optimist.die "Config file is empty (#{config_path})" if file_contents.empty?
56
+
57
+ config = JSON.parse(file_contents, symbolize_names: true)
58
+ rescue JSON::ParserError
59
+ Optimist.die "Invalid or malformed config file (#{config_path})"
60
+ end
61
+
63
62
  config[:source] = source_path
64
63
 
65
64
  if options[:destination]
@@ -12,7 +12,13 @@ module Dimples
12
12
  context[:site] ||= @site
13
13
  context[:pagination] ||= nil
14
14
 
15
- output = engine.render(scope, context) { body }.strip
15
+ begin
16
+ output = engine.render(scope, context) { body }.strip
17
+ rescue StandardError => e
18
+ raise RenderingError,
19
+ "Unable to render #{@source.path || 'dynamic file'} (#{e})"
20
+ end
21
+
16
22
  @source.metadata[:rendered_contents] = output
17
23
 
18
24
  if @source.metadata[:layout]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dimples
4
- VERSION = '6.5.1'
4
+ VERSION = '6.5.2'
5
5
  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: 6.5.1
4
+ version: 6.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-24 00:00:00.000000000 Z
11
+ date: 2019-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie