dimples 4.0.1 → 4.0.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
  SHA1:
3
- metadata.gz: 01da1633d41b4a6bd472c904222ece07329a3fc0
4
- data.tar.gz: eceed845d1ebedbfbe74505d7c4d5726baa9bd50
3
+ metadata.gz: bd1dfcb170bc3880ea8ea1391d1020abab51209c
4
+ data.tar.gz: a7499bb4bc0d2582397a3f3c0013a566c02f397e
5
5
  SHA512:
6
- metadata.gz: be020d727fe23d9ceafbc4a0e4605e4e3a3c80d5def9824f0ed08d54cc759e32b1363d96ff2dfa45839632690924af3e7787488996a7ebb61f80aa231036359b
7
- data.tar.gz: de19eae31e9bf2d79b521d0397d8d191252053a51b2e686b7bc6d5737fd2dbb8918babdcd48ea1dc3bd6547688195f264e37f2656a8b9e844a3f3225d5b3df77
6
+ metadata.gz: b925776ae7af279586dc90b839dba7bf5859d1101c6fa3c7accc84b68ac2ee7b22f8bbfa9b42c000754e6335901277a6db0ec479300f2ad8ff4fa8f316daeeee
7
+ data.tar.gz: 4c387d0ccc57b4ea7b602702c6db73b634e6b2b37fbcd8a6e9c3fbc57b5a09d531c55774a608800fb97d6fd84bf1070aee91d57bd81a81839ded8919d6e3a536
@@ -42,7 +42,10 @@ config_path = options[:config] || File.join(Dir.pwd, 'config.json')
42
42
 
43
43
  if File.exist?(config_path)
44
44
  begin
45
- config = JSON.parse(File.read(config_path), symbolize_names: true)
45
+ file_contents = File.read(config_path)
46
+ Trollop.die "Config file is empty (#{config_path})" if file_contents.empty?
47
+
48
+ config = JSON.parse(file_contents, symbolize_names: true)
46
49
  rescue
47
50
  Trollop.die "Invalid or malformed config file (#{config_path})"
48
51
  end
@@ -50,7 +53,7 @@ else
50
53
  Trollop.die "Unable to find config file (#{config_path})"
51
54
  end
52
55
 
53
- config[:verbose_logging] = options[:verbose] || false
56
+ config[:verbose_logging] = options[:verbose] if options[:verbose]
54
57
 
55
58
  if Dir.exist?(lib_path)
56
59
  Dir.glob(File.join(lib_path, '**', '*.rb')) do |path|
@@ -58,8 +61,10 @@ if Dir.exist?(lib_path)
58
61
  end
59
62
  end
60
63
 
61
- site_klass = if config[:class_overrides][:site]
62
- Object.const_get(config[:class_overrides][:site])
64
+ site_klass_name = config.dig(:class_overrides, :site)
65
+
66
+ site_klass = if site_klass_name
67
+ Object.const_get(site_klass_name)
63
68
  else
64
69
  Dimples::Site
65
70
  end
@@ -4,7 +4,16 @@ module Dimples
4
4
  # A class that models a site's configuration.
5
5
  class Configuration
6
6
  def initialize(config = {})
7
- @settings = Configuration.default_settings.merge(config)
7
+ @settings = Dimples::Configuration.default_settings
8
+
9
+ config.each_key do |key|
10
+ case @settings[key]
11
+ when Hash
12
+ @settings[key].merge!(config[key])
13
+ else
14
+ @settings[key] = config[key]
15
+ end
16
+ end
8
17
  end
9
18
 
10
19
  def [](key)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dimples
4
- VERSION = '4.0.1'
4
+ VERSION = '4.0.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: 4.0.1
4
+ version: 4.0.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: 2017-09-06 00:00:00.000000000 Z
11
+ date: 2017-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt