nanoc-core 4.12.14 → 4.13.0
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/action_sequence.rb +4 -4
- data/lib/nanoc/core/action_sequence_store.rb +1 -1
- data/lib/nanoc/core/basic_item_rep_view.rb +1 -1
- data/lib/nanoc/core/binary_compiled_content_cache.rb +1 -1
- data/lib/nanoc/core/changes_stream.rb +4 -4
- data/lib/nanoc/core/checksum_store.rb +1 -1
- data/lib/nanoc/core/checksummer.rb +16 -7
- data/lib/nanoc/core/compilation_item_rep_view.rb +2 -2
- data/lib/nanoc/core/compilation_item_view.rb +2 -2
- data/lib/nanoc/core/compilation_phases/abstract.rb +2 -2
- data/lib/nanoc/core/compilation_phases/cache.rb +2 -2
- data/lib/nanoc/core/compilation_phases/mark_done.rb +1 -1
- data/lib/nanoc/core/compilation_phases/resume.rb +1 -1
- data/lib/nanoc/core/compilation_phases/write.rb +1 -1
- data/lib/nanoc/core/compilation_stages/build_reps.rb +2 -2
- data/lib/nanoc/core/compilation_stages/compile_reps.rb +24 -7
- data/lib/nanoc/core/compiled_content_cache.rb +3 -3
- data/lib/nanoc/core/compiled_content_store.rb +1 -1
- data/lib/nanoc/core/compiler.rb +31 -29
- data/lib/nanoc/core/compiler_loader.rb +9 -8
- data/lib/nanoc/core/config_loader.rb +1 -3
- data/lib/nanoc/core/config_view.rb +3 -3
- data/lib/nanoc/core/configuration.rb +5 -5
- data/lib/nanoc/core/content.rb +13 -13
- data/lib/nanoc/core/context.rb +1 -1
- data/lib/nanoc/core/core_ext/array.rb +12 -8
- data/lib/nanoc/core/data_source.rb +3 -3
- data/lib/nanoc/core/dependency_props.rb +2 -2
- data/lib/nanoc/core/dependency_store.rb +4 -4
- data/lib/nanoc/core/dependency_tracker.rb +5 -5
- data/lib/nanoc/core/document_view_mixin.rb +1 -1
- data/lib/nanoc/core/feature.rb +2 -2
- data/lib/nanoc/core/identifiable_collection.rb +3 -3
- data/lib/nanoc/core/identifiable_collection_view.rb +2 -2
- data/lib/nanoc/core/identifier.rb +2 -2
- data/lib/nanoc/core/item.rb +7 -0
- data/lib/nanoc/core/item_rep_builder.rb +19 -19
- data/lib/nanoc/core/item_rep_repo.rb +2 -2
- data/lib/nanoc/core/layout.rb +7 -0
- data/lib/nanoc/core/mutable_identifiable_collection_view.rb +1 -1
- data/lib/nanoc/core/mutable_item_collection_view.rb +1 -1
- data/lib/nanoc/core/notification_center.rb +3 -3
- data/lib/nanoc/core/outdatedness_checker.rb +3 -3
- data/lib/nanoc/core/outdatedness_rule.rb +15 -15
- data/lib/nanoc/core/outdatedness_store.rb +1 -1
- data/lib/nanoc/core/post_compile_item_rep_view.rb +1 -1
- data/lib/nanoc/core/processing_action.rb +1 -1
- data/lib/nanoc/core/pruner.rb +1 -1
- data/lib/nanoc/core/site_loader.rb +9 -10
- data/lib/nanoc/core/store.rb +16 -16
- data/lib/nanoc/core/textual_compiled_content_cache.rb +1 -1
- data/lib/nanoc/core/version.rb +1 -1
- data/lib/nanoc/core/yaml_loader.rb +23 -0
- data/lib/nanoc/core.rb +3 -2
- metadata +32 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d667fdfe9740b04cfb89b52ae97602abc239d3744d85667b049a477fd7340c3a
|
|
4
|
+
data.tar.gz: 58b70ca67a73647560e0761af9cc6d26ebd9eef643fa5145eae850209a096194
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4199cfa2dbbc0306afb33e476c72b258b1dd61fc979ca3d8ea4d4a49fb3d66fc8972f9577ea5d3ac264bdf15be6782538d392758ae5642cf304580e7e56259e
|
|
7
|
+
data.tar.gz: cfc6633370c3a6784061518d8001396fc094c5529e596c2283b75cc4ec8f581f29ac5c401c12253df1cb4a5982192648f3a02d5ad67a271d218ea53e729b8544
|
|
@@ -44,15 +44,15 @@ module Nanoc
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
|
|
47
|
-
def each(&
|
|
48
|
-
@actions.each(&
|
|
47
|
+
def each(&)
|
|
48
|
+
@actions.each(&)
|
|
49
49
|
self
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
|
|
53
|
-
def map(&
|
|
53
|
+
def map(&)
|
|
54
54
|
self.class.new(
|
|
55
|
-
actions: @actions.map(&
|
|
55
|
+
actions: @actions.map(&),
|
|
56
56
|
)
|
|
57
57
|
end
|
|
58
58
|
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
|
|
14
|
+
super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'rule_memory'), 2)
|
|
15
15
|
|
|
16
16
|
@action_sequences = {}
|
|
17
17
|
end
|
|
@@ -57,7 +57,7 @@ module Nanoc
|
|
|
57
57
|
# @return [String] The item rep’s path.
|
|
58
58
|
def path(snapshot: :last)
|
|
59
59
|
@context.dependency_tracker.bounce(_unwrap.item, path: true)
|
|
60
|
-
@item_rep.path(snapshot:
|
|
60
|
+
@item_rep.path(snapshot:)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# Returns the item that this item rep belongs to.
|
|
@@ -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
|
|
14
|
+
super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'binary_content'), 3)
|
|
15
15
|
|
|
16
16
|
@cache = {}
|
|
17
17
|
end
|
|
@@ -38,16 +38,16 @@ module Nanoc
|
|
|
38
38
|
@listener&.to_stop&.call
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def map(&
|
|
42
|
-
self.class.new(enum: @enum.map(&
|
|
41
|
+
def map(&)
|
|
42
|
+
self.class.new(enum: @enum.map(&))
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def to_enum
|
|
46
46
|
@enum
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
def each(&
|
|
50
|
-
@enum.each(&
|
|
49
|
+
def each(&)
|
|
50
|
+
@enum.each(&)
|
|
51
51
|
nil
|
|
52
52
|
end
|
|
53
53
|
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
|
|
19
|
+
super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'checksums'), 3)
|
|
20
20
|
|
|
21
21
|
@objects = objects
|
|
22
22
|
|
|
@@ -61,14 +61,19 @@ module Nanoc
|
|
|
61
61
|
|
|
62
62
|
private
|
|
63
63
|
|
|
64
|
-
def update(obj, digest, visited =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
digest.update(
|
|
64
|
+
def update(obj, digest, visited = {})
|
|
65
|
+
num = visited[obj]
|
|
66
|
+
if num
|
|
67
|
+
# If there already is an entry for this object, refer to it by its number.
|
|
68
|
+
digest.update("@#{num}")
|
|
69
69
|
else
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
# This object isn’t known yet. Assign it a new number.
|
|
71
|
+
num = visited.length
|
|
72
|
+
visited[obj] = num
|
|
73
|
+
|
|
74
|
+
digest.update(obj.class.to_s)
|
|
75
|
+
digest.update("##{num}<")
|
|
76
|
+
behavior_for(obj).update(obj, digest) { |o| update(o, digest, visited) }
|
|
72
77
|
digest.update('>')
|
|
73
78
|
end
|
|
74
79
|
end
|
|
@@ -276,11 +281,15 @@ module Nanoc
|
|
|
276
281
|
|
|
277
282
|
class RescueUpdateBehavior < UpdateBehavior
|
|
278
283
|
def self.update(obj, digest)
|
|
284
|
+
# rubocop:disable Style/ClassEqualityComparison
|
|
285
|
+
# This Rubocop rule is disabled because the class
|
|
286
|
+
# itself might not be loaded (yet).
|
|
279
287
|
if obj.class.to_s == 'Sass::Importers::Filesystem'
|
|
280
288
|
digest.update('root=')
|
|
281
289
|
digest.update(obj.root)
|
|
282
290
|
return
|
|
283
291
|
end
|
|
292
|
+
# rubocop:enable Style/ClassEqualityComparison
|
|
284
293
|
|
|
285
294
|
data =
|
|
286
295
|
begin
|
|
@@ -24,7 +24,7 @@ module Nanoc
|
|
|
24
24
|
def raw_path(snapshot: :last)
|
|
25
25
|
@context.dependency_tracker.bounce(_unwrap.item, compiled_content: true)
|
|
26
26
|
|
|
27
|
-
res = @item_rep.raw_path(snapshot:
|
|
27
|
+
res = @item_rep.raw_path(snapshot:)
|
|
28
28
|
|
|
29
29
|
unless @item_rep.compiled?
|
|
30
30
|
Fiber.yield(Nanoc::Core::Errors::UnmetDependency.new(@item_rep, snapshot))
|
|
@@ -50,7 +50,7 @@ module Nanoc
|
|
|
50
50
|
# @return [String] The content at the given snapshot.
|
|
51
51
|
def compiled_content(snapshot: nil)
|
|
52
52
|
@context.dependency_tracker.bounce(_unwrap.item, compiled_content: true)
|
|
53
|
-
@context.compiled_content_store.compiled_content(rep: _unwrap, snapshot:
|
|
53
|
+
@context.compiled_content_store.compiled_content(rep: _unwrap, snapshot:)
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
end
|
|
@@ -16,7 +16,7 @@ module Nanoc
|
|
|
16
16
|
#
|
|
17
17
|
# @return [String] The content of the given rep at the given snapshot.
|
|
18
18
|
def compiled_content(rep: :default, snapshot: nil)
|
|
19
|
-
reps.fetch(rep).compiled_content(snapshot:
|
|
19
|
+
reps.fetch(rep).compiled_content(snapshot:)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# Returns the item path, as used when being linked to. It starts
|
|
@@ -33,7 +33,7 @@ module Nanoc
|
|
|
33
33
|
#
|
|
34
34
|
# @return [String] The item’s path.
|
|
35
35
|
def path(rep: :default, snapshot: :last)
|
|
36
|
-
reps.fetch(rep).path(snapshot:
|
|
36
|
+
reps.fetch(rep).path(snapshot:)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# Returns the representations of this item.
|
|
@@ -20,9 +20,9 @@ module Nanoc
|
|
|
20
20
|
|
|
21
21
|
def call(rep, is_outdated:)
|
|
22
22
|
notify(:phase_started, rep)
|
|
23
|
-
run(rep, is_outdated:
|
|
23
|
+
run(rep, is_outdated:) do
|
|
24
24
|
notify(:phase_yielded, rep)
|
|
25
|
-
@wrapped.call(rep, is_outdated:
|
|
25
|
+
@wrapped.call(rep, is_outdated:)
|
|
26
26
|
notify(:phase_resumed, rep)
|
|
27
27
|
end
|
|
28
28
|
notify(:phase_ended, rep)
|
|
@@ -9,7 +9,7 @@ module Nanoc
|
|
|
9
9
|
include Nanoc::Core::ContractsSupport
|
|
10
10
|
|
|
11
11
|
def initialize(wrapped:, compiled_content_cache:, compiled_content_store:)
|
|
12
|
-
super(wrapped:
|
|
12
|
+
super(wrapped:)
|
|
13
13
|
|
|
14
14
|
@compiled_content_cache = compiled_content_cache
|
|
15
15
|
@compiled_content_store = compiled_content_store
|
|
@@ -17,7 +17,7 @@ module Nanoc
|
|
|
17
17
|
|
|
18
18
|
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
|
19
19
|
def run(rep, is_outdated:)
|
|
20
|
-
if can_reuse_content_for_rep?(rep, is_outdated:
|
|
20
|
+
if can_reuse_content_for_rep?(rep, is_outdated:)
|
|
21
21
|
# If cached content can be used for this item rep, do so, and skip
|
|
22
22
|
# recalculation of the item rep compiled content.
|
|
23
23
|
Nanoc::Core::NotificationCenter.post(:cached_content_used, rep)
|
|
@@ -11,7 +11,7 @@ module Nanoc
|
|
|
11
11
|
|
|
12
12
|
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
|
13
13
|
def run(rep, is_outdated:, &block)
|
|
14
|
-
fiber = fiber_for(rep, is_outdated
|
|
14
|
+
fiber = fiber_for(rep, is_outdated:, &block)
|
|
15
15
|
while fiber.alive?
|
|
16
16
|
res = fiber.resume
|
|
17
17
|
|
|
@@ -7,30 +7,47 @@ module Nanoc
|
|
|
7
7
|
include Nanoc::Core::ContractsSupport
|
|
8
8
|
include Nanoc::Core::Assertions::Mixin
|
|
9
9
|
|
|
10
|
-
def initialize(reps:, outdatedness_store:, dependency_store:, action_sequences:, compilation_context:, compiled_content_cache:)
|
|
10
|
+
def initialize(reps:, outdatedness_store:, dependency_store:, action_sequences:, compilation_context:, compiled_content_cache:, focus:)
|
|
11
11
|
@reps = reps
|
|
12
12
|
@outdatedness_store = outdatedness_store
|
|
13
13
|
@dependency_store = dependency_store
|
|
14
14
|
@action_sequences = action_sequences
|
|
15
15
|
@compilation_context = compilation_context
|
|
16
16
|
@compiled_content_cache = compiled_content_cache
|
|
17
|
+
@focus = focus
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def run
|
|
20
21
|
outdated_reps = @reps.select { |r| @outdatedness_store.include?(r) }
|
|
22
|
+
|
|
23
|
+
# If a focus is specified, only compile reps that match this focus.
|
|
24
|
+
# (If no focus is specified, `@focus` will be `nil`, not an empty array.)
|
|
25
|
+
if @focus
|
|
26
|
+
focus_patterns = @focus.map { |f| Nanoc::Core::Pattern.from(f) }
|
|
27
|
+
|
|
28
|
+
# Find reps for which at least one focus pattern matches.
|
|
29
|
+
outdated_reps = outdated_reps.select do |irep|
|
|
30
|
+
focus_patterns.any? do |focus_pattern|
|
|
31
|
+
focus_pattern.match?(irep.item.identifier)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
21
36
|
selector = Nanoc::Core::ItemRepSelector.new(outdated_reps)
|
|
22
37
|
run_phase_stack do |phase_stack|
|
|
23
38
|
selector.each do |rep|
|
|
24
39
|
handle_errors_while(rep) do
|
|
25
|
-
compile_rep(rep, phase_stack
|
|
40
|
+
compile_rep(rep, phase_stack:, is_outdated: @outdatedness_store.include?(rep))
|
|
26
41
|
end
|
|
27
42
|
end
|
|
28
43
|
end
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
unless @focus
|
|
46
|
+
assert Nanoc::Core::Assertions::AllItemRepsHaveCompiledContent.new(
|
|
47
|
+
compiled_content_cache: @compiled_content_cache,
|
|
48
|
+
item_reps: @reps,
|
|
49
|
+
)
|
|
50
|
+
end
|
|
34
51
|
ensure
|
|
35
52
|
@outdatedness_store.store
|
|
36
53
|
@compiled_content_cache.prune(items: @reps.map(&:item).uniq)
|
|
@@ -46,7 +63,7 @@ module Nanoc
|
|
|
46
63
|
end
|
|
47
64
|
|
|
48
65
|
def compile_rep(rep, phase_stack:, is_outdated:)
|
|
49
|
-
phase_stack.call(rep, is_outdated:
|
|
66
|
+
phase_stack.call(rep, is_outdated:)
|
|
50
67
|
end
|
|
51
68
|
|
|
52
69
|
def run_phase_stack
|
|
@@ -11,8 +11,8 @@ module Nanoc
|
|
|
11
11
|
|
|
12
12
|
contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
|
|
13
13
|
def initialize(config:)
|
|
14
|
-
@textual_cache = Nanoc::Core::TextualCompiledContentCache.new(config:
|
|
15
|
-
@binary_cache = Nanoc::Core::BinaryCompiledContentCache.new(config:
|
|
14
|
+
@textual_cache = Nanoc::Core::TextualCompiledContentCache.new(config:)
|
|
15
|
+
@binary_cache = Nanoc::Core::BinaryCompiledContentCache.new(config:)
|
|
16
16
|
|
|
17
17
|
@wrapped_caches = [@textual_cache, @binary_cache]
|
|
18
18
|
end
|
|
@@ -47,7 +47,7 @@ module Nanoc
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def prune(items:)
|
|
50
|
-
@wrapped_caches.each { |w| w.prune(items:
|
|
50
|
+
@wrapped_caches.each { |w| w.prune(items:) }
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
# True if there is cached compiled content available for this item, and
|
|
@@ -64,7 +64,7 @@ module Nanoc
|
|
|
64
64
|
|
|
65
65
|
contract C::KeywordArgs[rep: Nanoc::Core::ItemRep, snapshot: C::Optional[C::Maybe[Symbol]]] => String
|
|
66
66
|
def compiled_content(rep:, snapshot: nil)
|
|
67
|
-
snapshot_content = raw_compiled_content(rep
|
|
67
|
+
snapshot_content = raw_compiled_content(rep:, snapshot:)
|
|
68
68
|
|
|
69
69
|
if snapshot_content.binary?
|
|
70
70
|
raise Nanoc::Core::Errors::CannotGetCompiledContentOfBinaryItem.new(rep)
|
data/lib/nanoc/core/compiler.rb
CHANGED
|
@@ -5,7 +5,17 @@ module Nanoc
|
|
|
5
5
|
class Compiler
|
|
6
6
|
include Nanoc::Core::ContractsSupport
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
contract Nanoc::Core::Site => C::Any
|
|
9
|
+
def self.compile(site, focus: nil)
|
|
10
|
+
new_for(site, focus:).run_until_end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
contract Nanoc::Core::Site => Nanoc::Core::Compiler
|
|
14
|
+
def self.new_for(site, focus: nil)
|
|
15
|
+
Nanoc::Core::CompilerLoader.new.load(site, focus:)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:, focus:)
|
|
9
19
|
@site = site
|
|
10
20
|
|
|
11
21
|
# Needed because configuration is mutable :(
|
|
@@ -17,20 +27,11 @@ module Nanoc
|
|
|
17
27
|
@dependency_store = dependency_store
|
|
18
28
|
@action_provider = action_provider
|
|
19
29
|
@outdatedness_store = outdatedness_store
|
|
30
|
+
@focus = focus
|
|
20
31
|
|
|
21
32
|
@compiled_content_store = Nanoc::Core::CompiledContentStore.new
|
|
22
33
|
end
|
|
23
34
|
|
|
24
|
-
contract Nanoc::Core::Site => C::Any
|
|
25
|
-
def self.compile(site)
|
|
26
|
-
new_for(site).run_until_end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
contract Nanoc::Core::Site => Nanoc::Core::Compiler
|
|
30
|
-
def self.new_for(site)
|
|
31
|
-
Nanoc::Core::CompilerLoader.new.load(site)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
35
|
def run_until_preprocessed
|
|
35
36
|
@_res_preprocessed ||= begin
|
|
36
37
|
preprocess_stage.call
|
|
@@ -60,17 +61,17 @@ module Nanoc
|
|
|
60
61
|
load_stores_stage.call
|
|
61
62
|
checksums = calculate_checksums_stage.call
|
|
62
63
|
outdatedness_checker = create_outdatedness_checker(
|
|
63
|
-
checksums
|
|
64
|
-
action_sequences
|
|
65
|
-
reps
|
|
64
|
+
checksums:,
|
|
65
|
+
action_sequences:,
|
|
66
|
+
reps:,
|
|
66
67
|
)
|
|
67
68
|
outdated_items = determine_outdatedness_stage(outdatedness_checker, reps).call
|
|
68
69
|
|
|
69
70
|
prev.merge(
|
|
70
|
-
checksums
|
|
71
|
+
checksums:,
|
|
71
72
|
dependency_store: @dependency_store,
|
|
72
|
-
outdatedness_checker
|
|
73
|
-
outdated_items
|
|
73
|
+
outdatedness_checker:,
|
|
74
|
+
outdated_items:,
|
|
74
75
|
)
|
|
75
76
|
end
|
|
76
77
|
end
|
|
@@ -95,7 +96,7 @@ module Nanoc
|
|
|
95
96
|
def compilation_context(reps:)
|
|
96
97
|
Nanoc::Core::CompilationContext.new(
|
|
97
98
|
action_provider: @action_provider,
|
|
98
|
-
reps
|
|
99
|
+
reps:,
|
|
99
100
|
site: @site,
|
|
100
101
|
compiled_content_cache: @compiled_content_cache,
|
|
101
102
|
compiled_content_store: @compiled_content_store,
|
|
@@ -110,9 +111,9 @@ module Nanoc
|
|
|
110
111
|
checksum_store: @checksum_store,
|
|
111
112
|
dependency_store: @dependency_store,
|
|
112
113
|
action_sequence_store: @action_sequence_store,
|
|
113
|
-
action_sequences
|
|
114
|
-
checksums
|
|
115
|
-
reps
|
|
114
|
+
action_sequences:,
|
|
115
|
+
checksums:,
|
|
116
|
+
reps:,
|
|
116
117
|
)
|
|
117
118
|
end
|
|
118
119
|
|
|
@@ -135,7 +136,7 @@ module Nanoc
|
|
|
135
136
|
def prune_stage(reps)
|
|
136
137
|
@_prune_stage ||= ::Nanoc::Core::CompilationStages::Prune.new(
|
|
137
138
|
config: @site.config,
|
|
138
|
-
reps
|
|
139
|
+
reps:,
|
|
139
140
|
)
|
|
140
141
|
end
|
|
141
142
|
|
|
@@ -160,30 +161,31 @@ module Nanoc
|
|
|
160
161
|
|
|
161
162
|
def determine_outdatedness_stage(outdatedness_checker, reps)
|
|
162
163
|
@_determine_outdatedness_stage ||= ::Nanoc::Core::CompilationStages::DetermineOutdatedness.new(
|
|
163
|
-
reps
|
|
164
|
-
outdatedness_checker
|
|
164
|
+
reps:,
|
|
165
|
+
outdatedness_checker:,
|
|
165
166
|
outdatedness_store: @outdatedness_store,
|
|
166
167
|
)
|
|
167
168
|
end
|
|
168
169
|
|
|
169
170
|
def store_pre_compilation_state_stage(action_sequences, reps)
|
|
170
171
|
@_store_pre_compilation_state_stage ||= ::Nanoc::Core::CompilationStages::StorePreCompilationState.new(
|
|
171
|
-
reps
|
|
172
|
+
reps:,
|
|
172
173
|
layouts: @site.layouts,
|
|
173
174
|
checksum_store: @checksum_store,
|
|
174
175
|
action_sequence_store: @action_sequence_store,
|
|
175
|
-
action_sequences
|
|
176
|
+
action_sequences:,
|
|
176
177
|
)
|
|
177
178
|
end
|
|
178
179
|
|
|
179
180
|
def compile_reps_stage(action_sequences, reps)
|
|
180
181
|
@_compile_reps_stage ||= ::Nanoc::Core::CompilationStages::CompileReps.new(
|
|
181
|
-
reps
|
|
182
|
+
reps:,
|
|
182
183
|
outdatedness_store: @outdatedness_store,
|
|
183
184
|
dependency_store: @dependency_store,
|
|
184
|
-
action_sequences
|
|
185
|
-
compilation_context: compilation_context(reps:
|
|
185
|
+
action_sequences:,
|
|
186
|
+
compilation_context: compilation_context(reps:),
|
|
186
187
|
compiled_content_cache: @compiled_content_cache,
|
|
188
|
+
focus: @focus,
|
|
187
189
|
)
|
|
188
190
|
end
|
|
189
191
|
|
|
@@ -4,7 +4,7 @@ module Nanoc
|
|
|
4
4
|
module Core
|
|
5
5
|
# @api private
|
|
6
6
|
class CompilerLoader
|
|
7
|
-
def load(site, action_provider: nil)
|
|
7
|
+
def load(site, focus: nil, action_provider: nil)
|
|
8
8
|
action_sequence_store = Nanoc::Core::ActionSequenceStore.new(config: site.config)
|
|
9
9
|
|
|
10
10
|
dependency_store =
|
|
@@ -13,7 +13,7 @@ module Nanoc
|
|
|
13
13
|
objects = site.items.to_a + site.layouts.to_a + site.code_snippets + [site.config]
|
|
14
14
|
|
|
15
15
|
checksum_store =
|
|
16
|
-
Nanoc::Core::ChecksumStore.new(config: site.config, objects:
|
|
16
|
+
Nanoc::Core::ChecksumStore.new(config: site.config, objects:)
|
|
17
17
|
|
|
18
18
|
action_provider ||= Nanoc::Core::ActionProvider.named(site.config.action_provider).for(site)
|
|
19
19
|
|
|
@@ -24,12 +24,13 @@ module Nanoc
|
|
|
24
24
|
compiled_content_cache_class.new(config: site.config)
|
|
25
25
|
|
|
26
26
|
params = {
|
|
27
|
-
compiled_content_cache
|
|
28
|
-
checksum_store
|
|
29
|
-
action_sequence_store
|
|
30
|
-
dependency_store
|
|
31
|
-
action_provider
|
|
32
|
-
outdatedness_store
|
|
27
|
+
compiled_content_cache:,
|
|
28
|
+
checksum_store:,
|
|
29
|
+
action_sequence_store:,
|
|
30
|
+
dependency_store:,
|
|
31
|
+
action_provider:,
|
|
32
|
+
outdatedness_store:,
|
|
33
|
+
focus:,
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
Nanoc::Core::Compiler.new(site, **params)
|
|
@@ -4,8 +4,6 @@ module Nanoc
|
|
|
4
4
|
module Core
|
|
5
5
|
# @api private
|
|
6
6
|
class ConfigLoader
|
|
7
|
-
PERMITTED_YAML_CLASSES = [Symbol, Date, Time].freeze
|
|
8
|
-
|
|
9
7
|
class NoConfigFileFoundError < ::Nanoc::Core::Error
|
|
10
8
|
def initialize
|
|
11
9
|
super('No configuration file found')
|
|
@@ -56,7 +54,7 @@ module Nanoc
|
|
|
56
54
|
end
|
|
57
55
|
|
|
58
56
|
def load_file(filename)
|
|
59
|
-
|
|
57
|
+
YamlLoader.load_file(filename)
|
|
60
58
|
end
|
|
61
59
|
|
|
62
60
|
# @api private
|
|
@@ -20,7 +20,7 @@ module Nanoc
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# @see Hash#fetch
|
|
23
|
-
def fetch(key, fallback = Nanoc::Core::UNDEFINED, &
|
|
23
|
+
def fetch(key, fallback = Nanoc::Core::UNDEFINED, &)
|
|
24
24
|
@context.dependency_tracker.bounce(_unwrap, attributes: [key])
|
|
25
25
|
@config.fetch(key) do
|
|
26
26
|
if !Nanoc::Core::UNDEFINED.equal?(fallback)
|
|
@@ -46,9 +46,9 @@ module Nanoc
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# @see Hash#each
|
|
49
|
-
def each(&
|
|
49
|
+
def each(&)
|
|
50
50
|
@context.dependency_tracker.bounce(_unwrap, attributes: true)
|
|
51
|
-
@config.each(&
|
|
51
|
+
@config.each(&)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# @see Configuration#env_name
|
|
@@ -21,7 +21,7 @@ module Nanoc
|
|
|
21
21
|
# that lacks some options, the default value will be taken from
|
|
22
22
|
# `DEFAULT_CONFIG`.
|
|
23
23
|
DEFAULT_CONFIG = {
|
|
24
|
-
text_extensions: %w[adoc asciidoc atom css erb haml htm html js less markdown md php rb sass scss tex txt xhtml xml coffee hb handlebars mustache ms slim rdoc].sort,
|
|
24
|
+
text_extensions: %w[adoc asciidoc atom css erb haml htm html js less markdown md org php rb sass scss tex txt xhtml xml coffee hb handlebars mustache ms slim rdoc].sort,
|
|
25
25
|
lib_dirs: %w[lib],
|
|
26
26
|
commands_dirs: %w[commands],
|
|
27
27
|
output_dir: 'output',
|
|
@@ -72,7 +72,7 @@ module Nanoc
|
|
|
72
72
|
# Load given environment configuration
|
|
73
73
|
env_config = @wrapped[ENVIRONMENTS_CONFIG_KEY].fetch(env_name.to_sym, {})
|
|
74
74
|
|
|
75
|
-
self.class.new(hash: @wrapped, dir: @dir, env_name:
|
|
75
|
+
self.class.new(hash: @wrapped, dir: @dir, env_name:).merge(env_config)
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
contract C::None => Hash
|
|
@@ -102,7 +102,7 @@ module Nanoc
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
contract C::Any, C::Maybe[C::Any], C::Maybe[C::Func[C::None => C::Any]] => C::Any
|
|
105
|
-
def fetch(key, fallback = Nanoc::Core::UNDEFINED, &
|
|
105
|
+
def fetch(key, fallback = Nanoc::Core::UNDEFINED, &)
|
|
106
106
|
@wrapped.fetch(key) do
|
|
107
107
|
if !Nanoc::Core::UNDEFINED.equal?(fallback)
|
|
108
108
|
fallback
|
|
@@ -136,8 +136,8 @@ module Nanoc
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
contract C::Func[C::Any, C::Any => C::Any] => self
|
|
139
|
-
def each(&
|
|
140
|
-
@wrapped.each(&
|
|
139
|
+
def each(&)
|
|
140
|
+
@wrapped.each(&)
|
|
141
141
|
self
|
|
142
142
|
end
|
|
143
143
|
|
data/lib/nanoc/core/content.rb
CHANGED
|
@@ -5,6 +5,19 @@ module Nanoc
|
|
|
5
5
|
class Content
|
|
6
6
|
include Nanoc::Core::ContractsSupport
|
|
7
7
|
|
|
8
|
+
contract C::Or[self, String, Proc], C::KeywordArgs[binary: C::Optional[C::Bool], filename: C::Optional[C::Maybe[String]]] => self
|
|
9
|
+
def self.create(content, binary: false, filename: nil)
|
|
10
|
+
if content.nil?
|
|
11
|
+
raise ArgumentError, 'Cannot create nil content'
|
|
12
|
+
elsif content.is_a?(Nanoc::Core::Content)
|
|
13
|
+
content
|
|
14
|
+
elsif binary
|
|
15
|
+
Nanoc::Core::BinaryContent.new(content)
|
|
16
|
+
else
|
|
17
|
+
Nanoc::Core::TextualContent.new(content, filename:)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
8
21
|
contract C::None => C::Maybe[String]
|
|
9
22
|
attr_reader :filename
|
|
10
23
|
|
|
@@ -24,19 +37,6 @@ module Nanoc
|
|
|
24
37
|
self
|
|
25
38
|
end
|
|
26
39
|
|
|
27
|
-
contract C::Or[self, String, Proc], C::KeywordArgs[binary: C::Optional[C::Bool], filename: C::Optional[C::Maybe[String]]] => self
|
|
28
|
-
def self.create(content, binary: false, filename: nil)
|
|
29
|
-
if content.nil?
|
|
30
|
-
raise ArgumentError, 'Cannot create nil content'
|
|
31
|
-
elsif content.is_a?(Nanoc::Core::Content)
|
|
32
|
-
content
|
|
33
|
-
elsif binary
|
|
34
|
-
Nanoc::Core::BinaryContent.new(content)
|
|
35
|
-
else
|
|
36
|
-
Nanoc::Core::TextualContent.new(content, filename: filename)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
40
|
contract C::None => C::Bool
|
|
41
41
|
def binary?
|
|
42
42
|
raise NotImplementedError
|
data/lib/nanoc/core/context.rb
CHANGED
|
@@ -39,7 +39,7 @@ module Nanoc
|
|
|
39
39
|
end
|
|
40
40
|
# rubocop:enable Naming/AccessorMethodName
|
|
41
41
|
|
|
42
|
-
def method_missing(method, *args, &
|
|
42
|
+
def method_missing(method, *args, &)
|
|
43
43
|
ivar_name = '@' + method.to_s
|
|
44
44
|
if instance_variable_defined?(ivar_name)
|
|
45
45
|
instance_variable_get(ivar_name)
|