nanoc 4.8.7 → 4.8.8

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: '07984b4aff20053d01dc8bea393474155c3fedfb'
4
- data.tar.gz: 5acf842fc584f0b0f06bd8e55debfde99f2cc8ca
3
+ metadata.gz: bb4c5c05f6a0346d3c7b123114fc03b5031b3f4a
4
+ data.tar.gz: b9e21682769d53cc3682de776779d634775ac5d3
5
5
  SHA512:
6
- metadata.gz: a65e2fe0959a685600f6ce8892b51c0adf81ae8de63ac4eb5fa77f6c5d12f2192d6c6198dd9512444ff279cd74ee1d5f79ee697a3f1d12c7f4ca51141eb32e9a
7
- data.tar.gz: 75189ba5e175f556a4164925e009c54150e39c82f3b4c21e37e78a9658fe997f899eadea3ddad7d9befcc6618c371c46a9527ab8ea1e4973be4a730c163f2246
6
+ metadata.gz: f4c2d65be0f13377c87e0a7ceaaac3e47d61ba1473d107a8945b8746483af258b8515d7eeaecc8ef644c749967c13c8299088b4017b9bd3f73d32815e039fb95
7
+ data.tar.gz: b43daf3c7a9593d9fec24e9444d061b7ab1e8a33d1d4b0c717635db074c877ca2207fb9a1473973ac9ee60399b358a50612c8024157a024b85067c41184bd4ed
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.8.8 (2017-09-22)
4
+
5
+ Enhancements:
6
+
7
+ * Added `#dig` to configuration (#1221) [Gregory Pakosz]
8
+
3
9
  ## 4.8.7 (2017-09-18)
4
10
 
5
11
  Fixes:
@@ -96,6 +96,11 @@ module Nanoc::Int
96
96
  @wrapped[key]
97
97
  end
98
98
 
99
+ contract C::Args[C::Any] => C::Any
100
+ def dig(*keys)
101
+ @wrapped.dig(*keys)
102
+ end
103
+
99
104
  contract C::Any, C::Maybe[C::Any], C::Maybe[C::Func[C::None => C::Any]] => C::Any
100
105
  def fetch(key, fallback = NONE, &_block)
101
106
  @wrapped.fetch(key) do
@@ -47,5 +47,11 @@ module Nanoc
47
47
  @context.dependency_tracker.bounce(unwrap, attributes: true)
48
48
  @config.each(&block)
49
49
  end
50
+
51
+ # @see Hash#dig
52
+ def dig(*keys)
53
+ @context.dependency_tracker.bounce(unwrap, attributes: keys.take(1))
54
+ @config.dig(*keys)
55
+ end
50
56
  end
51
57
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.8.7'
5
+ VERSION = '4.8.8'
6
6
  end
@@ -5,7 +5,7 @@ describe Nanoc::ConfigView do
5
5
  Nanoc::Int::Configuration.new(hash: hash)
6
6
  end
7
7
 
8
- let(:hash) { { amount: 9000, animal: 'donkey' } }
8
+ let(:hash) { { amount: 9000, animal: 'donkey', foo: { bar: :baz } } }
9
9
 
10
10
  let(:view) { described_class.new(config, view_context) }
11
11
 
@@ -41,12 +41,12 @@ describe Nanoc::ConfigView do
41
41
  expect(dependency_tracker).to receive(:bounce).with(config, attributes: [key])
42
42
  end
43
43
 
44
- context 'with existant key' do
44
+ context 'with existing key' do
45
45
  let(:key) { :animal }
46
46
  it { is_expected.to eql('donkey') }
47
47
  end
48
48
 
49
- context 'with non-existant key' do
49
+ context 'with non-existing key' do
50
50
  let(:key) { :weapon }
51
51
  it { is_expected.to eql(nil) }
52
52
  end
@@ -57,7 +57,7 @@ describe Nanoc::ConfigView do
57
57
  expect(dependency_tracker).to receive(:bounce).with(config, attributes: [key])
58
58
  end
59
59
 
60
- context 'with existant key' do
60
+ context 'with existing key' do
61
61
  let(:key) { :animal }
62
62
 
63
63
  subject { view.fetch(key) }
@@ -65,7 +65,7 @@ describe Nanoc::ConfigView do
65
65
  it { is_expected.to eql('donkey') }
66
66
  end
67
67
 
68
- context 'with non-existant key' do
68
+ context 'with non-existing key' do
69
69
  let(:key) { :weapon }
70
70
 
71
71
  context 'with fallback' do
@@ -95,12 +95,12 @@ describe Nanoc::ConfigView do
95
95
  expect(dependency_tracker).to receive(:bounce).with(config, attributes: [key])
96
96
  end
97
97
 
98
- context 'with existant key' do
98
+ context 'with existing key' do
99
99
  let(:key) { :animal }
100
100
  it { is_expected.to eql(true) }
101
101
  end
102
102
 
103
- context 'with non-existant key' do
103
+ context 'with non-existing key' do
104
104
  let(:key) { :weapon }
105
105
  it { is_expected.to eql(false) }
106
106
  end
@@ -115,7 +115,25 @@ describe Nanoc::ConfigView do
115
115
  res = []
116
116
  view.each { |k, v| res << [k, v] }
117
117
 
118
- expect(res).to eql([[:amount, 9000], [:animal, 'donkey']])
118
+ expect(res).to eql([[:amount, 9000], [:animal, 'donkey'], [:foo, { bar: :baz }]])
119
+ end
120
+ end
121
+
122
+ describe '#dig' do
123
+ subject { view.dig(*keys) }
124
+
125
+ before do
126
+ expect(dependency_tracker).to receive(:bounce).with(config, attributes: [:foo])
127
+ end
128
+
129
+ context 'with existing keys' do
130
+ let(:keys) { %i[foo bar] }
131
+ it { is_expected.to eql(:baz) }
132
+ end
133
+
134
+ context 'with non-existing keys' do
135
+ let(:keys) { %i[foo baz bar] }
136
+ it { is_expected.to be_nil }
119
137
  end
120
138
  end
121
139
 
@@ -5,7 +5,7 @@ describe 'GH-1216', site: true, stdio: true do
5
5
  FileUtils.mkdir_p('content/talks')
6
6
  File.write('content/talks/aaa.html', 'A')
7
7
  File.write('content/talks/bbb.html', 'B')
8
- File.write('content/talks.html', '<%= @items.find_all("/talks/*").map { |i| i.raw_content + "=" + i[:status].to_s }.join(" ") %>')
8
+ File.write('content/talks.html', '<%= @items.find_all("/talks/*").map { |i| i.raw_content + "=" + i[:status].to_s }.sort.join(" ") %>')
9
9
 
10
10
  File.write('Rules', <<~EOS)
11
11
  compile '/**/*' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.7
4
+ version: 4.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri