nanoc-core 4.14.5 → 4.14.6
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/lib/nanoc/core/compilation_context.rb +14 -4
- data/lib/nanoc/core/compilation_phases/cache.rb +7 -27
- data/lib/nanoc/core/compilation_phases/recalculate.rb +4 -7
- data/lib/nanoc/core/compilation_phases/write.rb +3 -16
- data/lib/nanoc/core/compilation_stages/compile_reps.rb +2 -2
- data/lib/nanoc/core/{compiled_content_store.rb → compiled_content_repo.rb} +1 -1
- data/lib/nanoc/core/compiler.rb +3 -2
- data/lib/nanoc/core/core_ext/string.rb +1 -1
- data/lib/nanoc/core/dependency_tracker.rb +13 -32
- data/lib/nanoc/core/errors.rb +2 -2
- data/lib/nanoc/core/executor.rb +8 -8
- data/lib/nanoc/core/identifier.rb +7 -7
- data/lib/nanoc/core/item_rep_router.rb +3 -7
- data/lib/nanoc/core/item_rep_writer.rb +6 -6
- data/lib/nanoc/core/outdatedness_checker.rb +1 -1
- data/lib/nanoc/core/textual_compiled_content_cache.rb +1 -12
- data/lib/nanoc/core/version.rb +1 -1
- data/lib/nanoc/core/view_context_for_compilation.rb +5 -5
- data/lib/nanoc/core/views/compilation_item_rep_view.rb +95 -0
- data/lib/nanoc/core.rb +2 -2
- metadata +26 -26
- data/lib/nanoc/core/compilation_item_rep_view.rb +0 -57
- /data/lib/nanoc/core/{basic_item_rep_collection_view.rb → views/basic_item_rep_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{basic_item_rep_view.rb → views/basic_item_rep_view.rb} +0 -0
- /data/lib/nanoc/core/{basic_item_view.rb → views/basic_item_view.rb} +0 -0
- /data/lib/nanoc/core/{compilation_item_rep_collection_view.rb → views/compilation_item_rep_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{compilation_item_view.rb → views/compilation_item_view.rb} +0 -0
- /data/lib/nanoc/core/{config_view.rb → views/config_view.rb} +0 -0
- /data/lib/nanoc/core/{identifiable_collection_view.rb → views/identifiable_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{item_collection_with_reps_view.rb → views/item_collection_with_reps_view.rb} +0 -0
- /data/lib/nanoc/core/{item_collection_without_reps_view.rb → views/item_collection_without_reps_view.rb} +0 -0
- /data/lib/nanoc/core/{layout_collection_view.rb → views/layout_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{layout_view.rb → views/layout_view.rb} +0 -0
- /data/lib/nanoc/core/{mutable_config_view.rb → views/mutable_config_view.rb} +0 -0
- /data/lib/nanoc/core/{mutable_identifiable_collection_view.rb → views/mutable_identifiable_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{mutable_item_collection_view.rb → views/mutable_item_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{mutable_item_view.rb → views/mutable_item_view.rb} +0 -0
- /data/lib/nanoc/core/{mutable_layout_collection_view.rb → views/mutable_layout_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{mutable_layout_view.rb → views/mutable_layout_view.rb} +0 -0
- /data/lib/nanoc/core/{post_compile_item_collection_view.rb → views/post_compile_item_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{post_compile_item_rep_collection_view.rb → views/post_compile_item_rep_collection_view.rb} +0 -0
- /data/lib/nanoc/core/{post_compile_item_rep_view.rb → views/post_compile_item_rep_view.rb} +0 -0
- /data/lib/nanoc/core/{post_compile_item_view.rb → views/post_compile_item_view.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c8175e70512a2b971b62c60b31c650458e8fcef2aeb7318ccb6dbd9e76d3a25d
|
|
4
|
+
data.tar.gz: '03478e1061f3b8324435731239def3183d77054e3bbc5b3ac3f6d5e2ab9786a7'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 557b852833a1f73919076424047436280d3f7f1d3bd8e319bed4485e0828ffed2ab134afa8300b30f289e940edabc64b2dc1f8bb24077e0420d7408c2c2acfb7
|
|
7
|
+
data.tar.gz: d5bfd697e976849b4cc5760817c257f3b032bd68b196dc3ac4d1b74ad9c57a6c80cfb262ac8f53fb86ad036e943b7c65435e5e548e70eb5d23979690732528e9
|
|
@@ -27,7 +27,8 @@ module Nanoc
|
|
|
27
27
|
attr_reader :site
|
|
28
28
|
attr_reader :reps
|
|
29
29
|
attr_reader :compiled_content_cache
|
|
30
|
-
attr_reader :
|
|
30
|
+
attr_reader :compiled_content_repo
|
|
31
|
+
attr_reader :outdatedness_store
|
|
31
32
|
|
|
32
33
|
C_COMPILED_CONTENT_CACHE =
|
|
33
34
|
C::Or[
|
|
@@ -41,14 +42,23 @@ module Nanoc
|
|
|
41
42
|
reps: Nanoc::Core::ItemRepRepo,
|
|
42
43
|
site: Nanoc::Core::Site,
|
|
43
44
|
compiled_content_cache: C_COMPILED_CONTENT_CACHE,
|
|
44
|
-
|
|
45
|
+
compiled_content_repo: Nanoc::Core::CompiledContentRepo,
|
|
46
|
+
outdatedness_store: Nanoc::Core::OutdatednessStore,
|
|
45
47
|
] => C::Any
|
|
46
|
-
def initialize(
|
|
48
|
+
def initialize(
|
|
49
|
+
action_provider:,
|
|
50
|
+
reps:,
|
|
51
|
+
site:,
|
|
52
|
+
compiled_content_cache:,
|
|
53
|
+
compiled_content_repo:,
|
|
54
|
+
outdatedness_store:
|
|
55
|
+
)
|
|
47
56
|
@action_provider = action_provider
|
|
48
57
|
@reps = reps
|
|
49
58
|
@site = site
|
|
50
59
|
@compiled_content_cache = compiled_content_cache
|
|
51
|
-
@
|
|
60
|
+
@compiled_content_repo = compiled_content_repo
|
|
61
|
+
@outdatedness_store = outdatedness_store
|
|
52
62
|
end
|
|
53
63
|
|
|
54
64
|
contract Nanoc::Core::Layout => FilterNameAndArgs
|
|
@@ -3,45 +3,25 @@
|
|
|
3
3
|
module Nanoc
|
|
4
4
|
module Core
|
|
5
5
|
module CompilationPhases
|
|
6
|
-
#
|
|
7
|
-
# outdatedness checking. Delegates to s::Recalculate if outdated or no cache available.
|
|
6
|
+
# Stores the compiled content in the cache once available.
|
|
8
7
|
class Cache < Abstract
|
|
9
8
|
include Nanoc::Core::ContractsSupport
|
|
10
9
|
|
|
11
|
-
def initialize(wrapped:, compiled_content_cache:,
|
|
10
|
+
def initialize(wrapped:, compiled_content_cache:, compiled_content_repo:)
|
|
12
11
|
super(wrapped:)
|
|
13
12
|
|
|
14
13
|
@compiled_content_cache = compiled_content_cache
|
|
15
|
-
@
|
|
14
|
+
@compiled_content_repo = compiled_content_repo
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
|
19
|
-
def run(rep, is_outdated:)
|
|
20
|
-
if
|
|
21
|
-
# If cached content can be used for this item rep, do so, and skip
|
|
22
|
-
# recalculation of the item rep compiled content.
|
|
23
|
-
Nanoc::Core::NotificationCenter.post(:cached_content_used, rep)
|
|
24
|
-
@compiled_content_store.set_all(rep, @compiled_content_cache[rep])
|
|
25
|
-
else
|
|
26
|
-
# Cached content couldn’t be used for this rep. Continue as usual with
|
|
27
|
-
# recalculation of the item rep compiled content.
|
|
28
|
-
yield
|
|
29
|
-
|
|
30
|
-
# Update compiled content cache, now that the item rep is compiled.
|
|
31
|
-
@compiled_content_cache[rep] = @compiled_content_store.get_all(rep)
|
|
32
|
-
end
|
|
18
|
+
def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
|
19
|
+
return if rep.compiled?
|
|
33
20
|
|
|
21
|
+
yield
|
|
22
|
+
@compiled_content_cache[rep] = @compiled_content_repo.get_all(rep)
|
|
34
23
|
rep.compiled = true
|
|
35
24
|
end
|
|
36
|
-
|
|
37
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Bool
|
|
38
|
-
def can_reuse_content_for_rep?(rep, is_outdated:)
|
|
39
|
-
if is_outdated
|
|
40
|
-
false
|
|
41
|
-
else
|
|
42
|
-
@compiled_content_cache.full_cache_available?(rep)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
25
|
end
|
|
46
26
|
end
|
|
47
27
|
end
|
|
@@ -18,15 +18,14 @@ module Nanoc
|
|
|
18
18
|
|
|
19
19
|
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
|
20
20
|
def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
|
21
|
-
dependency_tracker = Nanoc::Core::DependencyTracker.new(@dependency_store)
|
|
22
|
-
dependency_tracker.enter(rep.item)
|
|
21
|
+
dependency_tracker = Nanoc::Core::DependencyTracker.new(@dependency_store, root: rep.item)
|
|
23
22
|
|
|
24
23
|
executor = Nanoc::Core::Executor.new(rep, @compilation_context, dependency_tracker)
|
|
25
24
|
|
|
26
25
|
# Set initial content, if not already present
|
|
27
|
-
|
|
28
|
-
unless
|
|
29
|
-
|
|
26
|
+
compiled_content_repo = @compilation_context.compiled_content_repo
|
|
27
|
+
unless compiled_content_repo.get_current(rep)
|
|
28
|
+
compiled_content_repo.set_current(rep, rep.item.content)
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
actions = pending_action_sequence_for(rep:)
|
|
@@ -48,8 +47,6 @@ module Nanoc
|
|
|
48
47
|
|
|
49
48
|
actions.shift
|
|
50
49
|
end
|
|
51
|
-
ensure
|
|
52
|
-
dependency_tracker.exit
|
|
53
50
|
end
|
|
54
51
|
|
|
55
52
|
def pending_action_sequence_for(rep:)
|
|
@@ -6,25 +6,14 @@ module Nanoc
|
|
|
6
6
|
class Write < Abstract
|
|
7
7
|
include Nanoc::Core::ContractsSupport
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def initialize(compiled_content_store:, wrapped:)
|
|
9
|
+
def initialize(compiled_content_repo:, wrapped:)
|
|
12
10
|
super(wrapped:)
|
|
13
11
|
|
|
14
|
-
@
|
|
15
|
-
|
|
16
|
-
@pool = Concurrent::FixedThreadPool.new(WORKER_POOL_SIZE)
|
|
12
|
+
@compiled_content_repo = compiled_content_repo
|
|
17
13
|
|
|
18
14
|
@writer = Nanoc::Core::ItemRepWriter.new
|
|
19
15
|
end
|
|
20
16
|
|
|
21
|
-
def stop
|
|
22
|
-
@pool.shutdown
|
|
23
|
-
@pool.wait_for_termination
|
|
24
|
-
|
|
25
|
-
super
|
|
26
|
-
end
|
|
27
|
-
|
|
28
17
|
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
|
29
18
|
def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
|
30
19
|
yield
|
|
@@ -34,9 +23,7 @@ module Nanoc
|
|
|
34
23
|
# notification happens before the :rep_write_enqueued one.
|
|
35
24
|
Nanoc::Core::NotificationCenter.post(:rep_write_enqueued, rep)
|
|
36
25
|
|
|
37
|
-
@
|
|
38
|
-
@writer.write_all(rep, @compiled_content_store)
|
|
39
|
-
end
|
|
26
|
+
@writer.write_all(rep, @compiled_content_repo)
|
|
40
27
|
end
|
|
41
28
|
end
|
|
42
29
|
end
|
|
@@ -88,12 +88,12 @@ module Nanoc
|
|
|
88
88
|
|
|
89
89
|
cache_phase = Nanoc::Core::CompilationPhases::Cache.new(
|
|
90
90
|
compiled_content_cache: @compiled_content_cache,
|
|
91
|
-
|
|
91
|
+
compiled_content_repo: @compilation_context.compiled_content_repo,
|
|
92
92
|
wrapped: recalculate_phase,
|
|
93
93
|
)
|
|
94
94
|
|
|
95
95
|
write_phase = Nanoc::Core::CompilationPhases::Write.new(
|
|
96
|
-
|
|
96
|
+
compiled_content_repo: @compilation_context.compiled_content_repo,
|
|
97
97
|
wrapped: cache_phase,
|
|
98
98
|
)
|
|
99
99
|
|
data/lib/nanoc/core/compiler.rb
CHANGED
|
@@ -29,7 +29,7 @@ module Nanoc
|
|
|
29
29
|
@outdatedness_store = outdatedness_store
|
|
30
30
|
@focus = focus
|
|
31
31
|
|
|
32
|
-
@
|
|
32
|
+
@compiled_content_repo = Nanoc::Core::CompiledContentRepo.new
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def run_until_preprocessed
|
|
@@ -99,7 +99,8 @@ module Nanoc
|
|
|
99
99
|
reps:,
|
|
100
100
|
site: @site,
|
|
101
101
|
compiled_content_cache: @compiled_content_cache,
|
|
102
|
-
|
|
102
|
+
compiled_content_repo: @compiled_content_repo,
|
|
103
|
+
outdatedness_store: @outdatedness_store,
|
|
103
104
|
)
|
|
104
105
|
end
|
|
105
106
|
|
|
@@ -36,38 +36,25 @@ module Nanoc
|
|
|
36
36
|
]
|
|
37
37
|
|
|
38
38
|
attr_reader :dependency_store
|
|
39
|
+
attr_reader :root
|
|
39
40
|
|
|
40
|
-
def initialize(dependency_store)
|
|
41
|
+
def initialize(dependency_store, root:)
|
|
41
42
|
@dependency_store = dependency_store
|
|
42
|
-
@
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
contract C_OBJ, C_ARGS => C::Any
|
|
46
|
-
def enter(obj, raw_content: false, attributes: false, compiled_content: false, path: false)
|
|
47
|
-
unless @stack.empty?
|
|
48
|
-
Nanoc::Core::NotificationCenter.post(:dependency_created, @stack.last, obj)
|
|
49
|
-
@dependency_store.record_dependency(
|
|
50
|
-
@stack.last,
|
|
51
|
-
obj,
|
|
52
|
-
raw_content:,
|
|
53
|
-
attributes:,
|
|
54
|
-
compiled_content:,
|
|
55
|
-
path:,
|
|
56
|
-
)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
@stack.push(obj)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
contract C_OBJ => C::Any
|
|
63
|
-
def exit
|
|
64
|
-
@stack.pop
|
|
43
|
+
@root = root
|
|
65
44
|
end
|
|
66
45
|
|
|
67
46
|
contract C_OBJ, C_ARGS => C::Any
|
|
68
47
|
def bounce(obj, raw_content: false, attributes: false, compiled_content: false, path: false)
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
Nanoc::Core::NotificationCenter.post(:dependency_created, @root, obj)
|
|
49
|
+
|
|
50
|
+
@dependency_store.record_dependency(
|
|
51
|
+
@root,
|
|
52
|
+
obj,
|
|
53
|
+
raw_content:,
|
|
54
|
+
attributes:,
|
|
55
|
+
compiled_content:,
|
|
56
|
+
path:,
|
|
57
|
+
)
|
|
71
58
|
end
|
|
72
59
|
|
|
73
60
|
class Null < DependencyTracker
|
|
@@ -75,12 +62,6 @@ module Nanoc
|
|
|
75
62
|
|
|
76
63
|
def initialize; end
|
|
77
64
|
|
|
78
|
-
contract C_OBJ, C_ARGS => C::Any
|
|
79
|
-
def enter(_obj, raw_content: false, attributes: false, compiled_content: false, path: false); end
|
|
80
|
-
|
|
81
|
-
contract C_OBJ => C::Any
|
|
82
|
-
def exit; end
|
|
83
|
-
|
|
84
65
|
contract C_OBJ, C_ARGS => C::Any
|
|
85
66
|
def bounce(_obj, raw_content: false, attributes: false, compiled_content: false, path: false); end
|
|
86
67
|
end
|
data/lib/nanoc/core/errors.rb
CHANGED
|
@@ -79,9 +79,9 @@ module Nanoc
|
|
|
79
79
|
cycle.each.with_index do |r, i|
|
|
80
80
|
msg_bits << " (#{i + 1}) item #{r.item.identifier}, rep #{r.name.inspect}, uses compiled content of"
|
|
81
81
|
end
|
|
82
|
-
msg_bits << msg_bits.pop + ' (1)'
|
|
82
|
+
msg_bits << (msg_bits.pop + ' (1)')
|
|
83
83
|
|
|
84
|
-
super(msg_bits.map { |x| x + "\n" }.join
|
|
84
|
+
super(msg_bits.map { |x| x + "\n" }.join)
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
data/lib/nanoc/core/executor.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Nanoc
|
|
|
16
16
|
Nanoc::Core::NotificationCenter.post(:filtering_started, @rep, filter_name)
|
|
17
17
|
|
|
18
18
|
# Run filter
|
|
19
|
-
last = @compilation_context.
|
|
19
|
+
last = @compilation_context.compiled_content_repo.get_current(@rep)
|
|
20
20
|
source = last.binary? ? last.filename : last.string
|
|
21
21
|
filter_args.freeze
|
|
22
22
|
result = filter.setup_and_run(source, filter_args)
|
|
@@ -28,7 +28,7 @@ module Nanoc
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# Store
|
|
31
|
-
@compilation_context.
|
|
31
|
+
@compilation_context.compiled_content_repo.set_current(@rep, last)
|
|
32
32
|
ensure
|
|
33
33
|
Nanoc::Core::NotificationCenter.post(:filtering_ended, @rep, filter_name)
|
|
34
34
|
end
|
|
@@ -47,7 +47,7 @@ module Nanoc
|
|
|
47
47
|
filter_args.freeze
|
|
48
48
|
|
|
49
49
|
# Check whether item can be laid out
|
|
50
|
-
last = @compilation_context.
|
|
50
|
+
last = @compilation_context.compiled_content_repo.get_current(@rep)
|
|
51
51
|
raise Nanoc::Core::Errors::CannotLayoutBinaryItem.new(@rep) if last.binary?
|
|
52
52
|
|
|
53
53
|
# Create filter
|
|
@@ -68,15 +68,15 @@ module Nanoc
|
|
|
68
68
|
|
|
69
69
|
# Store
|
|
70
70
|
last = Nanoc::Core::TextualContent.new(res).tap(&:freeze)
|
|
71
|
-
@compilation_context.
|
|
71
|
+
@compilation_context.compiled_content_repo.set_current(@rep, last)
|
|
72
72
|
ensure
|
|
73
73
|
Nanoc::Core::NotificationCenter.post(:filtering_ended, @rep, filter_name)
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def snapshot(snapshot_name)
|
|
78
|
-
last = @compilation_context.
|
|
79
|
-
@compilation_context.
|
|
78
|
+
last = @compilation_context.compiled_content_repo.get_current(@rep)
|
|
79
|
+
@compilation_context.compiled_content_repo.set(@rep, snapshot_name, last)
|
|
80
80
|
Nanoc::Core::NotificationCenter.post(:snapshot_created, @rep, snapshot_name)
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -106,7 +106,7 @@ module Nanoc
|
|
|
106
106
|
def filter_for_filtering(filter_name)
|
|
107
107
|
klass = Nanoc::Core::Filter.named!(filter_name)
|
|
108
108
|
|
|
109
|
-
last = @compilation_context.
|
|
109
|
+
last = @compilation_context.compiled_content_repo.get_current(@rep)
|
|
110
110
|
if klass.from_binary? && !last.binary?
|
|
111
111
|
raise Nanoc::Core::Errors::CannotUseBinaryFilter.new(@rep, klass)
|
|
112
112
|
elsif !klass.from_binary? && last.binary?
|
|
@@ -127,7 +127,7 @@ module Nanoc
|
|
|
127
127
|
items: @compilation_context.site.items,
|
|
128
128
|
dependency_tracker: @dependency_tracker,
|
|
129
129
|
compilation_context: @compilation_context,
|
|
130
|
-
|
|
130
|
+
compiled_content_repo: @compilation_context.compiled_content_repo,
|
|
131
131
|
)
|
|
132
132
|
end
|
|
133
133
|
end
|
|
@@ -60,10 +60,10 @@ module Nanoc
|
|
|
60
60
|
|
|
61
61
|
case @type
|
|
62
62
|
when :legacy
|
|
63
|
-
@string = "/#{string}/".gsub(
|
|
63
|
+
@string = "/#{string}/".gsub(%r{^/+|/+$}, '/').freeze
|
|
64
64
|
when :full
|
|
65
|
-
raise InvalidIdentifierError.new(string) if string !~
|
|
66
|
-
raise InvalidFullIdentifierError.new(string) if string =~
|
|
65
|
+
raise InvalidIdentifierError.new(string) if string !~ %r{\A/}
|
|
66
|
+
raise InvalidFullIdentifierError.new(string) if string =~ %r{/\z}
|
|
67
67
|
|
|
68
68
|
@string = string.dup.freeze
|
|
69
69
|
else
|
|
@@ -133,11 +133,11 @@ module Nanoc
|
|
|
133
133
|
contract String => self
|
|
134
134
|
# @return [Nanoc::Core::Identifier]
|
|
135
135
|
def prefix(string)
|
|
136
|
-
unless
|
|
136
|
+
unless %r{\A/}.match?(string)
|
|
137
137
|
raise InvalidPrefixError.new(string)
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
-
Nanoc::Core::Identifier.new(string.sub(
|
|
140
|
+
Nanoc::Core::Identifier.new(string.sub(%r{/+\z}, '') + @string, type: @type)
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
contract C::None => String
|
|
@@ -152,7 +152,7 @@ module Nanoc
|
|
|
152
152
|
if extname.empty?
|
|
153
153
|
@string
|
|
154
154
|
else
|
|
155
|
-
@string[0
|
|
155
|
+
@string[0..(-extname.size - 1)]
|
|
156
156
|
end
|
|
157
157
|
end
|
|
158
158
|
|
|
@@ -174,7 +174,7 @@ module Nanoc
|
|
|
174
174
|
if extname.empty?
|
|
175
175
|
@string
|
|
176
176
|
else
|
|
177
|
-
@string[0
|
|
177
|
+
@string[0..(-extname.size - 2)]
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
|
|
@@ -57,22 +57,18 @@ module Nanoc
|
|
|
57
57
|
# Encode
|
|
58
58
|
paths = paths.map { |path| path.encode('UTF-8') }
|
|
59
59
|
|
|
60
|
-
# Validate format
|
|
61
60
|
paths.each do |path|
|
|
61
|
+
# Validate format
|
|
62
62
|
unless path.start_with?('/')
|
|
63
63
|
raise RouteWithoutSlashError.new(path, rep)
|
|
64
64
|
end
|
|
65
|
-
end
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
paths.each do |path|
|
|
66
|
+
# Validate uniqueness
|
|
69
67
|
if assigned_paths.include?(path)
|
|
70
68
|
# TODO: Include snapshot names in error message
|
|
71
69
|
reps = [assigned_paths[path], rep].sort_by { |r| [r.item.identifier, r.name] }
|
|
72
70
|
raise IdenticalRoutesError.new(path, *reps)
|
|
73
71
|
end
|
|
74
|
-
end
|
|
75
|
-
paths.each do |path|
|
|
76
72
|
assigned_paths[path] = rep
|
|
77
73
|
end
|
|
78
74
|
|
|
@@ -88,7 +84,7 @@ module Nanoc
|
|
|
88
84
|
@site.config[:index_filenames].each do |index_filename|
|
|
89
85
|
slashed_index_filename = '/' + index_filename
|
|
90
86
|
if basic_path.end_with?(slashed_index_filename)
|
|
91
|
-
return basic_path[0
|
|
87
|
+
return basic_path[0..(-index_filename.length - 1)]
|
|
92
88
|
end
|
|
93
89
|
end
|
|
94
90
|
|
|
@@ -8,21 +8,21 @@ module Nanoc
|
|
|
8
8
|
|
|
9
9
|
TMP_TEXT_ITEMS_DIR = 'text_items'
|
|
10
10
|
|
|
11
|
-
def write_all(item_rep,
|
|
11
|
+
def write_all(item_rep, compiled_content_repo)
|
|
12
12
|
written_paths = Set.new
|
|
13
13
|
|
|
14
14
|
item_rep.snapshot_defs.map(&:name).each do |snapshot_name|
|
|
15
|
-
write(item_rep,
|
|
15
|
+
write(item_rep, compiled_content_repo, snapshot_name, written_paths)
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def write(item_rep,
|
|
19
|
+
def write(item_rep, compiled_content_repo, snapshot_name, written_paths)
|
|
20
20
|
item_rep.raw_paths.fetch(snapshot_name, []).each do |raw_path|
|
|
21
|
-
write_single(item_rep,
|
|
21
|
+
write_single(item_rep, compiled_content_repo, snapshot_name, raw_path, written_paths)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def write_single(item_rep,
|
|
25
|
+
def write_single(item_rep, compiled_content_repo, snapshot_name, raw_path, written_paths)
|
|
26
26
|
assert Nanoc::Core::Assertions::PathIsAbsolute.new(path: raw_path)
|
|
27
27
|
|
|
28
28
|
# Don’t write twice
|
|
@@ -42,7 +42,7 @@ module Nanoc
|
|
|
42
42
|
:rep_write_started, item_rep, raw_path
|
|
43
43
|
)
|
|
44
44
|
|
|
45
|
-
content =
|
|
45
|
+
content = compiled_content_repo.get(item_rep, snapshot_name)
|
|
46
46
|
if content.binary?
|
|
47
47
|
temp_path = content.filename
|
|
48
48
|
else
|
|
@@ -134,7 +134,7 @@ module Nanoc
|
|
|
134
134
|
|
|
135
135
|
def attributes_unaffected?(status, dependency)
|
|
136
136
|
reason = status.reasons.find { |r| r.is_a?(Nanoc::Core::OutdatednessReasons::AttributesModified) }
|
|
137
|
-
reason && !dependency.props.attribute_keys.empty? &&
|
|
137
|
+
reason && !dependency.props.attribute_keys.empty? && !dependency.props.attribute_keys.intersect?(reason.attributes)
|
|
138
138
|
end
|
|
139
139
|
|
|
140
140
|
def raw_content_prop_causes_outdatedness?(objects, raw_content_prop)
|
|
@@ -32,16 +32,12 @@ module Nanoc
|
|
|
32
32
|
item_cache.key?(rep.name)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
contract Nanoc::Core::ItemRep, C::HashOf[Symbol => Nanoc::Core::
|
|
35
|
+
contract Nanoc::Core::ItemRep, C::HashOf[Symbol => Nanoc::Core::TextualContent] => C::Any
|
|
36
36
|
# Sets the compiled content for the given representation.
|
|
37
37
|
#
|
|
38
38
|
# This cached compiled content is a hash where the keys are the snapshot
|
|
39
39
|
# names, and the values the compiled content at the given snapshot.
|
|
40
40
|
def []=(rep, content)
|
|
41
|
-
# FIXME: once the binary content cache is properly enabled (no longer
|
|
42
|
-
# behind a feature flag), change contract to be TextualContent, rather
|
|
43
|
-
# than Content.
|
|
44
|
-
|
|
45
41
|
@cache[rep.item.identifier] ||= {}
|
|
46
42
|
@cache[rep.item.identifier][rep.name] = content
|
|
47
43
|
end
|
|
@@ -57,13 +53,6 @@ module Nanoc
|
|
|
57
53
|
end
|
|
58
54
|
end
|
|
59
55
|
|
|
60
|
-
# True if there is cached compiled content available for this item, and
|
|
61
|
-
# all entries are textual.
|
|
62
|
-
def full_cache_available?(rep)
|
|
63
|
-
cache = self[rep]
|
|
64
|
-
cache ? cache.none? { |_snapshot_name, content| content.binary? } : false
|
|
65
|
-
end
|
|
66
|
-
|
|
67
56
|
protected
|
|
68
57
|
|
|
69
58
|
def data
|
data/lib/nanoc/core/version.rb
CHANGED
|
@@ -9,26 +9,26 @@ module Nanoc
|
|
|
9
9
|
attr_reader :items
|
|
10
10
|
attr_reader :dependency_tracker
|
|
11
11
|
attr_reader :compilation_context
|
|
12
|
-
attr_reader :
|
|
12
|
+
attr_reader :compiled_content_repo
|
|
13
13
|
|
|
14
14
|
contract C::KeywordArgs[
|
|
15
15
|
reps: Nanoc::Core::ItemRepRepo,
|
|
16
16
|
items: Nanoc::Core::IdentifiableCollection,
|
|
17
17
|
dependency_tracker: Nanoc::Core::DependencyTracker,
|
|
18
18
|
compilation_context: Nanoc::Core::CompilationContext,
|
|
19
|
-
|
|
19
|
+
compiled_content_repo: Nanoc::Core::CompiledContentRepo,
|
|
20
20
|
] => C::Any
|
|
21
|
-
def initialize(reps:, items:, dependency_tracker:, compilation_context:,
|
|
21
|
+
def initialize(reps:, items:, dependency_tracker:, compilation_context:, compiled_content_repo:)
|
|
22
22
|
@reps = reps
|
|
23
23
|
@items = items
|
|
24
24
|
@dependency_tracker = dependency_tracker
|
|
25
25
|
@compilation_context = compilation_context
|
|
26
|
-
@
|
|
26
|
+
@compiled_content_repo = compiled_content_repo
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
contract Nanoc::Core::ItemRep, C::KeywordArgs[site: Nanoc::Core::Site] => Hash
|
|
30
30
|
def assigns_for(rep, site:)
|
|
31
|
-
last_content = @
|
|
31
|
+
last_content = @compiled_content_repo.get_current(rep)
|
|
32
32
|
content_or_filename_assigns =
|
|
33
33
|
if last_content.binary?
|
|
34
34
|
{ filename: last_content.filename }
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nanoc
|
|
4
|
+
module Core
|
|
5
|
+
class CompilationItemRepView < ::Nanoc::Core::BasicItemRepView
|
|
6
|
+
# @abstract
|
|
7
|
+
def item_view_class
|
|
8
|
+
Nanoc::Core::CompilationItemView
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Returns the item rep’s raw path. It includes the path to the output
|
|
12
|
+
# directory and the full filename.
|
|
13
|
+
#
|
|
14
|
+
# @param [Symbol] snapshot The snapshot for which the path should be
|
|
15
|
+
# returned.
|
|
16
|
+
#
|
|
17
|
+
# @return [String] The item rep’s raw path.
|
|
18
|
+
def raw_path(snapshot: :last)
|
|
19
|
+
@context.dependency_tracker.bounce(_unwrap.item, compiled_content: true)
|
|
20
|
+
|
|
21
|
+
raw_path = @item_rep.raw_path(snapshot:)
|
|
22
|
+
|
|
23
|
+
unless @item_rep.compiled?
|
|
24
|
+
could_load = _try_load_from_cache
|
|
25
|
+
|
|
26
|
+
unless could_load
|
|
27
|
+
raise Nanoc::Core::Errors::UnmetDependency.new(@item_rep, snapshot)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Ensure file exists
|
|
32
|
+
if raw_path && !File.file?(raw_path)
|
|
33
|
+
raise Nanoc::Core::Errors::InternalInconsistency,
|
|
34
|
+
"File `#{raw_path}` expected to exist, but did not."
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
raw_path
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Returns the compiled content.
|
|
41
|
+
#
|
|
42
|
+
# @param [String] snapshot The name of the snapshot from which to
|
|
43
|
+
# fetch the compiled content. By default, the returned compiled content
|
|
44
|
+
# will be the content compiled right before the first layout call (if
|
|
45
|
+
# any).
|
|
46
|
+
#
|
|
47
|
+
# @return [String] The content at the given snapshot.
|
|
48
|
+
def compiled_content(snapshot: nil)
|
|
49
|
+
compiled_content_repo = @context.compiled_content_repo
|
|
50
|
+
|
|
51
|
+
@context.dependency_tracker.bounce(@item_rep.item, compiled_content: true)
|
|
52
|
+
|
|
53
|
+
begin
|
|
54
|
+
compiled_content_repo.compiled_content(rep: @item_rep, snapshot:)
|
|
55
|
+
rescue Nanoc::Core::Errors::UnmetDependency => e
|
|
56
|
+
could_load = _try_load_from_cache
|
|
57
|
+
unless could_load
|
|
58
|
+
raise e
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Get the compiled content again. Previously in this method, this is
|
|
62
|
+
# what raised the `UnmetDependency` error.
|
|
63
|
+
compiled_content_repo.compiled_content(rep: @item_rep, snapshot:)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def _try_load_from_cache
|
|
68
|
+
# If we get an unmet dependency, try to load the content from the
|
|
69
|
+
# compiled content cache. If this is not possible, re-raise the unmet
|
|
70
|
+
# dependency error, and then let the compiler deal with it regularly.
|
|
71
|
+
|
|
72
|
+
compilation_context = @context.compilation_context
|
|
73
|
+
compiled_content_cache = compilation_context.compiled_content_cache
|
|
74
|
+
compiled_content_repo = compilation_context.compiled_content_repo
|
|
75
|
+
|
|
76
|
+
# Requirement: The item rep must not be marked as outdated.
|
|
77
|
+
outdated = compilation_context.outdatedness_store.include?(@item_rep)
|
|
78
|
+
return false if outdated
|
|
79
|
+
|
|
80
|
+
# Requirement: The compiled content cache must have a cache entry for this item rep.
|
|
81
|
+
cache_available = compiled_content_cache.full_cache_available?(@item_rep)
|
|
82
|
+
return false unless cache_available
|
|
83
|
+
|
|
84
|
+
# Load the compiled content from the cache
|
|
85
|
+
Nanoc::Core::NotificationCenter.post(:cached_content_used, @item_rep)
|
|
86
|
+
compiled_content_repo.set_all(@item_rep, compiled_content_cache[@item_rep])
|
|
87
|
+
|
|
88
|
+
# Mark as compiled
|
|
89
|
+
@item_rep.compiled = true
|
|
90
|
+
|
|
91
|
+
true
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
data/lib/nanoc/core.rb
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# Ruby stdlib
|
|
4
4
|
require 'base64'
|
|
5
|
-
require 'fiber'
|
|
6
5
|
require 'find'
|
|
7
6
|
require 'singleton'
|
|
8
7
|
require 'tmpdir'
|
|
@@ -48,7 +47,7 @@ module Nanoc
|
|
|
48
47
|
# @api private
|
|
49
48
|
def self.version_information
|
|
50
49
|
"Nanoc #{Nanoc::Core::VERSION} © 2007–… Denis Defreyne.\n" \
|
|
51
|
-
|
|
50
|
+
"Running #{RUBY_ENGINE} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} with RubyGems #{Gem::VERSION}.\n"
|
|
52
51
|
end
|
|
53
52
|
|
|
54
53
|
# @return [Boolean] True if the current platform is Windows, false otherwise.
|
|
@@ -74,6 +73,7 @@ end
|
|
|
74
73
|
loader = Zeitwerk::Loader.new
|
|
75
74
|
loader.inflector = inflector_class.new
|
|
76
75
|
loader.push_dir(__dir__ + '/..')
|
|
76
|
+
loader.push_dir(__dir__ + '/core/views', namespace: Nanoc::Core)
|
|
77
77
|
loader.ignore(__dir__ + '/../nanoc-core.rb')
|
|
78
78
|
loader.ignore(__dir__ + '/core/core_ext')
|
|
79
79
|
loader.setup
|
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.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis Defreyne
|
|
@@ -165,9 +165,6 @@ files:
|
|
|
165
165
|
- lib/nanoc/core/action_sequence_store.rb
|
|
166
166
|
- lib/nanoc/core/aggregate_data_source.rb
|
|
167
167
|
- lib/nanoc/core/assertions.rb
|
|
168
|
-
- lib/nanoc/core/basic_item_rep_collection_view.rb
|
|
169
|
-
- lib/nanoc/core/basic_item_rep_view.rb
|
|
170
|
-
- lib/nanoc/core/basic_item_view.rb
|
|
171
168
|
- lib/nanoc/core/basic_outdatedness_checker.rb
|
|
172
169
|
- lib/nanoc/core/binary_compiled_content_cache.rb
|
|
173
170
|
- lib/nanoc/core/binary_content.rb
|
|
@@ -177,9 +174,6 @@ files:
|
|
|
177
174
|
- lib/nanoc/core/checksummer.rb
|
|
178
175
|
- lib/nanoc/core/code_snippet.rb
|
|
179
176
|
- lib/nanoc/core/compilation_context.rb
|
|
180
|
-
- lib/nanoc/core/compilation_item_rep_collection_view.rb
|
|
181
|
-
- lib/nanoc/core/compilation_item_rep_view.rb
|
|
182
|
-
- lib/nanoc/core/compilation_item_view.rb
|
|
183
177
|
- lib/nanoc/core/compilation_phases/abstract.rb
|
|
184
178
|
- lib/nanoc/core/compilation_phases/cache.rb
|
|
185
179
|
- lib/nanoc/core/compilation_phases/mark_done.rb
|
|
@@ -200,11 +194,10 @@ files:
|
|
|
200
194
|
- lib/nanoc/core/compilation_stages/store_post_compilation_state.rb
|
|
201
195
|
- lib/nanoc/core/compilation_stages/store_pre_compilation_state.rb
|
|
202
196
|
- lib/nanoc/core/compiled_content_cache.rb
|
|
203
|
-
- lib/nanoc/core/
|
|
197
|
+
- lib/nanoc/core/compiled_content_repo.rb
|
|
204
198
|
- lib/nanoc/core/compiler.rb
|
|
205
199
|
- lib/nanoc/core/compiler_loader.rb
|
|
206
200
|
- lib/nanoc/core/config_loader.rb
|
|
207
|
-
- lib/nanoc/core/config_view.rb
|
|
208
201
|
- lib/nanoc/core/configuration-schema.json
|
|
209
202
|
- lib/nanoc/core/configuration.rb
|
|
210
203
|
- lib/nanoc/core/content.rb
|
|
@@ -227,14 +220,11 @@ files:
|
|
|
227
220
|
- lib/nanoc/core/feature.rb
|
|
228
221
|
- lib/nanoc/core/filter.rb
|
|
229
222
|
- lib/nanoc/core/identifiable_collection.rb
|
|
230
|
-
- lib/nanoc/core/identifiable_collection_view.rb
|
|
231
223
|
- lib/nanoc/core/identifier.rb
|
|
232
224
|
- lib/nanoc/core/in_memory_data_source.rb
|
|
233
225
|
- lib/nanoc/core/instrumentor.rb
|
|
234
226
|
- lib/nanoc/core/item.rb
|
|
235
227
|
- lib/nanoc/core/item_collection.rb
|
|
236
|
-
- lib/nanoc/core/item_collection_with_reps_view.rb
|
|
237
|
-
- lib/nanoc/core/item_collection_without_reps_view.rb
|
|
238
228
|
- lib/nanoc/core/item_rep.rb
|
|
239
229
|
- lib/nanoc/core/item_rep_builder.rb
|
|
240
230
|
- lib/nanoc/core/item_rep_repo.rb
|
|
@@ -243,16 +233,8 @@ files:
|
|
|
243
233
|
- lib/nanoc/core/item_rep_writer.rb
|
|
244
234
|
- lib/nanoc/core/layout.rb
|
|
245
235
|
- lib/nanoc/core/layout_collection.rb
|
|
246
|
-
- lib/nanoc/core/layout_collection_view.rb
|
|
247
|
-
- lib/nanoc/core/layout_view.rb
|
|
248
236
|
- lib/nanoc/core/lazy_value.rb
|
|
249
|
-
- lib/nanoc/core/mutable_config_view.rb
|
|
250
237
|
- lib/nanoc/core/mutable_document_view_mixin.rb
|
|
251
|
-
- lib/nanoc/core/mutable_identifiable_collection_view.rb
|
|
252
|
-
- lib/nanoc/core/mutable_item_collection_view.rb
|
|
253
|
-
- lib/nanoc/core/mutable_item_view.rb
|
|
254
|
-
- lib/nanoc/core/mutable_layout_collection_view.rb
|
|
255
|
-
- lib/nanoc/core/mutable_layout_view.rb
|
|
256
238
|
- lib/nanoc/core/notification_center.rb
|
|
257
239
|
- lib/nanoc/core/outdatedness_checker.rb
|
|
258
240
|
- lib/nanoc/core/outdatedness_reasons.rb
|
|
@@ -268,10 +250,6 @@ files:
|
|
|
268
250
|
- lib/nanoc/core/outdatedness_status.rb
|
|
269
251
|
- lib/nanoc/core/outdatedness_store.rb
|
|
270
252
|
- lib/nanoc/core/pattern.rb
|
|
271
|
-
- lib/nanoc/core/post_compile_item_collection_view.rb
|
|
272
|
-
- lib/nanoc/core/post_compile_item_rep_collection_view.rb
|
|
273
|
-
- lib/nanoc/core/post_compile_item_rep_view.rb
|
|
274
|
-
- lib/nanoc/core/post_compile_item_view.rb
|
|
275
253
|
- lib/nanoc/core/prefixed_data_source.rb
|
|
276
254
|
- lib/nanoc/core/processing_action.rb
|
|
277
255
|
- lib/nanoc/core/processing_actions.rb
|
|
@@ -297,13 +275,35 @@ files:
|
|
|
297
275
|
- lib/nanoc/core/view_context_for_compilation.rb
|
|
298
276
|
- lib/nanoc/core/view_context_for_pre_compilation.rb
|
|
299
277
|
- lib/nanoc/core/view_context_for_shell.rb
|
|
278
|
+
- lib/nanoc/core/views/basic_item_rep_collection_view.rb
|
|
279
|
+
- lib/nanoc/core/views/basic_item_rep_view.rb
|
|
280
|
+
- lib/nanoc/core/views/basic_item_view.rb
|
|
281
|
+
- lib/nanoc/core/views/compilation_item_rep_collection_view.rb
|
|
282
|
+
- lib/nanoc/core/views/compilation_item_rep_view.rb
|
|
283
|
+
- lib/nanoc/core/views/compilation_item_view.rb
|
|
284
|
+
- lib/nanoc/core/views/config_view.rb
|
|
285
|
+
- lib/nanoc/core/views/identifiable_collection_view.rb
|
|
286
|
+
- lib/nanoc/core/views/item_collection_with_reps_view.rb
|
|
287
|
+
- lib/nanoc/core/views/item_collection_without_reps_view.rb
|
|
288
|
+
- lib/nanoc/core/views/layout_collection_view.rb
|
|
289
|
+
- lib/nanoc/core/views/layout_view.rb
|
|
290
|
+
- lib/nanoc/core/views/mutable_config_view.rb
|
|
291
|
+
- lib/nanoc/core/views/mutable_identifiable_collection_view.rb
|
|
292
|
+
- lib/nanoc/core/views/mutable_item_collection_view.rb
|
|
293
|
+
- lib/nanoc/core/views/mutable_item_view.rb
|
|
294
|
+
- lib/nanoc/core/views/mutable_layout_collection_view.rb
|
|
295
|
+
- lib/nanoc/core/views/mutable_layout_view.rb
|
|
296
|
+
- lib/nanoc/core/views/post_compile_item_collection_view.rb
|
|
297
|
+
- lib/nanoc/core/views/post_compile_item_rep_collection_view.rb
|
|
298
|
+
- lib/nanoc/core/views/post_compile_item_rep_view.rb
|
|
299
|
+
- lib/nanoc/core/views/post_compile_item_view.rb
|
|
300
300
|
- lib/nanoc/core/yaml_loader.rb
|
|
301
301
|
homepage: https://nanoc.app/
|
|
302
302
|
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.6/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:
|
|
321
|
+
rubygems_version: 4.0.3
|
|
322
322
|
specification_version: 4
|
|
323
323
|
summary: Core of Nanoc
|
|
324
324
|
test_files: []
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Nanoc
|
|
4
|
-
module Core
|
|
5
|
-
class CompilationItemRepView < ::Nanoc::Core::BasicItemRepView
|
|
6
|
-
# How long to wait before the requested file appears.
|
|
7
|
-
#
|
|
8
|
-
# This is a bit of a hack -- ideally, Nanoc would know that the file is
|
|
9
|
-
# being generated, and wait the appropriate amount of time.
|
|
10
|
-
FILE_APPEAR_TIMEOUT = 10.0
|
|
11
|
-
|
|
12
|
-
# @abstract
|
|
13
|
-
def item_view_class
|
|
14
|
-
Nanoc::Core::CompilationItemView
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# Returns the item rep’s raw path. It includes the path to the output
|
|
18
|
-
# directory and the full filename.
|
|
19
|
-
#
|
|
20
|
-
# @param [Symbol] snapshot The snapshot for which the path should be
|
|
21
|
-
# returned.
|
|
22
|
-
#
|
|
23
|
-
# @return [String] The item rep’s raw path.
|
|
24
|
-
def raw_path(snapshot: :last)
|
|
25
|
-
@context.dependency_tracker.bounce(_unwrap.item, compiled_content: true)
|
|
26
|
-
|
|
27
|
-
res = @item_rep.raw_path(snapshot:)
|
|
28
|
-
|
|
29
|
-
unless @item_rep.compiled?
|
|
30
|
-
raise Nanoc::Core::Errors::UnmetDependency.new(@item_rep, snapshot)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Wait for file to exist
|
|
34
|
-
if res
|
|
35
|
-
start = Time.now
|
|
36
|
-
sleep 0.05 until File.file?(res) || Time.now - start > FILE_APPEAR_TIMEOUT
|
|
37
|
-
raise Nanoc::Core::Errors::InternalInconsistency, "File raw_path did not appear in time (#{FILE_APPEAR_TIMEOUT}s): #{res}" unless File.file?(res)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
res
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# Returns the compiled content.
|
|
44
|
-
#
|
|
45
|
-
# @param [String] snapshot The name of the snapshot from which to
|
|
46
|
-
# fetch the compiled content. By default, the returned compiled content
|
|
47
|
-
# will be the content compiled right before the first layout call (if
|
|
48
|
-
# any).
|
|
49
|
-
#
|
|
50
|
-
# @return [String] The content at the given snapshot.
|
|
51
|
-
def compiled_content(snapshot: nil)
|
|
52
|
-
@context.dependency_tracker.bounce(_unwrap.item, compiled_content: true)
|
|
53
|
-
@context.compiled_content_store.compiled_content(rep: _unwrap, snapshot:)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
/data/lib/nanoc/core/{basic_item_rep_collection_view.rb → views/basic_item_rep_collection_view.rb}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/nanoc/core/{identifiable_collection_view.rb → views/identifiable_collection_view.rb}
RENAMED
|
File without changes
|
/data/lib/nanoc/core/{item_collection_with_reps_view.rb → views/item_collection_with_reps_view.rb}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/nanoc/core/{mutable_item_collection_view.rb → views/mutable_item_collection_view.rb}
RENAMED
|
File without changes
|
|
File without changes
|
/data/lib/nanoc/core/{mutable_layout_collection_view.rb → views/mutable_layout_collection_view.rb}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|