nanoc-core 4.14.1 → 4.14.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6654a9dc862f8e0ff682547725c8479ebc4e50d848c55e70f3ba7d902fff008c
|
|
4
|
+
data.tar.gz: a6260a1f1aa36656b15f494e9ad0a0242dc7ea4d3385511e85ba30f55d7e4f7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74ba0d19319adb353c6284db11f0f8ec94f7e8c4672e50be452332664d2e5ac16efaebe247cc81d6738fbe908502819018e1404449a54869aaf55e6a96b3e157
|
|
7
|
+
data.tar.gz: 82bc7bbbeb7764a0d23962da4bdc50f18024c16b663fa3af08e3ac5da2f07097832e88aa2e0086bef88a758720f07dbdfd9213f3e8f882f45a07364a9523be99
|
|
@@ -33,7 +33,12 @@ module Nanoc
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
selector = Nanoc::Core::ItemRepSelector.new(
|
|
36
|
+
selector = Nanoc::Core::ItemRepSelector.new(
|
|
37
|
+
outdated_reps:,
|
|
38
|
+
reps: @reps,
|
|
39
|
+
dependency_store: @dependency_store,
|
|
40
|
+
)
|
|
41
|
+
|
|
37
42
|
run_phase_stack do |phase_stack|
|
|
38
43
|
selector.each do |rep|
|
|
39
44
|
handle_errors_while(rep) do
|
|
@@ -4,17 +4,22 @@ module Nanoc
|
|
|
4
4
|
module Core
|
|
5
5
|
# Yields item reps to compile.
|
|
6
6
|
class ItemRepSelector
|
|
7
|
-
def initialize(reps)
|
|
7
|
+
def initialize(outdated_reps:, reps:, dependency_store:)
|
|
8
|
+
@outdated_reps = outdated_reps
|
|
8
9
|
@reps = reps
|
|
10
|
+
@dependency_store = dependency_store
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
# A priority queue that tracks dependencies and can detect circular
|
|
12
14
|
# dependencies.
|
|
13
15
|
class ItemRepPriorityQueue
|
|
14
|
-
def initialize(reps)
|
|
16
|
+
def initialize(outdated_reps:, reps:, dependency_store:)
|
|
17
|
+
@reps = reps
|
|
18
|
+
@dependency_store = dependency_store
|
|
19
|
+
|
|
15
20
|
# Prio A: most important; prio C: least important.
|
|
16
21
|
@prio_a = nil
|
|
17
|
-
@prio_b =
|
|
22
|
+
@prio_b = outdated_reps.dup
|
|
18
23
|
@prio_c = []
|
|
19
24
|
|
|
20
25
|
# List of reps that we’ve already seen. Reps from `reps` will end up
|
|
@@ -40,7 +45,7 @@ module Nanoc
|
|
|
40
45
|
|
|
41
46
|
# Read prio B
|
|
42
47
|
@this = @prio_b.shift
|
|
43
|
-
@this = @prio_b.shift while @seen.include?(@this)
|
|
48
|
+
@this = @prio_b.shift while @seen.include?(@this) || @completed.include?(@this)
|
|
44
49
|
if @this
|
|
45
50
|
return @this
|
|
46
51
|
end
|
|
@@ -59,30 +64,43 @@ module Nanoc
|
|
|
59
64
|
@completed << @this
|
|
60
65
|
end
|
|
61
66
|
|
|
62
|
-
def mark_failed(
|
|
63
|
-
record_dependency(
|
|
67
|
+
def mark_failed(needed_rep:)
|
|
68
|
+
record_dependency(needed_rep)
|
|
64
69
|
|
|
65
|
-
# `@this` depends on `
|
|
66
|
-
# move `@this` into priority C, and `
|
|
70
|
+
# `@this` depends on `needed_rep`, so `needed_rep` has to be compiled
|
|
71
|
+
# first. Thus, move `@this` into priority C, and `needed_rep` into
|
|
72
|
+
# priority A.
|
|
67
73
|
|
|
68
|
-
# Put `@this` (item rep that needs `
|
|
69
|
-
# priority C (lowest prio).
|
|
74
|
+
# Put `@this` (item rep that needs `needed_rep` to be compiled first)
|
|
75
|
+
# into priority C (lowest prio).
|
|
70
76
|
@prio_c.push(@this) unless @prio_c.include?(@this)
|
|
71
77
|
|
|
72
|
-
# Put `
|
|
78
|
+
# Put `needed_rep` (item rep that needs to be compiled first, before
|
|
73
79
|
# `@this`) into priority A (highest prio).
|
|
74
|
-
@prio_a =
|
|
75
|
-
|
|
76
|
-
# Remember that we’ve prioritised `
|
|
77
|
-
# come from @prio_b at some point in the future, so we’ll
|
|
78
|
-
# it then.
|
|
79
|
-
@seen <<
|
|
80
|
+
@prio_a = needed_rep
|
|
81
|
+
|
|
82
|
+
# Remember that we’ve prioritised `needed_rep`. This particular
|
|
83
|
+
# element will come from @prio_b at some point in the future, so we’ll
|
|
84
|
+
# have to skip it then.
|
|
85
|
+
@seen << needed_rep
|
|
86
|
+
|
|
87
|
+
# Add everything else that `@this` depends on to the queue. It is OK
|
|
88
|
+
# if there are duplicates; `#next` will filter them out.
|
|
89
|
+
@dependency_store.objects_causing_outdatedness_of(@this.item).each do |obj|
|
|
90
|
+
if obj.is_a?(Nanoc::Core::Item)
|
|
91
|
+
item = obj
|
|
92
|
+
|
|
93
|
+
@reps[item].each do |rep|
|
|
94
|
+
@prio_b.unshift(rep)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
80
98
|
end
|
|
81
99
|
|
|
82
100
|
private
|
|
83
101
|
|
|
84
|
-
def record_dependency(
|
|
85
|
-
@dependencies[@this] <<
|
|
102
|
+
def record_dependency(rep)
|
|
103
|
+
@dependencies[@this] << rep
|
|
86
104
|
|
|
87
105
|
find_cycle(@this, [@this])
|
|
88
106
|
end
|
|
@@ -102,7 +120,11 @@ module Nanoc
|
|
|
102
120
|
end
|
|
103
121
|
|
|
104
122
|
def each
|
|
105
|
-
pq = ItemRepPriorityQueue.new(
|
|
123
|
+
pq = ItemRepPriorityQueue.new(
|
|
124
|
+
outdated_reps: @outdated_reps,
|
|
125
|
+
reps: @reps,
|
|
126
|
+
dependency_store: @dependency_store,
|
|
127
|
+
)
|
|
106
128
|
|
|
107
129
|
loop do
|
|
108
130
|
rep = pq.next
|
|
@@ -115,7 +137,7 @@ module Nanoc
|
|
|
115
137
|
actual_error = e.is_a?(Nanoc::Core::Errors::CompilationError) ? e.unwrap : e
|
|
116
138
|
|
|
117
139
|
if actual_error.is_a?(Nanoc::Core::Errors::UnmetDependency)
|
|
118
|
-
pq.mark_failed(actual_error.rep)
|
|
140
|
+
pq.mark_failed(needed_rep: actual_error.rep)
|
|
119
141
|
else
|
|
120
142
|
raise(e)
|
|
121
143
|
end
|
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.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis Defreyne
|
|
@@ -303,7 +303,7 @@ licenses:
|
|
|
303
303
|
- MIT
|
|
304
304
|
metadata:
|
|
305
305
|
rubygems_mfa_required: 'true'
|
|
306
|
-
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-core-v4.14.
|
|
306
|
+
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-core-v4.14.3/nanoc-core
|
|
307
307
|
rdoc_options: []
|
|
308
308
|
require_paths:
|
|
309
309
|
- lib
|
|
@@ -318,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
318
318
|
- !ruby/object:Gem::Version
|
|
319
319
|
version: '0'
|
|
320
320
|
requirements: []
|
|
321
|
-
rubygems_version: 3.
|
|
321
|
+
rubygems_version: 3.6.9
|
|
322
322
|
specification_version: 4
|
|
323
323
|
summary: Core of Nanoc
|
|
324
324
|
test_files: []
|