nanoc-core 4.12.12 → 4.12.14
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/action_sequence_store.rb +1 -1
- data/lib/nanoc/core/binary_compiled_content_cache.rb +1 -1
- data/lib/nanoc/core/checksum_store.rb +1 -1
- data/lib/nanoc/core/dependency_store.rb +1 -1
- data/lib/nanoc/core/item_rep_selector.rb +13 -20
- data/lib/nanoc/core/outdatedness_store.rb +1 -1
- data/lib/nanoc/core/store.rb +29 -3
- data/lib/nanoc/core/textual_compiled_content_cache.rb +1 -1
- data/lib/nanoc/core/version.rb +1 -1
- data/lib/nanoc/core.rb +1 -0
- 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: f6002d238861027abd84a4b7499c56f95be1e8bf3dec412eb21051c91c11fcce
|
4
|
+
data.tar.gz: 3788262a93f33920e549372a34d5fcacc4a2c6d120d3acf1562499eaaaca0cfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 869cddca22933872511ec0b10d7a09c9d37ff3dd89de4340f88b2d6fcceee725779d0c0dd9e891f2c28e2a25adb6f7a909f378537d8d88bd5a4f128fc76b86de
|
7
|
+
data.tar.gz: 208bd267925b4d51df67bd0293fe6f903671089f4899c529fc63cc8d5ecd0130c434662211b2e232e115bb532a2234301c6c44e5b74fff4acfc74e93288d703d
|
@@ -11,7 +11,7 @@ module Nanoc
|
|
11
11
|
|
12
12
|
contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
|
13
13
|
def initialize(config:)
|
14
|
-
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'rule_memory'),
|
14
|
+
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'rule_memory'), 2)
|
15
15
|
|
16
16
|
@action_sequences = {}
|
17
17
|
end
|
@@ -11,7 +11,7 @@ module Nanoc
|
|
11
11
|
|
12
12
|
contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
|
13
13
|
def initialize(config:)
|
14
|
-
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'binary_content'),
|
14
|
+
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'binary_content'), 3)
|
15
15
|
|
16
16
|
@cache = {}
|
17
17
|
end
|
@@ -16,7 +16,7 @@ module Nanoc
|
|
16
16
|
|
17
17
|
contract C::KeywordArgs[config: Nanoc::Core::Configuration, objects: C::IterOf[c_obj]] => C::Any
|
18
18
|
def initialize(config:, objects:)
|
19
|
-
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'checksums'),
|
19
|
+
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'checksums'), 3)
|
20
20
|
|
21
21
|
@objects = objects
|
22
22
|
|
@@ -42,7 +42,7 @@ module Nanoc
|
|
42
42
|
|
43
43
|
contract Nanoc::Core::ItemCollection, Nanoc::Core::LayoutCollection, Nanoc::Core::Configuration => C::Any
|
44
44
|
def initialize(items, layouts, config)
|
45
|
-
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'dependencies'),
|
45
|
+
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'dependencies'), 6)
|
46
46
|
|
47
47
|
@config = config
|
48
48
|
@items = items
|
@@ -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
|
@@ -8,7 +8,7 @@ module Nanoc
|
|
8
8
|
|
9
9
|
contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
|
10
10
|
def initialize(config:)
|
11
|
-
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'outdatedness'),
|
11
|
+
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'outdatedness'), 2)
|
12
12
|
|
13
13
|
@outdated_refs = Set.new
|
14
14
|
end
|
data/lib/nanoc/core/store.rb
CHANGED
@@ -128,12 +128,16 @@ module Nanoc
|
|
128
128
|
self.data = read_obj_from_file(data_filename)
|
129
129
|
end
|
130
130
|
|
131
|
-
def write_obj_to_file(
|
132
|
-
|
131
|
+
def write_obj_to_file(filename, obj)
|
132
|
+
data = Marshal.dump(obj)
|
133
|
+
compressed_data = Zlib::Deflate.deflate(data, Zlib::BEST_SPEED)
|
134
|
+
write_data_to_file(filename, compressed_data)
|
133
135
|
end
|
134
136
|
|
135
137
|
def read_obj_from_file(fn)
|
136
|
-
|
138
|
+
compressed_data = File.binread(fn)
|
139
|
+
data = Zlib::Inflate.inflate(compressed_data)
|
140
|
+
Marshal.load(data)
|
137
141
|
end
|
138
142
|
|
139
143
|
def version_filename
|
@@ -143,6 +147,28 @@ module Nanoc
|
|
143
147
|
def data_filename
|
144
148
|
"#{filename}.data.db"
|
145
149
|
end
|
150
|
+
|
151
|
+
def write_data_to_file(filename, data)
|
152
|
+
basename = File.basename(filename)
|
153
|
+
dirname = File.dirname(filename)
|
154
|
+
|
155
|
+
# Write to a temporary file first, and then (atomically) move it into
|
156
|
+
# place.
|
157
|
+
Tempfile.open(".#{basename}", dirname) do |temp_file|
|
158
|
+
temp_file.binmode
|
159
|
+
|
160
|
+
# Write the data as a stream, because File.binwrite can’t
|
161
|
+
# necessarily deal with writing that much data all at once.
|
162
|
+
#
|
163
|
+
# See https://github.com/nanoc/nanoc/issues/1635.
|
164
|
+
reader = StringIO.new(data)
|
165
|
+
IO.copy_stream(reader, temp_file)
|
166
|
+
temp_file.close
|
167
|
+
|
168
|
+
# Rename (atomic)
|
169
|
+
File.rename(temp_file.path, filename)
|
170
|
+
end
|
171
|
+
end
|
146
172
|
end
|
147
173
|
end
|
148
174
|
end
|
@@ -11,7 +11,7 @@ module Nanoc
|
|
11
11
|
|
12
12
|
contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
|
13
13
|
def initialize(config:)
|
14
|
-
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'compiled_content'),
|
14
|
+
super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'compiled_content'), 4)
|
15
15
|
|
16
16
|
@cache = {}
|
17
17
|
end
|
data/lib/nanoc/core/version.rb
CHANGED
data/lib/nanoc/core.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.14
|
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
|
+
date: 2022-12-03 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
|