nanoc-core 4.12.12 → 4.12.13

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: 5f5cba2759d0a1a3fed3b3ecd60b4d48fe74e4e47d9855f585731a52436b407c
4
- data.tar.gz: cbe6128977455e8109c3991059521a6f97053eda60eccaa4597637c680f89a00
3
+ metadata.gz: 94f41a5b7ba9b534f61e42a82dc9df7bebed20e7f2aadc6610d6b9523e2a3e8a
4
+ data.tar.gz: a40f9d8498cf715052ba691850e0e59c0877c107a7b0973594645ce7548cc289
5
5
  SHA512:
6
- metadata.gz: 488a4b2b75e2a0a49f1a66f810003f5f11961e156013852cd97e1495bc1b66a0906b7efe1816a760127ed4759cd8926426d0dccc9776d12bb159ac15be3eabc6
7
- data.tar.gz: 32cc8224e2aaf4abff07af2fb0401211f927bfa1e057c3641acdf043097df4554f4a70142cfcbac37f791f54dfefd196d10e0f48c7637d2692a94134b4850658
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 = ItemRepIgnorableIterator.new(reps)
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.pop
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.next_ignoring(@seen)
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
- # Nothing to do
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.push(dep)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Core
5
- VERSION = '4.12.12'
5
+ VERSION = '4.12.13'
6
6
  end
7
7
  end
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.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-15 00:00:00.000000000 Z
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.3.25
319
+ rubygems_version: 3.4.0.dev
320
320
  signing_key:
321
321
  specification_version: 4
322
322
  summary: Core of Nanoc