nanoc 4.7.2 → 4.7.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 +7 -7
- data/NEWS.md +6 -0
- data/lib/nanoc/base/entities/props.rb +38 -5
- data/lib/nanoc/base/repos/dependency_store.rb +3 -2
- data/lib/nanoc/base/services/dependency_tracker.rb +2 -1
- data/lib/nanoc/base/services/outdatedness_checker.rb +6 -3
- data/lib/nanoc/base/services/outdatedness_rules.rb +27 -10
- data/lib/nanoc/base/views/mixins/document_view_mixin.rb +4 -3
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/entities/props_spec.rb +96 -0
- data/spec/nanoc/base/repos/dependency_store_spec.rb +72 -0
- data/spec/nanoc/base/services/executor_spec.rb +1 -1
- data/spec/nanoc/base/services/outdatedness_rules_spec.rb +30 -16
- data/spec/nanoc/regressions/gh_1134_spec.rb +27 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06af73e98c0935c6d7d8fd00b40d9e09329d745c
|
4
|
+
data.tar.gz: f5e03e20454c8d526ef62d3be16638e9a4e8bfe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e898a8a5f2270666742feff827ab473843fed2f9dd6801016fbf5c201b6649d4f3a9825ce17fada634be2254252cfabda285e35ca004388d88ce2900994c208d
|
7
|
+
data.tar.gz: 4246e6c9ad39036c4f271f3e99ac28b2b44f0f3de670459d72761046416369948a4695c9c4953ff4f7d7591f42f7dde698f4665f9ec1aaea5d940982fef53938
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/bbatsov/rubocop.git
|
3
|
-
revision:
|
3
|
+
revision: d1b9d66c3518389b0c408a6a4a42061b36748df4
|
4
4
|
specs:
|
5
|
-
rubocop (0.
|
5
|
+
rubocop (0.48.0)
|
6
6
|
parser (>= 2.3.3.1, < 3.0)
|
7
7
|
powerpack (~> 0.1)
|
8
8
|
rainbow (>= 1.99.1, < 3.0)
|
@@ -27,7 +27,7 @@ GIT
|
|
27
27
|
PATH
|
28
28
|
remote: .
|
29
29
|
specs:
|
30
|
-
nanoc (4.7.
|
30
|
+
nanoc (4.7.3)
|
31
31
|
cri (~> 2.3)
|
32
32
|
ddplugin (~> 1.0)
|
33
33
|
hamster (~> 3.0)
|
@@ -273,9 +273,9 @@ GEM
|
|
273
273
|
mocha (1.2.1)
|
274
274
|
metaclass (~> 0.0.1)
|
275
275
|
multi_json (1.12.1)
|
276
|
-
mustache (1.0.
|
276
|
+
mustache (1.0.4)
|
277
277
|
nenv (0.3.0)
|
278
|
-
nokogiri (1.7.
|
278
|
+
nokogiri (1.7.1)
|
279
279
|
mini_portile2 (~> 2.1.0)
|
280
280
|
notiffany (0.1.1)
|
281
281
|
nenv (~> 0.1)
|
@@ -338,7 +338,7 @@ GEM
|
|
338
338
|
tilt (>= 1.3.3, < 2.1)
|
339
339
|
slop (3.6.0)
|
340
340
|
temple (0.7.7)
|
341
|
-
term-ansicolor (1.4.
|
341
|
+
term-ansicolor (1.4.1)
|
342
342
|
tins (~> 1.0)
|
343
343
|
thor (0.19.4)
|
344
344
|
tilt (2.0.7)
|
@@ -347,7 +347,7 @@ GEM
|
|
347
347
|
trollop (2.1.2)
|
348
348
|
typogruby (1.0.18)
|
349
349
|
rubypants
|
350
|
-
uglifier (3.1.
|
350
|
+
uglifier (3.1.10)
|
351
351
|
execjs (>= 0.3.0, < 3)
|
352
352
|
unicode-display_width (1.1.3)
|
353
353
|
url (0.3.2)
|
data/NEWS.md
CHANGED
@@ -3,12 +3,22 @@ module Nanoc::Int
|
|
3
3
|
class Props
|
4
4
|
include Nanoc::Int::ContractsSupport
|
5
5
|
|
6
|
-
|
6
|
+
attr_reader :attributes
|
7
|
+
|
8
|
+
C_ATTRS = C::Or[C::IterOf[Symbol], C::Bool]
|
9
|
+
contract C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C_ATTRS], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
|
7
10
|
def initialize(raw_content: false, attributes: false, compiled_content: false, path: false)
|
8
11
|
@raw_content = raw_content
|
9
|
-
@attributes = attributes
|
10
12
|
@compiled_content = compiled_content
|
11
13
|
@path = path
|
14
|
+
|
15
|
+
@attributes =
|
16
|
+
case attributes
|
17
|
+
when Enumerable
|
18
|
+
Set.new(attributes)
|
19
|
+
else
|
20
|
+
attributes
|
21
|
+
end
|
12
22
|
end
|
13
23
|
|
14
24
|
contract C::None => String
|
@@ -30,7 +40,12 @@ module Nanoc::Int
|
|
30
40
|
|
31
41
|
contract C::None => C::Bool
|
32
42
|
def attributes?
|
33
|
-
@attributes
|
43
|
+
case @attributes
|
44
|
+
when Enumerable
|
45
|
+
@attributes.any?
|
46
|
+
else
|
47
|
+
@attributes
|
48
|
+
end
|
34
49
|
end
|
35
50
|
|
36
51
|
contract C::None => C::Bool
|
@@ -47,12 +62,30 @@ module Nanoc::Int
|
|
47
62
|
def merge(other)
|
48
63
|
Props.new(
|
49
64
|
raw_content: raw_content? || other.raw_content?,
|
50
|
-
attributes:
|
65
|
+
attributes: merge_attributes(other),
|
51
66
|
compiled_content: compiled_content? || other.compiled_content?,
|
52
67
|
path: path? || other.path?,
|
53
68
|
)
|
54
69
|
end
|
55
70
|
|
71
|
+
def merge_attributes(other)
|
72
|
+
case attributes
|
73
|
+
when true
|
74
|
+
true
|
75
|
+
when false
|
76
|
+
other.attributes
|
77
|
+
else
|
78
|
+
case other.attributes
|
79
|
+
when true
|
80
|
+
true
|
81
|
+
when false
|
82
|
+
attributes
|
83
|
+
else
|
84
|
+
attributes + other.attributes
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
56
89
|
contract C::None => Set
|
57
90
|
def active
|
58
91
|
Set.new.tap do |pr|
|
@@ -67,7 +100,7 @@ module Nanoc::Int
|
|
67
100
|
def to_h
|
68
101
|
{
|
69
102
|
raw_content: raw_content?,
|
70
|
-
attributes: attributes
|
103
|
+
attributes: attributes,
|
71
104
|
compiled_content: compiled_content?,
|
72
105
|
path: path?,
|
73
106
|
}
|
@@ -58,7 +58,9 @@ module Nanoc::Int
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
C_DOC = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]
|
62
|
+
C_ATTR = C::Or[C::IterOf[Symbol], C::Bool]
|
63
|
+
contract C::Maybe[C_DOC], C::Maybe[C_DOC], C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C_ATTR], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
|
62
64
|
# Records a dependency from `src` to `dst` in the dependency graph. When
|
63
65
|
# `dst` is oudated, `src` will also become outdated.
|
64
66
|
#
|
@@ -75,7 +77,6 @@ module Nanoc::Int
|
|
75
77
|
new_props = Nanoc::Int::Props.new(raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
|
76
78
|
props = existing_props.merge(new_props)
|
77
79
|
|
78
|
-
# Warning! dst and src are *reversed* here!
|
79
80
|
@graph.add_edge(dst, src, props: props.to_h) unless src == dst
|
80
81
|
end
|
81
82
|
|
@@ -4,7 +4,8 @@ module Nanoc::Int
|
|
4
4
|
include Nanoc::Int::ContractsSupport
|
5
5
|
|
6
6
|
C_OBJ = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]
|
7
|
-
|
7
|
+
C_ATTR = C::Or[C::IterOf[Symbol], C::Bool]
|
8
|
+
C_ARGS = C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C_ATTR], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]]
|
8
9
|
|
9
10
|
class Null
|
10
11
|
include Nanoc::Int::ContractsSupport
|
@@ -58,10 +58,13 @@ module Nanoc::Int
|
|
58
58
|
rules.inject(status) do |acc, rule|
|
59
59
|
if !acc.useful_to_apply?(rule)
|
60
60
|
acc
|
61
|
-
elsif rule.instance.call(obj, @outdatedness_checker)
|
62
|
-
acc.update(rule.instance.reason)
|
63
61
|
else
|
64
|
-
|
62
|
+
reason = rule.instance.call(obj, @outdatedness_checker)
|
63
|
+
if reason
|
64
|
+
acc.update(reason)
|
65
|
+
else
|
66
|
+
acc
|
67
|
+
end
|
65
68
|
end
|
66
69
|
end
|
67
70
|
end
|
@@ -11,7 +11,9 @@ module Nanoc::Int
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def apply(_obj, outdatedness_checker)
|
14
|
-
any_snippets_modified?(outdatedness_checker)
|
14
|
+
if any_snippets_modified?(outdatedness_checker)
|
15
|
+
Nanoc::Int::OutdatednessReasons::CodeSnippetsModified
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
19
|
private
|
@@ -34,7 +36,9 @@ module Nanoc::Int
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def apply(_obj, outdatedness_checker)
|
37
|
-
config_modified?(outdatedness_checker)
|
39
|
+
if config_modified?(outdatedness_checker)
|
40
|
+
Nanoc::Int::OutdatednessReasons::ConfigurationModified
|
41
|
+
end
|
38
42
|
end
|
39
43
|
|
40
44
|
private
|
@@ -54,8 +58,9 @@ module Nanoc::Int
|
|
54
58
|
end
|
55
59
|
|
56
60
|
def apply(obj, _outdatedness_checker)
|
57
|
-
|
58
|
-
|
61
|
+
if obj.raw_paths.values.flatten.compact.any? { |fn| !File.file?(fn) }
|
62
|
+
Nanoc::Int::OutdatednessReasons::NotWritten
|
63
|
+
end
|
59
64
|
end
|
60
65
|
end
|
61
66
|
|
@@ -69,7 +74,9 @@ module Nanoc::Int
|
|
69
74
|
|
70
75
|
ch_old = outdatedness_checker.checksum_store.content_checksum_for(obj)
|
71
76
|
ch_new = Nanoc::Int::Checksummer.calc_for_content_of(obj)
|
72
|
-
ch_old != ch_new
|
77
|
+
if ch_old != ch_new
|
78
|
+
Nanoc::Int::OutdatednessReasons::ContentModified
|
79
|
+
end
|
73
80
|
end
|
74
81
|
end
|
75
82
|
|
@@ -82,7 +89,7 @@ module Nanoc::Int
|
|
82
89
|
Nanoc::Int::OutdatednessReasons::AttributesModified
|
83
90
|
end
|
84
91
|
|
85
|
-
contract C::Or[Nanoc::Int::ItemRep, Nanoc::Int::Item, Nanoc::Int::Layout], C::Named['Nanoc::Int::OutdatednessChecker'] => C::
|
92
|
+
contract C::Or[Nanoc::Int::ItemRep, Nanoc::Int::Item, Nanoc::Int::Layout], C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
|
86
93
|
def apply(obj, outdatedness_checker)
|
87
94
|
case obj
|
88
95
|
when Nanoc::Int::ItemRep
|
@@ -90,8 +97,9 @@ module Nanoc::Int
|
|
90
97
|
when Nanoc::Int::Item, Nanoc::Int::Layout
|
91
98
|
ch_old = outdatedness_checker.checksum_store.attributes_checksum_for(obj)
|
92
99
|
ch_new = Nanoc::Int::Checksummer.calc_for_attributes_of(obj)
|
93
|
-
|
94
|
-
|
100
|
+
if ch_old != ch_new
|
101
|
+
Nanoc::Int::OutdatednessReasons::AttributesModified
|
102
|
+
end
|
95
103
|
else
|
96
104
|
raise ArgumentError
|
97
105
|
end
|
@@ -107,7 +115,9 @@ module Nanoc::Int
|
|
107
115
|
def apply(obj, outdatedness_checker)
|
108
116
|
mem_old = outdatedness_checker.rule_memory_store[obj]
|
109
117
|
mem_new = outdatedness_checker.action_provider.memory_for(obj).serialize
|
110
|
-
|
118
|
+
unless mem_old.eql?(mem_new)
|
119
|
+
Nanoc::Int::OutdatednessReasons::RulesModified
|
120
|
+
end
|
111
121
|
end
|
112
122
|
end
|
113
123
|
|
@@ -126,7 +136,9 @@ module Nanoc::Int
|
|
126
136
|
paths_old = mem_old.select { |pa| pa[0] == :snapshot }
|
127
137
|
paths_new = mem_new.select { |pa| pa[0] == :snapshot }
|
128
138
|
|
129
|
-
paths_old != paths_new
|
139
|
+
if paths_old != paths_new
|
140
|
+
Nanoc::Int::OutdatednessReasons::PathsModified
|
141
|
+
end
|
130
142
|
end
|
131
143
|
end
|
132
144
|
|
@@ -137,7 +149,12 @@ module Nanoc::Int
|
|
137
149
|
|
138
150
|
def apply(obj, outdatedness_checker)
|
139
151
|
mem = outdatedness_checker.action_provider.memory_for(obj)
|
152
|
+
if any_always_outdated?(mem)
|
153
|
+
Nanoc::Int::OutdatednessReasons::UsesAlwaysOutdatedFilter
|
154
|
+
end
|
155
|
+
end
|
140
156
|
|
157
|
+
def any_always_outdated?(mem)
|
141
158
|
mem
|
142
159
|
.select { |a| a.is_a?(Nanoc::Int::ProcessingActions::Filter) }
|
143
160
|
.map { |a| Nanoc::Filter.named(a.filter_name) }
|
@@ -36,19 +36,20 @@ module Nanoc
|
|
36
36
|
|
37
37
|
# @see Hash#[]
|
38
38
|
def [](key)
|
39
|
-
@context.dependency_tracker.bounce(unwrap, attributes:
|
39
|
+
@context.dependency_tracker.bounce(unwrap, attributes: [key])
|
40
40
|
unwrap.attributes[key]
|
41
41
|
end
|
42
42
|
|
43
43
|
# @return [Hash]
|
44
44
|
def attributes
|
45
|
+
# TODO: Refine dependencies
|
45
46
|
@context.dependency_tracker.bounce(unwrap, attributes: true)
|
46
47
|
unwrap.attributes
|
47
48
|
end
|
48
49
|
|
49
50
|
# @see Hash#fetch
|
50
51
|
def fetch(key, fallback = NONE, &_block)
|
51
|
-
@context.dependency_tracker.bounce(unwrap, attributes:
|
52
|
+
@context.dependency_tracker.bounce(unwrap, attributes: [key])
|
52
53
|
|
53
54
|
if unwrap.attributes.key?(key)
|
54
55
|
unwrap.attributes[key]
|
@@ -63,7 +64,7 @@ module Nanoc
|
|
63
64
|
|
64
65
|
# @see Hash#key?
|
65
66
|
def key?(key)
|
66
|
-
@context.dependency_tracker.bounce(unwrap, attributes:
|
67
|
+
@context.dependency_tracker.bounce(unwrap, attributes: [key])
|
67
68
|
unwrap.attributes.key?(key)
|
68
69
|
end
|
69
70
|
|
data/lib/nanoc/version.rb
CHANGED
@@ -58,6 +58,16 @@ describe Nanoc::Int::Props do
|
|
58
58
|
let(:props) { described_class.new(raw_content: true, attributes: true, compiled_content: true, path: true) }
|
59
59
|
it { is_expected.to be }
|
60
60
|
end
|
61
|
+
|
62
|
+
context 'attributes is empty list' do
|
63
|
+
let(:props) { described_class.new(attributes: []) }
|
64
|
+
it { is_expected.not_to be }
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'attributes is non-empty list' do
|
68
|
+
let(:props) { described_class.new(attributes: [:donkey]) }
|
69
|
+
it { is_expected.to be }
|
70
|
+
end
|
61
71
|
end
|
62
72
|
|
63
73
|
describe '#compiled_content?' do
|
@@ -135,6 +145,92 @@ describe Nanoc::Int::Props do
|
|
135
145
|
end
|
136
146
|
end
|
137
147
|
|
148
|
+
describe '#merge_attributes' do
|
149
|
+
let(:props_attrs_true) do
|
150
|
+
described_class.new(attributes: true)
|
151
|
+
end
|
152
|
+
|
153
|
+
let(:props_attrs_false) do
|
154
|
+
described_class.new(attributes: false)
|
155
|
+
end
|
156
|
+
|
157
|
+
let(:props_attrs_list_a) do
|
158
|
+
described_class.new(attributes: %i(donkey giraffe))
|
159
|
+
end
|
160
|
+
|
161
|
+
let(:props_attrs_list_b) do
|
162
|
+
described_class.new(attributes: %i(giraffe zebra))
|
163
|
+
end
|
164
|
+
|
165
|
+
subject { props.merge(other_props).attributes }
|
166
|
+
|
167
|
+
context 'false + false' do
|
168
|
+
let(:props) { props_attrs_false }
|
169
|
+
let(:other_props) { props_attrs_false }
|
170
|
+
|
171
|
+
it { is_expected.to be(false) }
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'false + true' do
|
175
|
+
let(:props) { props_attrs_false }
|
176
|
+
let(:other_props) { props_attrs_true }
|
177
|
+
|
178
|
+
it { is_expected.to be(true) }
|
179
|
+
end
|
180
|
+
|
181
|
+
context 'false + list' do
|
182
|
+
let(:props) { props_attrs_false }
|
183
|
+
let(:other_props) { props_attrs_list_a }
|
184
|
+
|
185
|
+
it { is_expected.to be_a(Set) }
|
186
|
+
it { is_expected.to match_array(%i(donkey giraffe)) }
|
187
|
+
end
|
188
|
+
|
189
|
+
context 'true + false' do
|
190
|
+
let(:props) { props_attrs_true }
|
191
|
+
let(:other_props) { props_attrs_false }
|
192
|
+
|
193
|
+
it { is_expected.to be(true) }
|
194
|
+
end
|
195
|
+
|
196
|
+
context 'true + true' do
|
197
|
+
let(:props) { props_attrs_true }
|
198
|
+
let(:other_props) { props_attrs_true }
|
199
|
+
|
200
|
+
it { is_expected.to be(true) }
|
201
|
+
end
|
202
|
+
|
203
|
+
context 'true + list' do
|
204
|
+
let(:props) { props_attrs_true }
|
205
|
+
let(:other_props) { props_attrs_list_a }
|
206
|
+
|
207
|
+
it { is_expected.to be(true) }
|
208
|
+
end
|
209
|
+
|
210
|
+
context 'list + false' do
|
211
|
+
let(:props) { props_attrs_list_a }
|
212
|
+
let(:other_props) { props_attrs_false }
|
213
|
+
|
214
|
+
it { is_expected.to be_a(Set) }
|
215
|
+
it { is_expected.to match_array(%i(donkey giraffe)) }
|
216
|
+
end
|
217
|
+
|
218
|
+
context 'list + true' do
|
219
|
+
let(:props) { props_attrs_list_a }
|
220
|
+
let(:other_props) { props_attrs_true }
|
221
|
+
|
222
|
+
it { is_expected.to be(true) }
|
223
|
+
end
|
224
|
+
|
225
|
+
context 'list + list' do
|
226
|
+
let(:props) { props_attrs_list_a }
|
227
|
+
let(:other_props) { props_attrs_list_b }
|
228
|
+
|
229
|
+
it { is_expected.to be_a(Set) }
|
230
|
+
it { is_expected.to match_array(%i(donkey giraffe zebra)) }
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
138
234
|
describe '#active' do
|
139
235
|
subject { props.active }
|
140
236
|
|
@@ -192,4 +192,76 @@ describe Nanoc::Int::DependencyStore do
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
end
|
195
|
+
|
196
|
+
describe '#record_dependency' do
|
197
|
+
context 'no props' do
|
198
|
+
subject { store.record_dependency(obj_a, obj_b) }
|
199
|
+
|
200
|
+
it 'records a dependency' do
|
201
|
+
expect { subject }
|
202
|
+
.to change { store.objects_causing_outdatedness_of(obj_a) }
|
203
|
+
.from([])
|
204
|
+
.to([obj_b])
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
context 'compiled content prop' do
|
209
|
+
subject { store.record_dependency(obj_a, obj_b, compiled_content: true) }
|
210
|
+
|
211
|
+
it 'records a dependency' do
|
212
|
+
expect { subject }
|
213
|
+
.to change { store.objects_causing_outdatedness_of(obj_a) }
|
214
|
+
.from([])
|
215
|
+
.to([obj_b])
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'records a dependency with the right props' do
|
219
|
+
subject
|
220
|
+
deps = store.dependencies_causing_outdatedness_of(obj_a)
|
221
|
+
|
222
|
+
expect(deps.first.props.attributes?).not_to be
|
223
|
+
expect(deps.first.props.compiled_content?).to be
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
context 'attribute prop (true)' do
|
228
|
+
subject { store.record_dependency(obj_a, obj_b, attributes: true) }
|
229
|
+
|
230
|
+
it 'records a dependency' do
|
231
|
+
expect { subject }
|
232
|
+
.to change { store.objects_causing_outdatedness_of(obj_a) }
|
233
|
+
.from([])
|
234
|
+
.to([obj_b])
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'records a dependency with the right props' do
|
238
|
+
subject
|
239
|
+
deps = store.dependencies_causing_outdatedness_of(obj_a)
|
240
|
+
|
241
|
+
expect(deps.first.props.attributes?).to be
|
242
|
+
expect(deps.first.props.attributes).to be
|
243
|
+
expect(deps.first.props.compiled_content?).not_to be
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
context 'attribute prop (true)' do
|
248
|
+
subject { store.record_dependency(obj_a, obj_b, attributes: [:giraffe]) }
|
249
|
+
|
250
|
+
it 'records a dependency' do
|
251
|
+
expect { subject }
|
252
|
+
.to change { store.objects_causing_outdatedness_of(obj_a) }
|
253
|
+
.from([])
|
254
|
+
.to([obj_b])
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'records a dependency with the right props' do
|
258
|
+
subject
|
259
|
+
deps = store.dependencies_causing_outdatedness_of(obj_a)
|
260
|
+
|
261
|
+
expect(deps.first.props.attributes?).to be
|
262
|
+
expect(deps.first.props.attributes).to match_array([:giraffe])
|
263
|
+
expect(deps.first.props.compiled_content?).not_to be
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
195
267
|
end
|
@@ -434,7 +434,7 @@ describe Nanoc::Int::Executor do
|
|
434
434
|
allow(dependency_tracker).to receive(:enter)
|
435
435
|
.with(layout, raw_content: true, attributes: false, compiled_content: false, path: false)
|
436
436
|
allow(dependency_tracker).to receive(:enter)
|
437
|
-
.with(layout, raw_content: false, attributes:
|
437
|
+
.with(layout, raw_content: false, attributes: [:bug], compiled_content: false, path: false)
|
438
438
|
allow(dependency_tracker).to receive(:exit)
|
439
439
|
subject
|
440
440
|
expect(snapshot_repo.get(rep, :last).string).to eq('head Gum Emperor foot')
|
@@ -101,7 +101,7 @@ describe Nanoc::Int::OutdatednessRules do
|
|
101
101
|
it { is_expected.not_to be }
|
102
102
|
end
|
103
103
|
|
104
|
-
context 'path' do
|
104
|
+
context 'path for last snapshot' do
|
105
105
|
let(:path) { 'foo.txt' }
|
106
106
|
|
107
107
|
before { item_rep.raw_paths = { last: [path] } }
|
@@ -115,6 +115,21 @@ describe Nanoc::Int::OutdatednessRules do
|
|
115
115
|
it { is_expected.not_to be }
|
116
116
|
end
|
117
117
|
end
|
118
|
+
|
119
|
+
context 'path for other snapshot' do
|
120
|
+
let(:path) { 'foo.txt' }
|
121
|
+
|
122
|
+
before { item_rep.raw_paths = { donkey: [path] } }
|
123
|
+
|
124
|
+
context 'not written' do
|
125
|
+
it { is_expected.to be }
|
126
|
+
end
|
127
|
+
|
128
|
+
context 'written' do
|
129
|
+
before { File.write(path, 'hello') }
|
130
|
+
it { is_expected.not_to be }
|
131
|
+
end
|
132
|
+
end
|
118
133
|
end
|
119
134
|
|
120
135
|
context 'ContentModified' do
|
@@ -318,11 +333,10 @@ describe Nanoc::Int::OutdatednessRules do
|
|
318
333
|
|
319
334
|
describe '#{Content,Attributes}Modified' do
|
320
335
|
subject do
|
321
|
-
# TODO: remove negation
|
322
336
|
[
|
323
337
|
Nanoc::Int::OutdatednessRules::ContentModified,
|
324
338
|
Nanoc::Int::OutdatednessRules::AttributesModified,
|
325
|
-
].map { |c|
|
339
|
+
].map { |c| !!c.instance.apply(new_obj, outdatedness_checker) } # rubocop:disable Style/DoubleNegation
|
326
340
|
end
|
327
341
|
|
328
342
|
let(:stored_obj) { raise 'override me' }
|
@@ -334,7 +348,7 @@ describe Nanoc::Int::OutdatednessRules do
|
|
334
348
|
|
335
349
|
context 'no checksum data' do
|
336
350
|
context 'not stored' do
|
337
|
-
it { is_expected.to eql([
|
351
|
+
it { is_expected.to eql([true, true]) }
|
338
352
|
end
|
339
353
|
|
340
354
|
context 'stored' do
|
@@ -342,16 +356,16 @@ describe Nanoc::Int::OutdatednessRules do
|
|
342
356
|
|
343
357
|
context 'but content changed afterwards' do
|
344
358
|
let(:new_obj) { klass.new('aaaaaaaa', {}, '/foo.md') }
|
345
|
-
it { is_expected.to eql([
|
359
|
+
it { is_expected.to eql([true, false]) }
|
346
360
|
end
|
347
361
|
|
348
362
|
context 'but attributes changed afterwards' do
|
349
363
|
let(:new_obj) { klass.new('a', { animal: 'donkey' }, '/foo.md') }
|
350
|
-
it { is_expected.to eql([
|
364
|
+
it { is_expected.to eql([false, true]) }
|
351
365
|
end
|
352
366
|
|
353
367
|
context 'and unchanged' do
|
354
|
-
it { is_expected.to eql([
|
368
|
+
it { is_expected.to eql([false, false]) }
|
355
369
|
end
|
356
370
|
end
|
357
371
|
end
|
@@ -361,7 +375,7 @@ describe Nanoc::Int::OutdatednessRules do
|
|
361
375
|
let(:new_obj) { stored_obj }
|
362
376
|
|
363
377
|
context 'not stored' do
|
364
|
-
it { is_expected.to eql([
|
378
|
+
it { is_expected.to eql([true, true]) }
|
365
379
|
end
|
366
380
|
|
367
381
|
context 'stored' do
|
@@ -369,11 +383,11 @@ describe Nanoc::Int::OutdatednessRules do
|
|
369
383
|
|
370
384
|
context 'but checksum data afterwards' do
|
371
385
|
let(:new_obj) { klass.new('a', {}, '/foo.md', checksum_data: 'cs-data-new') }
|
372
|
-
it { is_expected.to eql([
|
386
|
+
it { is_expected.to eql([true, true]) }
|
373
387
|
end
|
374
388
|
|
375
389
|
context 'and unchanged' do
|
376
|
-
it { is_expected.to eql([
|
390
|
+
it { is_expected.to eql([false, false]) }
|
377
391
|
end
|
378
392
|
end
|
379
393
|
end
|
@@ -383,7 +397,7 @@ describe Nanoc::Int::OutdatednessRules do
|
|
383
397
|
let(:new_obj) { stored_obj }
|
384
398
|
|
385
399
|
context 'not stored' do
|
386
|
-
it { is_expected.to eql([
|
400
|
+
it { is_expected.to eql([true, true]) }
|
387
401
|
end
|
388
402
|
|
389
403
|
context 'stored' do
|
@@ -391,11 +405,11 @@ describe Nanoc::Int::OutdatednessRules do
|
|
391
405
|
|
392
406
|
context 'but checksum data afterwards' do
|
393
407
|
let(:new_obj) { klass.new('a', {}, '/foo.md', content_checksum_data: 'cs-data-new') }
|
394
|
-
it { is_expected.to eql([
|
408
|
+
it { is_expected.to eql([true, false]) }
|
395
409
|
end
|
396
410
|
|
397
411
|
context 'and unchanged' do
|
398
|
-
it { is_expected.to eql([
|
412
|
+
it { is_expected.to eql([false, false]) }
|
399
413
|
end
|
400
414
|
end
|
401
415
|
end
|
@@ -405,7 +419,7 @@ describe Nanoc::Int::OutdatednessRules do
|
|
405
419
|
let(:new_obj) { stored_obj }
|
406
420
|
|
407
421
|
context 'not stored' do
|
408
|
-
it { is_expected.to eql([
|
422
|
+
it { is_expected.to eql([true, true]) }
|
409
423
|
end
|
410
424
|
|
411
425
|
context 'stored' do
|
@@ -413,11 +427,11 @@ describe Nanoc::Int::OutdatednessRules do
|
|
413
427
|
|
414
428
|
context 'but checksum data afterwards' do
|
415
429
|
let(:new_obj) { klass.new('a', {}, '/foo.md', attributes_checksum_data: 'cs-data-new') }
|
416
|
-
it { is_expected.to eql([
|
430
|
+
it { is_expected.to eql([false, true]) }
|
417
431
|
end
|
418
432
|
|
419
433
|
context 'and unchanged' do
|
420
|
-
it { is_expected.to eql([
|
434
|
+
it { is_expected.to eql([false, false]) }
|
421
435
|
end
|
422
436
|
end
|
423
437
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
describe 'GH-1134', site: true, stdio: true do
|
2
|
+
before do
|
3
|
+
File.write('content/foo.txt', 'asdf')
|
4
|
+
|
5
|
+
File.write('Rules', <<EOS)
|
6
|
+
compile '/**/*' do
|
7
|
+
write '/first.html'
|
8
|
+
filter :erb
|
9
|
+
write '/last.html'
|
10
|
+
end
|
11
|
+
EOS
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'detects missing output file of non-default rep' do
|
15
|
+
Nanoc::CLI.run(%w(compile))
|
16
|
+
expect(File.file?('output/first.html')).to be
|
17
|
+
expect(File.file?('output/last.html')).to be
|
18
|
+
|
19
|
+
FileUtils.rm_f('output/first.html')
|
20
|
+
expect(File.file?('output/first.html')).not_to be
|
21
|
+
expect(File.file?('output/last.html')).to be
|
22
|
+
|
23
|
+
Nanoc::CLI.run(%w(compile))
|
24
|
+
expect(File.file?('output/first.html')).to be
|
25
|
+
expect(File.file?('output/last.html')).to be
|
26
|
+
end
|
27
|
+
end
|
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.7.
|
4
|
+
version: 4.7.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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -468,6 +468,7 @@ files:
|
|
468
468
|
- spec/nanoc/regressions/gh_1102_spec.rb
|
469
469
|
- spec/nanoc/regressions/gh_1107_spec.rb
|
470
470
|
- spec/nanoc/regressions/gh_1130_spec.rb
|
471
|
+
- spec/nanoc/regressions/gh_1134_spec.rb
|
471
472
|
- spec/nanoc/regressions/gh_761_spec.rb
|
472
473
|
- spec/nanoc/regressions/gh_767_spec.rb
|
473
474
|
- spec/nanoc/regressions/gh_769_spec.rb
|