nanoc 4.2.2 → 4.2.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 +4 -4
- data/Gemfile.lock +1 -1
- data/NEWS.md +12 -0
- data/lib/nanoc.rb +3 -0
- data/lib/nanoc/base/checksummer.rb +0 -2
- data/lib/nanoc/base/compilation/compiler.rb +2 -1
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +1 -1
- data/lib/nanoc/base/memoization.rb +16 -2
- data/lib/nanoc/base/plugin_registry.rb +1 -3
- data/lib/nanoc/base/views/item_rep_view.rb +4 -0
- data/lib/nanoc/base/views/mixins/document_view_mixin.rb +4 -0
- data/lib/nanoc/base/views/post_compile_item_view.rb +6 -1
- data/lib/nanoc/base/views/view.rb +4 -0
- data/lib/nanoc/version.rb +1 -1
- data/test/base/test_compiler.rb +0 -15
- data/test/base/test_memoization.rb +22 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 308b361e14b750d6171037c0167935bf806c7a5f
|
4
|
+
data.tar.gz: bf2db4108dc18dd6fa2602a3451ed5a2636af11e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 820db95cb94318cca8afc1e6942f33e4131beb2bcc53eb0e4866079180dab65f6164e274117c53b88799b29bab3e069d245250b972a630bb5386dd3036f3a287
|
7
|
+
data.tar.gz: bdff99a92e4a2ff4ea4c6486bc3341728986ef259f5fe9c270c80355bf49d38d1cae5cf2f1c9b3178bce2c573313a423faca57009b7717ca1332abcab01019f1
|
data/Gemfile.lock
CHANGED
data/NEWS.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
+
## 4.2.3 (2016-07-03)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Fixed issue with `#inspect` raising a `WeakRef::RefError` (#877, #897)
|
8
|
+
|
9
|
+
Enhancements:
|
10
|
+
|
11
|
+
* Sped up compiler (#894)
|
12
|
+
* Improved `#inspect` output of some classes (#896)
|
13
|
+
* Deprecated `Item#modified` and replaced it with `Item#modified_reps` (#898)
|
14
|
+
|
3
15
|
## 4.2.2 (2016-07-02)
|
4
16
|
|
5
17
|
Fixes:
|
data/lib/nanoc.rb
CHANGED
@@ -191,7 +191,8 @@ module Nanoc::Int
|
|
191
191
|
end
|
192
192
|
|
193
193
|
# Find item reps to compile and compile them
|
194
|
-
|
194
|
+
outdated_reps = @reps.select { |r| outdatedness_checker.outdated?(r) }
|
195
|
+
selector = Nanoc::Int::ItemRepSelector.new(outdated_reps)
|
195
196
|
selector.each do |rep|
|
196
197
|
@stack = []
|
197
198
|
compile_rep(rep)
|
@@ -136,7 +136,7 @@ module Nanoc::Int
|
|
136
136
|
# indefinitely. It should not be necessary to pass this a custom value.
|
137
137
|
#
|
138
138
|
# @return [Boolean] true if the object is outdated, false otherwise
|
139
|
-
def outdated_due_to_dependencies?(obj, processed = Set.new)
|
139
|
+
def outdated_due_to_dependencies?(obj, processed = Hamster::Set.new)
|
140
140
|
# Convert from rep to item if necessary
|
141
141
|
obj = obj.item if obj.is_a?(Nanoc::Int::ItemRep)
|
142
142
|
|
@@ -8,6 +8,20 @@ module Nanoc::Int
|
|
8
8
|
# @since 3.2.0
|
9
9
|
module Memoization
|
10
10
|
class Wrapper
|
11
|
+
attr_reader :ref
|
12
|
+
|
13
|
+
def initialize(ref)
|
14
|
+
@ref = ref
|
15
|
+
end
|
16
|
+
|
17
|
+
def inspect
|
18
|
+
@ref.inspect
|
19
|
+
rescue WeakRef::RefError
|
20
|
+
'<weak ref collected>'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Value
|
11
25
|
attr_reader :value
|
12
26
|
|
13
27
|
def initialize(value)
|
@@ -63,7 +77,7 @@ module Nanoc::Int
|
|
63
77
|
if method_cache.key?(args)
|
64
78
|
value =
|
65
79
|
begin
|
66
|
-
method_cache[args].value
|
80
|
+
method_cache[args].ref.value
|
67
81
|
rescue WeakRef::RefError
|
68
82
|
NONE
|
69
83
|
end
|
@@ -71,7 +85,7 @@ module Nanoc::Int
|
|
71
85
|
|
72
86
|
if value.equal?(NONE)
|
73
87
|
send(original_method_name, *args).tap do |r|
|
74
|
-
method_cache[args] = WeakRef.new(
|
88
|
+
method_cache[args] = Wrapper.new(WeakRef.new(Value.new(r)))
|
75
89
|
end
|
76
90
|
else
|
77
91
|
value
|
@@ -196,9 +196,7 @@ module Nanoc::Int
|
|
196
196
|
|
197
197
|
def resolve(class_or_name, _klass)
|
198
198
|
if class_or_name.is_a?(String)
|
199
|
-
|
200
|
-
memo.const_get(part)
|
201
|
-
end
|
199
|
+
Kernel.const_get(class_or_name)
|
202
200
|
else
|
203
201
|
class_or_name
|
204
202
|
end
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module Nanoc
|
2
2
|
class PostCompileItemView < Nanoc::ItemWithRepsView
|
3
|
+
# @deprecated Use {#modified_reps} instead
|
3
4
|
def modified
|
4
|
-
|
5
|
+
modified_reps
|
6
|
+
end
|
7
|
+
|
8
|
+
def modified_reps
|
9
|
+
reps.select { |rep| rep.unwrap.modified? }
|
5
10
|
end
|
6
11
|
end
|
7
12
|
end
|
data/lib/nanoc/version.rb
CHANGED
data/test/base/test_compiler.rb
CHANGED
@@ -208,21 +208,6 @@ class Nanoc::Int::CompilerTest < Nanoc::TestCase
|
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
-
def test_compile_should_recompile_all_reps
|
212
|
-
Nanoc::CLI.run %w(create_site bar)
|
213
|
-
|
214
|
-
FileUtils.cd('bar') do
|
215
|
-
Nanoc::CLI.run %w(compile)
|
216
|
-
|
217
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
218
|
-
site.compile
|
219
|
-
|
220
|
-
# At this point, even the already compiled items in the previous pass
|
221
|
-
# should have their compiled content assigned, so this should work:
|
222
|
-
site.compiler.reps[site.items['/index.*']][0].compiled_content
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
211
|
def test_disallow_multiple_snapshots_with_the_same_name
|
227
212
|
# Create site
|
228
213
|
Nanoc::CLI.run %w(create_site bar)
|
@@ -25,6 +25,15 @@ class Nanoc::Int::MemoizationTest < Nanoc::TestCase
|
|
25
25
|
memoize :run
|
26
26
|
end
|
27
27
|
|
28
|
+
class Upcaser
|
29
|
+
extend Nanoc::Int::Memoization
|
30
|
+
|
31
|
+
def run(value)
|
32
|
+
value.upcase
|
33
|
+
end
|
34
|
+
memoize :run
|
35
|
+
end
|
36
|
+
|
28
37
|
def test_normal
|
29
38
|
sample1a = Sample1.new(10)
|
30
39
|
sample1b = Sample1.new(15)
|
@@ -38,4 +47,17 @@ class Nanoc::Int::MemoizationTest < Nanoc::TestCase
|
|
38
47
|
assert_equal 100 * 25 + 7, sample2b.run(7)
|
39
48
|
end
|
40
49
|
end
|
50
|
+
|
51
|
+
def test_weak_inspect
|
52
|
+
upcaser = Upcaser.new
|
53
|
+
10_000.times do |i|
|
54
|
+
upcaser.run("hello world #{i}")
|
55
|
+
end
|
56
|
+
|
57
|
+
GC.start
|
58
|
+
GC.start
|
59
|
+
|
60
|
+
# Should not raise
|
61
|
+
upcaser.inspect
|
62
|
+
end
|
41
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -387,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
387
387
|
version: '0'
|
388
388
|
requirements: []
|
389
389
|
rubyforge_project:
|
390
|
-
rubygems_version: 2.6.
|
390
|
+
rubygems_version: 2.6.6
|
391
391
|
signing_key:
|
392
392
|
specification_version: 4
|
393
393
|
summary: A static-site generator with a focus on flexibility.
|