nanoc-core 4.14.7 → 4.14.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 +4 -4
- data/lib/nanoc/core/code_snippet.rb +1 -1
- data/lib/nanoc/core/configuration.rb +1 -1
- data/lib/nanoc/core/context.rb +1 -2
- data/lib/nanoc/core/directed_graph.rb +11 -63
- data/lib/nanoc/core/item.rb +1 -1
- data/lib/nanoc/core/item_collection.rb +1 -1
- data/lib/nanoc/core/item_rep.rb +1 -1
- data/lib/nanoc/core/layout.rb +1 -1
- data/lib/nanoc/core/layout_collection.rb +1 -1
- data/lib/nanoc/core/mutable_document_view_mixin.rb +1 -2
- data/lib/nanoc/core/outdatedness_checker.rb +1 -1
- data/lib/nanoc/core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0211c060faacb014851580a92bafd7ab56e576541a094bb902392ea9b2ba2376
|
|
4
|
+
data.tar.gz: 2db3ce08a6f9c9f45169febe922302f0b239442cadc3c60e0801b2883d3ea714
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4bbcdbb0f02ee56c56e282f18612eef792bb443ffc00a15a4ea8e332f04ad8992ec07a15583615d0b6fa5a7198b0fcb9be0d1eb08257da69843c2aaa4f9fd1ac
|
|
7
|
+
data.tar.gz: a300299cb68e8f4db138f5109132a996f8dce933b70ead85e0816b951ec10ac316daaadfc9ebabb57463efcef4b240010b7e098d1e3cae9557fafd51a563ffb3
|
data/lib/nanoc/core/context.rb
CHANGED
|
@@ -33,11 +33,10 @@ module Nanoc
|
|
|
33
33
|
# Returns a binding for this instance.
|
|
34
34
|
#
|
|
35
35
|
# @return [Binding] A binding for this instance
|
|
36
|
-
# rubocop:disable Naming/AccessorMethodName
|
|
36
|
+
# rubocop:disable-next Naming/AccessorMethodName
|
|
37
37
|
def get_binding
|
|
38
38
|
binding
|
|
39
39
|
end
|
|
40
|
-
# rubocop:enable Naming/AccessorMethodName
|
|
41
40
|
|
|
42
41
|
def method_missing(method, *args, &)
|
|
43
42
|
ivar_name = "@#{method}"
|
|
@@ -21,8 +21,6 @@ module Nanoc
|
|
|
21
21
|
# # Get (direct) predecessors
|
|
22
22
|
# graph.direct_predecessors_of('b').sort
|
|
23
23
|
# # => %w( a )
|
|
24
|
-
# graph.predecessors_of('e').sort
|
|
25
|
-
# # => %w( a b c d )
|
|
26
24
|
#
|
|
27
25
|
# # Modify edges
|
|
28
26
|
# graph.delete_edges_to('c')
|
|
@@ -30,8 +28,6 @@ module Nanoc
|
|
|
30
28
|
# # Get (direct) predecessors again
|
|
31
29
|
# graph.direct_predecessors_of('e').sort
|
|
32
30
|
# # => %w( d )
|
|
33
|
-
# graph.predecessors_of('e').sort
|
|
34
|
-
# # => %w( c d )
|
|
35
31
|
class DirectedGraph
|
|
36
32
|
EMPTY_SET = Set.new.freeze
|
|
37
33
|
|
|
@@ -39,10 +35,12 @@ module Nanoc
|
|
|
39
35
|
|
|
40
36
|
# Creates a new directed graph with the given vertices.
|
|
41
37
|
def initialize(vertices)
|
|
42
|
-
@
|
|
38
|
+
@vertex_to_idx_map = {}
|
|
39
|
+
@vertices = []
|
|
43
40
|
@next_vertex_idx = 0
|
|
44
41
|
vertices.each do |v|
|
|
45
|
-
@vertices
|
|
42
|
+
@vertices << v
|
|
43
|
+
@vertex_to_idx_map[v] = @next_vertex_idx
|
|
46
44
|
@next_vertex_idx += 1
|
|
47
45
|
end
|
|
48
46
|
|
|
@@ -50,14 +48,12 @@ module Nanoc
|
|
|
50
48
|
@from_graph = {}
|
|
51
49
|
|
|
52
50
|
@edge_props = {}
|
|
53
|
-
|
|
54
|
-
invalidate_caches
|
|
55
51
|
end
|
|
56
52
|
|
|
57
53
|
def inspect
|
|
58
54
|
s = []
|
|
59
55
|
|
|
60
|
-
@vertices.
|
|
56
|
+
@vertices.each do |v2|
|
|
61
57
|
direct_predecessors_of(v2).each do |v1|
|
|
62
58
|
s << [
|
|
63
59
|
"#{v1.inspect} -> #{v2.inspect} " \
|
|
@@ -91,8 +87,6 @@ module Nanoc
|
|
|
91
87
|
if props
|
|
92
88
|
@edge_props[[from, to]] = props
|
|
93
89
|
end
|
|
94
|
-
|
|
95
|
-
invalidate_caches
|
|
96
90
|
end
|
|
97
91
|
|
|
98
92
|
# Adds the given vertex to the graph.
|
|
@@ -101,9 +95,10 @@ module Nanoc
|
|
|
101
95
|
#
|
|
102
96
|
# @return [void]
|
|
103
97
|
def add_vertex(vertex)
|
|
104
|
-
return if @
|
|
98
|
+
return if @vertex_to_idx_map.key?(vertex)
|
|
105
99
|
|
|
106
|
-
@vertices
|
|
100
|
+
@vertices << vertex
|
|
101
|
+
@vertex_to_idx_map[vertex] = @next_vertex_idx
|
|
107
102
|
@next_vertex_idx += 1
|
|
108
103
|
end
|
|
109
104
|
|
|
@@ -120,8 +115,6 @@ module Nanoc
|
|
|
120
115
|
@from_graph.delete(from)
|
|
121
116
|
end
|
|
122
117
|
@to_graph.delete(to)
|
|
123
|
-
|
|
124
|
-
invalidate_caches
|
|
125
118
|
end
|
|
126
119
|
|
|
127
120
|
# @group Querying the graph
|
|
@@ -140,24 +133,13 @@ module Nanoc
|
|
|
140
133
|
@from_graph.fetch(from, EMPTY_SET)
|
|
141
134
|
end
|
|
142
135
|
|
|
143
|
-
# Returns the predecessors of the given vertex, i.e. the vertices x for
|
|
144
|
-
# which there is a path from x to the given vertex y.
|
|
145
|
-
#
|
|
146
|
-
# @param to The vertex of which the predecessors should be calculated
|
|
147
|
-
#
|
|
148
|
-
# @return [Array] Predecessors of the given vertex
|
|
149
|
-
def predecessors_of(to)
|
|
150
|
-
@predecessors[to] ||=
|
|
151
|
-
recursively_find_vertices(to, :direct_predecessors_of)
|
|
152
|
-
end
|
|
153
|
-
|
|
154
136
|
def props_for(from, to)
|
|
155
137
|
@edge_props[[from, to]]
|
|
156
138
|
end
|
|
157
139
|
|
|
158
140
|
# @return [Array] The list of all vertices in this graph.
|
|
159
141
|
def vertices
|
|
160
|
-
@vertices
|
|
142
|
+
@vertices
|
|
161
143
|
end
|
|
162
144
|
|
|
163
145
|
# Returns an array of tuples representing the edges. The result of this
|
|
@@ -166,49 +148,15 @@ module Nanoc
|
|
|
166
148
|
# @return [Array] The list of all edges in this graph.
|
|
167
149
|
def edges
|
|
168
150
|
result = []
|
|
169
|
-
@vertices.
|
|
151
|
+
@vertices.each_with_index do |v2, i2|
|
|
170
152
|
direct_predecessors_of(v2)
|
|
171
|
-
.map { |v1| [@
|
|
153
|
+
.map { |v1| [@vertex_to_idx_map[v1], v1] }
|
|
172
154
|
.each do |i1, v1|
|
|
173
155
|
result << [i1, i2, @edge_props[[v1, v2]]]
|
|
174
156
|
end
|
|
175
157
|
end
|
|
176
158
|
result
|
|
177
159
|
end
|
|
178
|
-
|
|
179
|
-
private
|
|
180
|
-
|
|
181
|
-
# Invalidates cached data. This method should be called when the internal
|
|
182
|
-
# graph representation is changed.
|
|
183
|
-
def invalidate_caches
|
|
184
|
-
@predecessors = {}
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
# Recursively finds vertices, starting at the vertex start, using the
|
|
188
|
-
# given method, which should be a symbol to a method that takes a vertex
|
|
189
|
-
# and returns related vertices (e.g. predecessors, successors).
|
|
190
|
-
def recursively_find_vertices(start, method)
|
|
191
|
-
all_vertices = Set.new
|
|
192
|
-
|
|
193
|
-
processed_vertices = Set.new
|
|
194
|
-
unprocessed_vertices = [start]
|
|
195
|
-
|
|
196
|
-
until unprocessed_vertices.empty?
|
|
197
|
-
# Get next unprocessed vertex
|
|
198
|
-
vertex = unprocessed_vertices.pop
|
|
199
|
-
next if processed_vertices.include?(vertex)
|
|
200
|
-
|
|
201
|
-
processed_vertices << vertex
|
|
202
|
-
|
|
203
|
-
# Add predecessors of this vertex
|
|
204
|
-
send(method, vertex).each do |v|
|
|
205
|
-
all_vertices << v unless all_vertices.include?(v)
|
|
206
|
-
unprocessed_vertices << v
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
all_vertices
|
|
211
|
-
end
|
|
212
160
|
end
|
|
213
161
|
end
|
|
214
162
|
end
|
data/lib/nanoc/core/item.rb
CHANGED
data/lib/nanoc/core/item_rep.rb
CHANGED
data/lib/nanoc/core/layout.rb
CHANGED
|
@@ -55,12 +55,11 @@ module Nanoc
|
|
|
55
55
|
# the suggested alternative (Array#include?) carries a measurable
|
|
56
56
|
# performance penatly.
|
|
57
57
|
#
|
|
58
|
-
# rubocop:disable Style/MultipleComparison
|
|
58
|
+
# rubocop:disable-next Style/MultipleComparison
|
|
59
59
|
klass == Nanoc::Core::Item ||
|
|
60
60
|
klass == Nanoc::Core::Layout ||
|
|
61
61
|
klass == Nanoc::Core::CompilationItemView ||
|
|
62
62
|
klass == Nanoc::Core::LayoutView
|
|
63
|
-
# rubocop:enable Style/MultipleComparison
|
|
64
63
|
end
|
|
65
64
|
end
|
|
66
65
|
end
|
|
@@ -93,7 +93,7 @@ module Nanoc
|
|
|
93
93
|
objs_outdated_due_to_dependencies = Set.new
|
|
94
94
|
|
|
95
95
|
seen = Set.new
|
|
96
|
-
pending = [nil] + basic_outdated_objs.to_a
|
|
96
|
+
pending = [nil, @site.items, @site.layouts] + basic_outdated_objs.to_a
|
|
97
97
|
until pending.empty?
|
|
98
98
|
obj = pending.shift
|
|
99
99
|
obj = obj.item if obj.is_a?(Nanoc::Core::ItemRep)
|
data/lib/nanoc/core/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nanoc-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.14.
|
|
4
|
+
version: 4.14.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis Defreyne
|
|
@@ -297,7 +297,7 @@ licenses:
|
|
|
297
297
|
- MIT
|
|
298
298
|
metadata:
|
|
299
299
|
rubygems_mfa_required: 'true'
|
|
300
|
-
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-core-v4.14.
|
|
300
|
+
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-core-v4.14.8/nanoc-core
|
|
301
301
|
rdoc_options: []
|
|
302
302
|
require_paths:
|
|
303
303
|
- lib
|
|
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
312
312
|
- !ruby/object:Gem::Version
|
|
313
313
|
version: '0'
|
|
314
314
|
requirements: []
|
|
315
|
-
rubygems_version: 4.0.
|
|
315
|
+
rubygems_version: 4.0.16
|
|
316
316
|
specification_version: 4
|
|
317
317
|
summary: Core of Nanoc
|
|
318
318
|
test_files: []
|