nanoc 4.4.0 → 4.4.1
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 +4 -4
- data/NEWS.md +11 -1
- data/Rakefile +1 -1
- data/lib/nanoc/base/entities/directed_graph.rb +17 -3
- data/lib/nanoc/base/repos/dependency_store.rb +76 -4
- data/lib/nanoc/base/services/dependency_tracker.rb +17 -10
- data/lib/nanoc/base/services/executor.rb +1 -1
- data/lib/nanoc/base/services/filter.rb +1 -1
- data/lib/nanoc/base/views/item_rep_view.rb +3 -3
- data/lib/nanoc/base/views/mixins/document_view_mixin.rb +5 -4
- data/lib/nanoc/cli/commands/show-data.rb +22 -4
- data/lib/nanoc/cli/commands/view.rb +1 -1
- data/lib/nanoc/helpers/capturing.rb +1 -1
- data/lib/nanoc/helpers/rendering.rb +1 -1
- data/lib/nanoc/version.rb +1 -1
- data/test/base/test_directed_graph.rb +45 -2
- data/test/filters/test_xsl.rb +38 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2b9d8ce47580844e86624db8a37b07a0cb016a8
|
4
|
+
data.tar.gz: 378d2207727e627067221f9aeb53fa6cbd75401e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5da522b136025a8c2a114b3e59197879290f57d1879998dafbd2130ed3b1ed1374034d524a25d17c7143f5058b4cfed06558fccedaed71deeb140f00130f30d
|
7
|
+
data.tar.gz: b4f5e54d978ea6da8b805adfaa24e5f143e4ad6d3ffb7ec3248ceaabe5f9b35ffac0a53a0332ac3d4ee25ebe6a699c20a43022902618ca153481f0ba2f9427b0
|
data/Gemfile.lock
CHANGED
@@ -9,7 +9,7 @@ GIT
|
|
9
9
|
PATH
|
10
10
|
remote: .
|
11
11
|
specs:
|
12
|
-
nanoc (4.4.
|
12
|
+
nanoc (4.4.1)
|
13
13
|
cri (~> 2.3)
|
14
14
|
hamster (~> 3.0)
|
15
15
|
parallel (~> 1.9)
|
@@ -224,10 +224,10 @@ GEM
|
|
224
224
|
inflecto (0.0.2)
|
225
225
|
ipaddress (0.8.3)
|
226
226
|
json (2.0.2)
|
227
|
-
kramdown (1.
|
227
|
+
kramdown (1.13.0)
|
228
228
|
less (2.6.0)
|
229
229
|
commonjs (~> 0.2.7)
|
230
|
-
libv8 (3.16.14.
|
230
|
+
libv8 (3.16.14.17)
|
231
231
|
listen (3.1.5)
|
232
232
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
233
233
|
rb-inotify (~> 0.9, >= 0.9.7)
|
@@ -255,7 +255,7 @@ GEM
|
|
255
255
|
shellany (~> 0.0)
|
256
256
|
pandoc-ruby (2.0.1)
|
257
257
|
parallel (1.9.0)
|
258
|
-
parser (2.3.
|
258
|
+
parser (2.3.2.0)
|
259
259
|
ast (~> 2.2)
|
260
260
|
posix-spawn (0.3.12)
|
261
261
|
powerpack (0.1.1)
|
data/NEWS.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
-
## 4.4.
|
3
|
+
## 4.4.1 (2016-11-21)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Fixed an issue where the `xsl` filter would not generate a correct dependency on the layout (#996)
|
8
|
+
|
9
|
+
Enhancements:
|
10
|
+
|
11
|
+
* Made `view` command use index filenames specified in the `index_filenames` site configuration attribute (#998)
|
12
|
+
|
13
|
+
## 4.4.0 (2016-11-19)
|
4
14
|
|
5
15
|
Features:
|
6
16
|
|
data/Rakefile
CHANGED
@@ -41,6 +41,8 @@ module Nanoc::Int
|
|
41
41
|
@from_graph = {}
|
42
42
|
@to_graph = {}
|
43
43
|
|
44
|
+
@edge_props = {}
|
45
|
+
|
44
46
|
@roots = Set.new(@vertices.keys)
|
45
47
|
|
46
48
|
invalidate_caches
|
@@ -55,7 +57,7 @@ module Nanoc::Int
|
|
55
57
|
# @param to Vertex where the edge should end
|
56
58
|
#
|
57
59
|
# @return [void]
|
58
|
-
def add_edge(from, to)
|
60
|
+
def add_edge(from, to, props: nil)
|
59
61
|
add_vertex(from)
|
60
62
|
add_vertex(to)
|
61
63
|
|
@@ -65,6 +67,10 @@ module Nanoc::Int
|
|
65
67
|
@to_graph[to] ||= Set.new
|
66
68
|
@to_graph[to] << from
|
67
69
|
|
70
|
+
if props
|
71
|
+
@edge_props[[from, to]] = props
|
72
|
+
end
|
73
|
+
|
68
74
|
@roots.delete(to)
|
69
75
|
|
70
76
|
invalidate_caches
|
@@ -87,6 +93,8 @@ module Nanoc::Int
|
|
87
93
|
@to_graph[to] ||= Set.new
|
88
94
|
@to_graph[to].delete(from)
|
89
95
|
|
96
|
+
@edge_props.delete([from, to])
|
97
|
+
|
90
98
|
@roots.add(to) if @to_graph[to].empty?
|
91
99
|
|
92
100
|
invalidate_caches
|
@@ -119,6 +127,7 @@ module Nanoc::Int
|
|
119
127
|
|
120
128
|
@from_graph[from].each do |to|
|
121
129
|
@to_graph[to].delete(from)
|
130
|
+
@edge_props.delete([from, to])
|
122
131
|
@roots.add(to) if @to_graph[to].empty?
|
123
132
|
end
|
124
133
|
@from_graph.delete(from)
|
@@ -134,6 +143,7 @@ module Nanoc::Int
|
|
134
143
|
|
135
144
|
@to_graph[to].each do |from|
|
136
145
|
@from_graph[from].delete(to)
|
146
|
+
@edge_props.delete([from, to])
|
137
147
|
end
|
138
148
|
@to_graph.delete(to)
|
139
149
|
@roots.add(to)
|
@@ -196,6 +206,10 @@ module Nanoc::Int
|
|
196
206
|
@successors[from] ||= recursively_find_vertices(from, :direct_successors_of)
|
197
207
|
end
|
198
208
|
|
209
|
+
def props_for(from, to)
|
210
|
+
@edge_props[[from, to]]
|
211
|
+
end
|
212
|
+
|
199
213
|
# @return [Array] The list of all vertices in this graph.
|
200
214
|
def vertices
|
201
215
|
@vertices.keys.sort_by { |v| @vertices[v] }
|
@@ -208,8 +222,8 @@ module Nanoc::Int
|
|
208
222
|
def edges
|
209
223
|
result = []
|
210
224
|
@vertices.each_pair do |v1, i1|
|
211
|
-
direct_successors_of(v1).map { |v2| @vertices[v2] }.each do |i2|
|
212
|
-
result << [i1, i2]
|
225
|
+
direct_successors_of(v1).map { |v2| [@vertices[v2], v2] }.each do |i2, v2|
|
226
|
+
result << [i1, i2, @edge_props[[v1, v2]]]
|
213
227
|
end
|
214
228
|
end
|
215
229
|
result
|
@@ -1,6 +1,50 @@
|
|
1
1
|
module Nanoc::Int
|
2
2
|
# @api private
|
3
3
|
class DependencyStore < ::Nanoc::Int::Store
|
4
|
+
# A dependency between two items/layouts.
|
5
|
+
class Dependency
|
6
|
+
include Nanoc::Int::ContractsSupport
|
7
|
+
|
8
|
+
contract C::None => C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]
|
9
|
+
attr_reader :from
|
10
|
+
|
11
|
+
contract C::None => C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]
|
12
|
+
attr_reader :to
|
13
|
+
|
14
|
+
contract C::Maybe[C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]], C::Maybe[C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]], C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C::Bool], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
|
15
|
+
def initialize(from, to, raw_content:, attributes:, compiled_content:, path:)
|
16
|
+
@from = from
|
17
|
+
@to = to
|
18
|
+
|
19
|
+
@raw_content = raw_content
|
20
|
+
@attributes = attributes
|
21
|
+
@compiled_content = compiled_content
|
22
|
+
@path = path
|
23
|
+
end
|
24
|
+
|
25
|
+
contract C::None => C::Bool
|
26
|
+
def raw_content?
|
27
|
+
@raw_content
|
28
|
+
end
|
29
|
+
|
30
|
+
contract C::None => C::Bool
|
31
|
+
def attributes?
|
32
|
+
@attributes
|
33
|
+
end
|
34
|
+
|
35
|
+
contract C::None => C::Bool
|
36
|
+
def compiled_content?
|
37
|
+
@compiled_content
|
38
|
+
end
|
39
|
+
|
40
|
+
contract C::None => C::Bool
|
41
|
+
def path?
|
42
|
+
@path
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
include Nanoc::Int::ContractsSupport
|
47
|
+
|
4
48
|
# @return [Array<Nanoc::Int::Item, Nanoc::Int::Layout>]
|
5
49
|
attr_accessor :objects
|
6
50
|
|
@@ -12,6 +56,22 @@ module Nanoc::Int
|
|
12
56
|
@graph = Nanoc::Int::DirectedGraph.new([nil] + @objects)
|
13
57
|
end
|
14
58
|
|
59
|
+
contract C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Layout] => C::ArrayOf[Dependency]
|
60
|
+
def dependencies_causing_outdatedness_of(object)
|
61
|
+
objects_causing_outdatedness_of(object).map do |other_object|
|
62
|
+
props = @graph.props_for(other_object, object) || {}
|
63
|
+
|
64
|
+
Dependency.new(
|
65
|
+
other_object,
|
66
|
+
object,
|
67
|
+
raw_content: props.fetch(:raw_content, false),
|
68
|
+
attributes: props.fetch(:attributes, false),
|
69
|
+
compiled_content: props.fetch(:compiled_content, false),
|
70
|
+
path: props.fetch(:path, false),
|
71
|
+
)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
15
75
|
# Returns the direct dependencies for the given object.
|
16
76
|
#
|
17
77
|
# The direct dependencies of the given object include the items and
|
@@ -50,6 +110,7 @@ module Nanoc::Int
|
|
50
110
|
@graph.direct_successors_of(object).compact
|
51
111
|
end
|
52
112
|
|
113
|
+
contract C::Maybe[C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]], C::Maybe[C::Or[Nanoc::Int::Item, Nanoc::Int::Layout]], C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C::Bool], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
|
53
114
|
# Records a dependency from `src` to `dst` in the dependency graph. When
|
54
115
|
# `dst` is oudated, `src` will also become outdated.
|
55
116
|
#
|
@@ -61,9 +122,13 @@ module Nanoc::Int
|
|
61
122
|
# outdated if the destination is outdated
|
62
123
|
#
|
63
124
|
# @return [void]
|
64
|
-
def record_dependency(src, dst)
|
125
|
+
def record_dependency(src, dst, raw_content: false, attributes: false, compiled_content: false, path: false)
|
126
|
+
existing_props = @graph.props_for(dst, src) || {}
|
127
|
+
new_props = { raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path }
|
128
|
+
props = merge_props(existing_props, new_props)
|
129
|
+
|
65
130
|
# Warning! dst and src are *reversed* here!
|
66
|
-
@graph.add_edge(dst, src) unless src == dst
|
131
|
+
@graph.add_edge(dst, src, props: props) unless src == dst
|
67
132
|
end
|
68
133
|
|
69
134
|
# Empties the list of dependencies for the given object. This is necessary
|
@@ -81,6 +146,13 @@ module Nanoc::Int
|
|
81
146
|
|
82
147
|
protected
|
83
148
|
|
149
|
+
def merge_props(p1, p2)
|
150
|
+
keys = (p1.keys + p2.keys).uniq
|
151
|
+
keys.each_with_object({}) do |key, memo|
|
152
|
+
memo[key] = p1.fetch(key, false) || p2.fetch(key, false)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
84
156
|
def data
|
85
157
|
{
|
86
158
|
edges: @graph.edges,
|
@@ -99,10 +171,10 @@ module Nanoc::Int
|
|
99
171
|
|
100
172
|
# Load edges
|
101
173
|
new_data[:edges].each do |edge|
|
102
|
-
from_index, to_index = *edge
|
174
|
+
from_index, to_index, props = *edge
|
103
175
|
from = from_index && previous_objects[from_index]
|
104
176
|
to = to_index && previous_objects[to_index]
|
105
|
-
@graph.add_edge(from, to)
|
177
|
+
@graph.add_edge(from, to, props: props)
|
106
178
|
end
|
107
179
|
|
108
180
|
# Record dependency from all items on new items
|
@@ -4,16 +4,16 @@ module Nanoc::Int
|
|
4
4
|
class Null
|
5
5
|
include Nanoc::Int::ContractsSupport
|
6
6
|
|
7
|
-
contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout] => C::Any
|
8
|
-
def enter(_obj)
|
7
|
+
contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout], C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C::Bool], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
|
8
|
+
def enter(_obj, raw_content: false, attributes: false, compiled_content: false, path: false)
|
9
9
|
end
|
10
10
|
|
11
11
|
contract C::None => C::Any
|
12
12
|
def exit
|
13
13
|
end
|
14
14
|
|
15
|
-
contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout] => C::Any
|
16
|
-
def bounce(_obj)
|
15
|
+
contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout], C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C::Bool], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
|
16
|
+
def bounce(_obj, raw_content: false, attributes: false, compiled_content: false, path: false)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -24,11 +24,18 @@ module Nanoc::Int
|
|
24
24
|
@stack = []
|
25
25
|
end
|
26
26
|
|
27
|
-
contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout] => C::Any
|
28
|
-
def enter(obj)
|
27
|
+
contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout], C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C::Bool], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
|
28
|
+
def enter(obj, raw_content: false, attributes: false, compiled_content: false, path: false)
|
29
29
|
unless @stack.empty?
|
30
30
|
Nanoc::Int::NotificationCenter.post(:dependency_created, @stack.last, obj)
|
31
|
-
@dependency_store.record_dependency(
|
31
|
+
@dependency_store.record_dependency(
|
32
|
+
@stack.last,
|
33
|
+
obj,
|
34
|
+
raw_content: raw_content,
|
35
|
+
attributes: attributes,
|
36
|
+
compiled_content: compiled_content,
|
37
|
+
path: path,
|
38
|
+
)
|
32
39
|
end
|
33
40
|
|
34
41
|
@stack.push(obj)
|
@@ -39,9 +46,9 @@ module Nanoc::Int
|
|
39
46
|
@stack.pop
|
40
47
|
end
|
41
48
|
|
42
|
-
contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout] => C::Any
|
43
|
-
def bounce(obj)
|
44
|
-
enter(obj)
|
49
|
+
contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout], C::KeywordArgs[raw_content: C::Optional[C::Bool], attributes: C::Optional[C::Bool], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]] => C::Any
|
50
|
+
def bounce(obj, raw_content: false, attributes: false, compiled_content: false, path: false)
|
51
|
+
enter(obj, raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
|
45
52
|
exit
|
46
53
|
end
|
47
54
|
end
|
@@ -195,7 +195,7 @@ module Nanoc
|
|
195
195
|
|
196
196
|
# Notify
|
197
197
|
dependency_tracker = @assigns[:item]._context.dependency_tracker
|
198
|
-
items.each { |item| dependency_tracker.bounce(item) }
|
198
|
+
items.each { |item| dependency_tracker.bounce(item, compiled_content: true) }
|
199
199
|
|
200
200
|
# Raise unmet dependency error if necessary
|
201
201
|
items.each do |item|
|
@@ -42,7 +42,7 @@ module Nanoc
|
|
42
42
|
#
|
43
43
|
# @return [String] The content at the given snapshot.
|
44
44
|
def compiled_content(snapshot: nil)
|
45
|
-
@context.dependency_tracker.bounce(unwrap.item)
|
45
|
+
@context.dependency_tracker.bounce(unwrap.item, compiled_content: true)
|
46
46
|
@item_rep.compiled_content(snapshot: snapshot)
|
47
47
|
end
|
48
48
|
|
@@ -56,7 +56,7 @@ module Nanoc
|
|
56
56
|
#
|
57
57
|
# @return [String] The item rep’s path.
|
58
58
|
def path(snapshot: :last)
|
59
|
-
@context.dependency_tracker.bounce(unwrap.item)
|
59
|
+
@context.dependency_tracker.bounce(unwrap.item, path: true)
|
60
60
|
@item_rep.path(snapshot: snapshot)
|
61
61
|
end
|
62
62
|
|
@@ -69,7 +69,7 @@ module Nanoc
|
|
69
69
|
|
70
70
|
# @api private
|
71
71
|
def raw_path(snapshot: :last)
|
72
|
-
@context.dependency_tracker.bounce(unwrap.item)
|
72
|
+
@context.dependency_tracker.bounce(unwrap.item, path: true)
|
73
73
|
@item_rep.raw_path(snapshot: snapshot)
|
74
74
|
end
|
75
75
|
|
@@ -36,19 +36,19 @@ module Nanoc
|
|
36
36
|
|
37
37
|
# @see Hash#[]
|
38
38
|
def [](key)
|
39
|
-
@context.dependency_tracker.bounce(unwrap)
|
39
|
+
@context.dependency_tracker.bounce(unwrap, attributes: true)
|
40
40
|
unwrap.attributes[key]
|
41
41
|
end
|
42
42
|
|
43
43
|
# @return [Hash]
|
44
44
|
def attributes
|
45
|
-
@context.dependency_tracker.bounce(unwrap)
|
45
|
+
@context.dependency_tracker.bounce(unwrap, attributes: true)
|
46
46
|
unwrap.attributes
|
47
47
|
end
|
48
48
|
|
49
49
|
# @see Hash#fetch
|
50
50
|
def fetch(key, fallback = NONE, &_block)
|
51
|
-
@context.dependency_tracker.bounce(unwrap)
|
51
|
+
@context.dependency_tracker.bounce(unwrap, attributes: true)
|
52
52
|
|
53
53
|
if unwrap.attributes.key?(key)
|
54
54
|
unwrap.attributes[key]
|
@@ -63,7 +63,7 @@ module Nanoc
|
|
63
63
|
|
64
64
|
# @see Hash#key?
|
65
65
|
def key?(key)
|
66
|
-
@context.dependency_tracker.bounce(unwrap)
|
66
|
+
@context.dependency_tracker.bounce(unwrap, attributes: true)
|
67
67
|
unwrap.attributes.key?(key)
|
68
68
|
end
|
69
69
|
|
@@ -74,6 +74,7 @@ module Nanoc
|
|
74
74
|
|
75
75
|
# @api private
|
76
76
|
def raw_content
|
77
|
+
@context.dependency_tracker.bounce(unwrap, raw_content: true)
|
77
78
|
unwrap.content.string
|
78
79
|
end
|
79
80
|
|
@@ -62,11 +62,23 @@ module Nanoc::CLI::Commands
|
|
62
62
|
def print_item_dependencies(items, dependency_store)
|
63
63
|
print_header('Item dependencies')
|
64
64
|
|
65
|
+
puts 'Legend:'
|
66
|
+
puts ' r = dependency on raw content'
|
67
|
+
puts ' a = dependency on attributes'
|
68
|
+
puts ' c = dependency on compiled content'
|
69
|
+
puts ' p = dependency on the path'
|
70
|
+
puts
|
71
|
+
|
65
72
|
sorted_with_prev(items) do |item, prev|
|
66
73
|
puts if prev
|
67
74
|
puts "item #{item.identifier} depends on:"
|
68
|
-
|
69
|
-
|
75
|
+
dependencies =
|
76
|
+
dependency_store
|
77
|
+
.dependencies_causing_outdatedness_of(item)
|
78
|
+
.sort_by { |dep| dep.from ? dep.from.identifier : '' }
|
79
|
+
dependencies.each do |dep|
|
80
|
+
pred = dep.from
|
81
|
+
|
70
82
|
type =
|
71
83
|
case pred
|
72
84
|
when Nanoc::Int::Layout
|
@@ -77,13 +89,19 @@ module Nanoc::CLI::Commands
|
|
77
89
|
'item'
|
78
90
|
end
|
79
91
|
|
92
|
+
props = ''
|
93
|
+
props << (dep.raw_content? ? 'r' : '_')
|
94
|
+
props << (dep.attributes? ? 'a' : '_')
|
95
|
+
props << (dep.compiled_content? ? 'c' : '_')
|
96
|
+
props << (dep.path? ? 'p' : '_')
|
97
|
+
|
80
98
|
if pred
|
81
|
-
puts " [ #{format '%6s', type} ] #{pred.identifier}"
|
99
|
+
puts " [ #{format '%6s', type} ] (#{props}) #{pred.identifier}"
|
82
100
|
else
|
83
101
|
puts ' ( removed item )'
|
84
102
|
end
|
85
103
|
end
|
86
|
-
puts ' (nothing)' if
|
104
|
+
puts ' (nothing)' if dependencies.empty?
|
87
105
|
end
|
88
106
|
end
|
89
107
|
|
@@ -46,7 +46,7 @@ module Nanoc::CLI::Commands
|
|
46
46
|
use Rack::Head
|
47
47
|
use Adsf::Rack::IndexFileFinder,
|
48
48
|
root: site.config[:output_dir],
|
49
|
-
index_filenames:
|
49
|
+
index_filenames: site.config[:index_filenames]
|
50
50
|
run Rack::File.new(site.config[:output_dir])
|
51
51
|
end.to_app
|
52
52
|
|
@@ -64,7 +64,7 @@ module Nanoc::Helpers
|
|
64
64
|
# Create dependency
|
65
65
|
if @item.nil? || item != @item.unwrap
|
66
66
|
dependency_tracker = @config._context.dependency_tracker
|
67
|
-
dependency_tracker.bounce(item.unwrap)
|
67
|
+
dependency_tracker.bounce(item.unwrap, compiled_content: true)
|
68
68
|
|
69
69
|
unless rep.compiled?
|
70
70
|
Fiber.yield(Nanoc::Int::Errors::UnmetDependency.new(rep))
|
@@ -20,7 +20,7 @@ module Nanoc::Helpers
|
|
20
20
|
|
21
21
|
# Visit
|
22
22
|
dependency_tracker = @config._context.dependency_tracker
|
23
|
-
dependency_tracker.bounce(layout)
|
23
|
+
dependency_tracker.bounce(layout, raw_content: true)
|
24
24
|
|
25
25
|
# Capture content, if any
|
26
26
|
captured_content = block_given? ? capture(&block) : nil
|
data/lib/nanoc/version.rb
CHANGED
@@ -44,7 +44,7 @@ class Nanoc::Int::DirectedGraphTest < Nanoc::TestCase
|
|
44
44
|
graph.add_edge(1, 2)
|
45
45
|
graph.add_edge(2, 3)
|
46
46
|
|
47
|
-
assert_equal [[0, 1], [1, 2]], graph.edges.sort
|
47
|
+
assert_equal [[0, 1, nil], [1, 2, nil]], graph.edges.sort
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_edges_with_new_vertices
|
@@ -55,7 +55,50 @@ class Nanoc::Int::DirectedGraphTest < Nanoc::TestCase
|
|
55
55
|
graph.add_edge(3, 2)
|
56
56
|
assert_equal [1, 2, 3], graph.vertices
|
57
57
|
|
58
|
-
assert_equal [[0, 1], [2, 1]], graph.edges.sort
|
58
|
+
assert_equal [[0, 1, nil], [2, 1, nil]], graph.edges.sort
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_edge_with_props
|
62
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
63
|
+
graph.add_edge(1, 2, props: { donkey: 14 })
|
64
|
+
graph.add_edge(2, 3, props: { giraffe: 3 })
|
65
|
+
|
66
|
+
assert_equal [[0, 1, { donkey: 14 }], [1, 2, { giraffe: 3 }]], graph.edges.sort
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_props_for
|
70
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3, 4])
|
71
|
+
graph.add_edge(1, 2, props: { donkey: 14 })
|
72
|
+
graph.add_edge(2, 3, props: { giraffe: 3 })
|
73
|
+
graph.add_edge(3, 4)
|
74
|
+
|
75
|
+
assert_equal({ donkey: 14 }, graph.props_for(1, 2))
|
76
|
+
assert_equal({ giraffe: 3 }, graph.props_for(2, 3))
|
77
|
+
assert_equal(nil, graph.props_for(3, 4))
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_props_for_with_deleted_edge
|
81
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2])
|
82
|
+
graph.add_edge(1, 2, props: { donkey: 14 })
|
83
|
+
graph.delete_edge(1, 2)
|
84
|
+
|
85
|
+
assert_equal(nil, graph.props_for(1, 2))
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_props_for_with_deleted_edges_from
|
89
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2])
|
90
|
+
graph.add_edge(1, 2, props: { donkey: 14 })
|
91
|
+
graph.delete_edges_from(1)
|
92
|
+
|
93
|
+
assert_equal(nil, graph.props_for(1, 2))
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_props_for_with_deleted_edges_to
|
97
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2])
|
98
|
+
graph.add_edge(1, 2, props: { donkey: 14 })
|
99
|
+
graph.delete_edges_to(2)
|
100
|
+
|
101
|
+
assert_equal(nil, graph.props_for(1, 2))
|
59
102
|
end
|
60
103
|
|
61
104
|
def test_add_edge
|
data/test/filters/test_xsl.rb
CHANGED
@@ -81,13 +81,33 @@ EOS
|
|
81
81
|
|
82
82
|
SAMPLE_XML_OUT_WITH_OMIT_XML_DECL = %r{\A<html>\s*<head>\s*<title>My Report</title>\s*</head>\s*<body>\s*<h1>My Report</h1>\s*</body>\s*</html>\s*\Z}m
|
83
83
|
|
84
|
+
def setup
|
85
|
+
super
|
86
|
+
|
87
|
+
@dependency_store = Nanoc::Int::DependencyStore.new([])
|
88
|
+
@dependency_tracker = Nanoc::Int::DependencyTracker.new(@dependency_store)
|
89
|
+
|
90
|
+
@base_item = Nanoc::Int::Item.new('base', {}, '/base.md')
|
91
|
+
|
92
|
+
@dependency_tracker.enter(@base_item)
|
93
|
+
end
|
94
|
+
|
95
|
+
def new_view_context
|
96
|
+
Nanoc::ViewContext.new(
|
97
|
+
reps: :__irrelevat_reps,
|
98
|
+
items: :__irrelevat_items,
|
99
|
+
dependency_tracker: @dependency_tracker,
|
100
|
+
compiler: :__irrelevat_compiler,
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
84
104
|
def test_filter_as_layout
|
85
105
|
if_have 'nokogiri' do
|
86
106
|
# Create our data objects
|
87
107
|
item = Nanoc::Int::Item.new(SAMPLE_XML_IN, {}, '/content/')
|
88
|
-
item = Nanoc::ItemWithRepsView.new(item,
|
108
|
+
item = Nanoc::ItemWithRepsView.new(item, new_view_context)
|
89
109
|
layout = Nanoc::Int::Layout.new(SAMPLE_XSL, {}, '/layout/')
|
90
|
-
layout = Nanoc::LayoutView.new(layout,
|
110
|
+
layout = Nanoc::LayoutView.new(layout, new_view_context)
|
91
111
|
|
92
112
|
# Create an instance of the filter
|
93
113
|
assigns = {
|
@@ -100,6 +120,10 @@ EOS
|
|
100
120
|
# Run the filter and validate the results
|
101
121
|
result = filter.setup_and_run(layout.raw_content)
|
102
122
|
assert_match SAMPLE_XML_OUT, result
|
123
|
+
|
124
|
+
# Verify dependencies
|
125
|
+
dep = @dependency_store.dependencies_causing_outdatedness_of(@base_item)[0]
|
126
|
+
refute_nil dep
|
103
127
|
end
|
104
128
|
end
|
105
129
|
|
@@ -107,9 +131,9 @@ EOS
|
|
107
131
|
if_have 'nokogiri' do
|
108
132
|
# Create our data objects
|
109
133
|
item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_PARAMS, {}, '/content/')
|
110
|
-
item = Nanoc::ItemWithRepsView.new(item,
|
134
|
+
item = Nanoc::ItemWithRepsView.new(item, new_view_context)
|
111
135
|
layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_PARAMS, {}, '/layout/')
|
112
|
-
layout = Nanoc::LayoutView.new(layout,
|
136
|
+
layout = Nanoc::LayoutView.new(layout, new_view_context)
|
113
137
|
|
114
138
|
# Create an instance of the filter
|
115
139
|
assigns = {
|
@@ -122,6 +146,10 @@ EOS
|
|
122
146
|
# Run the filter and validate the results
|
123
147
|
result = filter.setup_and_run(layout.raw_content, foo: 'bar')
|
124
148
|
assert_match SAMPLE_XML_OUT_WITH_PARAMS, result
|
149
|
+
|
150
|
+
# Verify dependencies
|
151
|
+
dep = @dependency_store.dependencies_causing_outdatedness_of(@base_item)[0]
|
152
|
+
refute_nil dep
|
125
153
|
end
|
126
154
|
end
|
127
155
|
|
@@ -129,9 +157,9 @@ EOS
|
|
129
157
|
if_have 'nokogiri' do
|
130
158
|
# Create our data objects
|
131
159
|
item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_OMIT_XML_DECL, {}, '/content/')
|
132
|
-
item = Nanoc::ItemWithRepsView.new(item,
|
160
|
+
item = Nanoc::ItemWithRepsView.new(item, new_view_context)
|
133
161
|
layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_OMIT_XML_DECL, {}, '/layout/')
|
134
|
-
layout = Nanoc::LayoutView.new(layout,
|
162
|
+
layout = Nanoc::LayoutView.new(layout, new_view_context)
|
135
163
|
|
136
164
|
# Create an instance of the filter
|
137
165
|
assigns = {
|
@@ -144,6 +172,10 @@ EOS
|
|
144
172
|
# Run the filter and validate the results
|
145
173
|
result = filter.setup_and_run(layout.raw_content)
|
146
174
|
assert_match SAMPLE_XML_OUT_WITH_OMIT_XML_DECL, result
|
175
|
+
|
176
|
+
# Verify dependencies
|
177
|
+
dep = @dependency_store.dependencies_causing_outdatedness_of(@base_item)[0]
|
178
|
+
refute_nil dep
|
147
179
|
end
|
148
180
|
end
|
149
181
|
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.4.
|
4
|
+
version: 4.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|