nanoc-core 4.12.12 → 4.12.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nanoc/core/item_rep_selector.rb +13 -20
- 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: 94f41a5b7ba9b534f61e42a82dc9df7bebed20e7f2aadc6610d6b9523e2a3e8a
|
4
|
+
data.tar.gz: a40f9d8498cf715052ba691850e0e59c0877c107a7b0973594645ce7548cc289
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c28483387d092e48b15f568fb910b60aa237dde2c152938ed4e36174ada46f56edbb29742ad7da98e903d5ed44066b40bc0821891ee48b1e1d48ff607d08370
|
7
|
+
data.tar.gz: b1d14a6cdbb245eb97b7820060406aa545571430214d835110f15d47bd721c49b28a66ee0473130699f4c4be2493cbd8267c81938c4dbc5981b5ce763a3a9437
|
@@ -8,27 +8,13 @@ module Nanoc
|
|
8
8
|
@reps = reps
|
9
9
|
end
|
10
10
|
|
11
|
-
# An iterator (FIFO) over an array, with ability to ignore certain
|
12
|
-
# elements.
|
13
|
-
class ItemRepIgnorableIterator
|
14
|
-
def initialize(array)
|
15
|
-
@array = array.dup
|
16
|
-
end
|
17
|
-
|
18
|
-
def next_ignoring(ignored)
|
19
|
-
elem = @array.shift
|
20
|
-
elem = @array.shift while ignored.include?(elem)
|
21
|
-
elem
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
11
|
# A priority queue that tracks dependencies and can detect circular
|
26
12
|
# dependencies.
|
27
13
|
class ItemRepPriorityQueue
|
28
14
|
def initialize(reps)
|
29
15
|
# Prio A: most important; prio C: least important.
|
30
|
-
@prio_a =
|
31
|
-
@prio_b =
|
16
|
+
@prio_a = nil
|
17
|
+
@prio_b = reps.dup
|
32
18
|
@prio_c = []
|
33
19
|
|
34
20
|
# List of reps that we’ve already seen. Reps from `reps` will end up
|
@@ -36,25 +22,32 @@ module Nanoc
|
|
36
22
|
# `reps`, when they are part of a dependency.
|
37
23
|
@seen = Set.new
|
38
24
|
|
25
|
+
# List of reps that have already been completed (yielded followed by
|
26
|
+
# `#mark_ok`).
|
27
|
+
@completed = Set.new
|
28
|
+
|
39
29
|
# Record (hard) dependencies. Used for detecting cycles.
|
40
30
|
@dependencies = Hash.new { |hash, key| hash[key] = Set.new }
|
41
31
|
end
|
42
32
|
|
43
33
|
def next
|
44
34
|
# Read prio A
|
45
|
-
@this = @prio_a
|
35
|
+
@this = @prio_a
|
46
36
|
if @this
|
37
|
+
@prio_a = nil
|
47
38
|
return @this
|
48
39
|
end
|
49
40
|
|
50
41
|
# Read prio B
|
51
|
-
@this = @prio_b.
|
42
|
+
@this = @prio_b.shift
|
43
|
+
@this = @prio_b.shift while @seen.include?(@this)
|
52
44
|
if @this
|
53
45
|
return @this
|
54
46
|
end
|
55
47
|
|
56
48
|
# Read prio C
|
57
49
|
@this = @prio_c.pop
|
50
|
+
@this = @prio_c.pop while @completed.include?(@this)
|
58
51
|
if @this
|
59
52
|
return @this
|
60
53
|
end
|
@@ -63,7 +56,7 @@ module Nanoc
|
|
63
56
|
end
|
64
57
|
|
65
58
|
def mark_ok
|
66
|
-
|
59
|
+
@completed << @this
|
67
60
|
end
|
68
61
|
|
69
62
|
def mark_failed(dep)
|
@@ -78,7 +71,7 @@ module Nanoc
|
|
78
71
|
|
79
72
|
# Put `dep` (item rep that needs to be compiled first, before
|
80
73
|
# `@this`) into priority A (highest prio).
|
81
|
-
@prio_a
|
74
|
+
@prio_a = dep
|
82
75
|
|
83
76
|
# Remember that we’ve prioritised `dep`. This particular element will
|
84
77
|
# come from @prio_b at some point in the future, so we’ll have to skip
|
data/lib/nanoc/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.12.
|
4
|
+
version: 4.12.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
- !ruby/object:Gem::Version
|
317
317
|
version: '0'
|
318
318
|
requirements: []
|
319
|
-
rubygems_version: 3.
|
319
|
+
rubygems_version: 3.4.0.dev
|
320
320
|
signing_key:
|
321
321
|
specification_version: 4
|
322
322
|
summary: Core of Nanoc
|