nanoc 4.6.2 → 4.6.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/NEWS.md +8 -0
- data/lib/nanoc/base/entities/identifiable_collection.rb +3 -3
- data/lib/nanoc/base/repos/aggregate_data_source.rb +8 -4
- data/lib/nanoc/base/services/compiler/phases/cache.rb +6 -1
- data/lib/nanoc/cli/commands/compile.rb +1 -0
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/services/compiler/phases/cache_spec.rb +37 -2
- data/spec/nanoc/regressions/gh_1094_spec.rb +22 -0
- data/spec/nanoc/regressions/gh_1107_spec.rb +13 -0
- data/spec/spec_helper.rb +26 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2be981505c54e8c257e032a6bd08d7be8be95135
|
4
|
+
data.tar.gz: db527143c17a425809740641b4344b225c35fc43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1b3ed7df2c66ed6eab2b67081b1b828942fa5ce474e85d2c088dc6b439ccffbf36a1cedad89fef84334b2e5033ce561a98e1bc48b5f94f176358a9b913d1426
|
7
|
+
data.tar.gz: ad5c1d8f749f3b10f8167f4faa45a41cbcc18ba64ca2ad73220a4afc49f606399349de87d05599d462d4eebf819f5ead745e3c9c42883ba3b71bf2c2038b54e0
|
data/Gemfile.lock
CHANGED
data/NEWS.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
+
## 4.6.3 (2017-03-05)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Fixed `Errno::ENOENT` crash (#1094, #1109)
|
8
|
+
* Fixed undefined method `#reverse_each` crash (#1107, #1108)
|
9
|
+
* Fixed compilation speed issue introduced in 4.6.2 (#1106)
|
10
|
+
|
3
11
|
## 4.6.2 (2017-03-04)
|
4
12
|
|
5
13
|
Fixes:
|
@@ -12,7 +12,7 @@ module Nanoc::Int
|
|
12
12
|
contract C::Or[Hash, C::Named['Nanoc::Int::Configuration']], C::IterOf[C::RespondTo[:identifier]] => C::Any
|
13
13
|
def initialize(config, objects = [])
|
14
14
|
@config = config
|
15
|
-
@objects = objects
|
15
|
+
@objects = Hamster::Vector.new(objects)
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.from(enum, config)
|
@@ -43,7 +43,7 @@ module Nanoc::Int
|
|
43
43
|
|
44
44
|
contract C::None => C::ArrayOf[C::RespondTo[:identifier]]
|
45
45
|
def to_a
|
46
|
-
@objects
|
46
|
+
@objects.to_a
|
47
47
|
end
|
48
48
|
|
49
49
|
contract C::None => C::Bool
|
@@ -52,7 +52,7 @@ module Nanoc::Int
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def add(obj)
|
55
|
-
self.class.new(@config, @objects
|
55
|
+
self.class.new(@config, @objects.add(obj))
|
56
56
|
end
|
57
57
|
|
58
58
|
def reject(&block)
|
@@ -8,13 +8,17 @@ module Nanoc::Int
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def items
|
11
|
-
|
12
|
-
|
11
|
+
@_items ||= begin
|
12
|
+
objs = @data_sources.flat_map(&:items)
|
13
|
+
Nanoc::Int::IdentifiableCollection.from(objs, @config)
|
14
|
+
end
|
13
15
|
end
|
14
16
|
|
15
17
|
def layouts
|
16
|
-
|
17
|
-
|
18
|
+
@_layouts ||= begin
|
19
|
+
objs = @data_sources.flat_map(&:layouts)
|
20
|
+
Nanoc::Int::IdentifiableCollection.from(objs, @config)
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
@@ -26,7 +26,12 @@ module Nanoc::Int::Compiler::Phases
|
|
26
26
|
|
27
27
|
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Bool
|
28
28
|
def can_reuse_content_for_rep?(rep, is_outdated:)
|
29
|
-
|
29
|
+
if is_outdated
|
30
|
+
false
|
31
|
+
else
|
32
|
+
cache = @compiled_content_cache[rep]
|
33
|
+
cache ? cache.none? { |_snapshot_name, content| content.binary? } : false
|
34
|
+
end
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
data/lib/nanoc/version.rb
CHANGED
@@ -69,12 +69,12 @@ describe Nanoc::Int::Compiler::Phases::Cache do
|
|
69
69
|
context 'not outdated' do
|
70
70
|
let(:is_outdated) { false }
|
71
71
|
|
72
|
-
context 'cached compiled content available' do
|
72
|
+
context 'textual cached compiled content available' do
|
73
73
|
before do
|
74
74
|
compiled_content_cache[rep] = { last: Nanoc::Int::TextualContent.new('cached') }
|
75
75
|
end
|
76
76
|
|
77
|
-
it '
|
77
|
+
it 'writes content to cache' do
|
78
78
|
expect { subject }
|
79
79
|
.to change { snapshot_repo.get(rep, :last) }
|
80
80
|
.from(nil)
|
@@ -99,6 +99,41 @@ describe Nanoc::Int::Compiler::Phases::Cache do
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
+
context 'binary cached compiled content available' do
|
103
|
+
let(:binary_content) { 'b1n4ry' }
|
104
|
+
let(:binary_filename) { Tempfile.open('test') { |fn| fn << binary_content }.path }
|
105
|
+
|
106
|
+
before do
|
107
|
+
compiled_content_cache[rep] = { last: Nanoc::Int::BinaryContent.new(binary_filename) }
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'writes content to cache' do
|
111
|
+
expect { subject }
|
112
|
+
.to change { snapshot_repo.get(rep, :last) }
|
113
|
+
.from(nil)
|
114
|
+
.to(some_textual_content('wrapped content'))
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'marks rep as compiled' do
|
118
|
+
expect { subject }
|
119
|
+
.to change { rep.compiled? }
|
120
|
+
.from(false)
|
121
|
+
.to(true)
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'changes compiled content cache' do
|
125
|
+
expect { subject }
|
126
|
+
.to change { compiled_content_cache[rep] }
|
127
|
+
.from(last: some_binary_content(binary_content))
|
128
|
+
.to(last: some_textual_content('wrapped content'))
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'does not send notification' do
|
132
|
+
expect(Nanoc::Int::NotificationCenter).not_to receive(:post).with(:cached_content_used, rep)
|
133
|
+
subject
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
102
137
|
context 'no cached compiled content available' do
|
103
138
|
include_examples 'calls wrapped'
|
104
139
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
describe 'GH-1094', site: true, stdio: true do
|
2
|
+
before do
|
3
|
+
File.write('content/a.dat', 'foo')
|
4
|
+
File.write('content/index.html', '<%= @items["/*.dat"].compiled_content %>')
|
5
|
+
|
6
|
+
File.write('Rules', <<EOS)
|
7
|
+
compile '/**/*.html' do
|
8
|
+
filter :erb
|
9
|
+
write item.identifier.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
passthrough '/**/*.dat'
|
13
|
+
EOS
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'raises CannotGetCompiledContentOfBinaryItem twice' do
|
17
|
+
2.times do
|
18
|
+
expect { Nanoc::CLI.run(%w(compile)) }
|
19
|
+
.to raise_wrapped_error(an_instance_of(Nanoc::Int::Errors::CannotGetCompiledContentOfBinaryItem))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
describe 'GH-1107', site: true, stdio: true do
|
2
|
+
before do
|
3
|
+
File.write('Rules', <<EOS)
|
4
|
+
compile '/**/*.html' do
|
5
|
+
garbage(data/**/*)
|
6
|
+
end
|
7
|
+
EOS
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'raises the proper exception' do
|
11
|
+
expect { Nanoc::CLI.run(%w(compile --verbose)) }.to raise_error(SyntaxError)
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -174,6 +174,32 @@ RSpec::Matchers.define :yield_from_fiber do |expected|
|
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
|
+
RSpec::Matchers.define :raise_wrapped_error do |expected|
|
178
|
+
supports_block_expectations
|
179
|
+
|
180
|
+
include RSpec::Matchers::Composable
|
181
|
+
|
182
|
+
match do |actual|
|
183
|
+
begin
|
184
|
+
actual.call
|
185
|
+
rescue Nanoc::Int::Errors::CompilationError => e
|
186
|
+
values_match?(expected, e.unwrap)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
description do
|
191
|
+
"raise wrapped error #{expected.inspect}"
|
192
|
+
end
|
193
|
+
|
194
|
+
failure_message do |_actual|
|
195
|
+
"expected that proc would raise wrapped error #{expected.inspect}"
|
196
|
+
end
|
197
|
+
|
198
|
+
failure_message_when_negated do |_actual|
|
199
|
+
"expected that proc would not raise wrapped error #{expected.inspect}"
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
177
203
|
RSpec::Matchers.define :be_some_textual_content do |expected|
|
178
204
|
include RSpec::Matchers::Composable
|
179
205
|
|
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.6.
|
4
|
+
version: 4.6.3
|
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-03-
|
11
|
+
date: 2017-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -442,9 +442,11 @@ files:
|
|
442
442
|
- spec/nanoc/regressions/gh_1082c_spec.rb
|
443
443
|
- spec/nanoc/regressions/gh_1082d_spec.rb
|
444
444
|
- spec/nanoc/regressions/gh_1093_spec.rb
|
445
|
+
- spec/nanoc/regressions/gh_1094_spec.rb
|
445
446
|
- spec/nanoc/regressions/gh_1097_spec.rb
|
446
447
|
- spec/nanoc/regressions/gh_1100_spec.rb
|
447
448
|
- spec/nanoc/regressions/gh_1102_spec.rb
|
449
|
+
- spec/nanoc/regressions/gh_1107_spec.rb
|
448
450
|
- spec/nanoc/regressions/gh_761_spec.rb
|
449
451
|
- spec/nanoc/regressions/gh_767_spec.rb
|
450
452
|
- spec/nanoc/regressions/gh_769_spec.rb
|