nanoc 4.11.0 → 4.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +6 -0
- data/lib/nanoc.rb +4 -7
- data/lib/nanoc/base.rb +3 -3
- data/lib/nanoc/base/assertions.rb +1 -1
- data/lib/nanoc/base/entities.rb +2 -20
- data/lib/nanoc/base/entities/action_sequence.rb +60 -64
- data/lib/nanoc/base/entities/checksum_collection.rb +23 -21
- data/lib/nanoc/base/entities/dependency.rb +24 -22
- data/lib/nanoc/base/entities/outdatedness_reasons.rb +74 -72
- data/lib/nanoc/base/entities/outdatedness_status.rb +19 -17
- data/lib/nanoc/base/entities/props.rb +119 -117
- data/lib/nanoc/base/entities/site.rb +46 -50
- data/lib/nanoc/base/errors.rb +183 -198
- data/lib/nanoc/base/repos.rb +4 -2
- data/lib/nanoc/base/repos/action_sequence_store.rb +44 -42
- data/lib/nanoc/base/repos/aggregate_data_source.rb +24 -22
- data/lib/nanoc/base/repos/checksum_store.rb +51 -49
- data/lib/nanoc/base/repos/compiled_content_cache.rb +47 -45
- data/lib/nanoc/base/repos/compiled_content_store.rb +76 -0
- data/lib/nanoc/base/repos/config_loader.rb +74 -72
- data/lib/nanoc/base/repos/dependency_store.rb +174 -172
- data/lib/nanoc/base/repos/in_mem_data_source.rb +17 -15
- data/lib/nanoc/base/repos/item_rep_repo.rb +26 -24
- data/lib/nanoc/base/repos/outdatedness_store.rb +50 -48
- data/lib/nanoc/base/repos/prefixed_data_source.rb +21 -19
- data/lib/nanoc/base/repos/site_loader.rb +75 -73
- data/lib/nanoc/base/repos/store.rb +93 -91
- data/lib/nanoc/base/services.rb +7 -3
- data/lib/nanoc/base/services/action_provider.rb +23 -21
- data/lib/nanoc/base/services/action_sequence_builder.rb +42 -34
- data/lib/nanoc/base/services/compilation_context.rb +49 -47
- data/lib/nanoc/base/services/compiler.rb +177 -170
- data/lib/nanoc/base/services/compiler/phases.rb +8 -1
- data/lib/nanoc/base/services/compiler/phases/abstract.rb +44 -38
- data/lib/nanoc/base/services/compiler/phases/cache.rb +34 -28
- data/lib/nanoc/base/services/compiler/phases/mark_done.rb +17 -11
- data/lib/nanoc/base/services/compiler/phases/notify.rb +21 -0
- data/lib/nanoc/base/services/compiler/phases/recalculate.rb +37 -31
- data/lib/nanoc/base/services/compiler/phases/resume.rb +47 -48
- data/lib/nanoc/base/services/compiler/phases/write.rb +65 -59
- data/lib/nanoc/base/services/compiler/stage.rb +27 -8
- data/lib/nanoc/base/services/compiler/stages.rb +7 -1
- data/lib/nanoc/base/services/compiler/stages/build_reps.rb +25 -19
- data/lib/nanoc/base/services/compiler/stages/calculate_checksums.rb +34 -28
- data/lib/nanoc/base/services/compiler/stages/cleanup.rb +33 -27
- data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +79 -69
- data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +46 -40
- data/lib/nanoc/base/services/compiler/stages/forget_outdated_dependencies.rb +15 -9
- data/lib/nanoc/base/services/compiler/stages/load_stores.rb +28 -22
- data/lib/nanoc/base/services/compiler/stages/postprocess.rb +16 -10
- data/lib/nanoc/base/services/compiler/stages/preprocess.rb +25 -19
- data/lib/nanoc/base/services/compiler/stages/prune.rb +23 -17
- data/lib/nanoc/base/services/compiler/stages/store_post_compilation_state.rb +15 -9
- data/lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb +26 -20
- data/lib/nanoc/base/services/compiler_loader.rb +26 -24
- data/lib/nanoc/base/services/dependency_tracker.rb +47 -45
- data/lib/nanoc/base/services/executor.rb +16 -15
- data/lib/nanoc/base/services/filter.rb +37 -5
- data/lib/nanoc/base/services/instrumentor.rb +12 -10
- data/lib/nanoc/base/services/item_rep_builder.rb +21 -19
- data/lib/nanoc/base/services/item_rep_router.rb +72 -70
- data/lib/nanoc/base/services/item_rep_selector.rb +48 -46
- data/lib/nanoc/base/services/item_rep_writer.rb +58 -53
- data/lib/nanoc/base/services/outdatedness_checker.rb +181 -179
- data/lib/nanoc/base/services/outdatedness_rule.rb +23 -21
- data/lib/nanoc/base/services/outdatedness_rules.rb +5 -3
- data/lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb +28 -24
- data/lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb +20 -16
- data/lib/nanoc/base/services/outdatedness_rules/content_modified.rb +13 -9
- data/lib/nanoc/base/services/outdatedness_rules/item_collection_extended.rb +12 -8
- data/lib/nanoc/base/services/outdatedness_rules/layout_collection_extended.rb +12 -8
- data/lib/nanoc/base/services/outdatedness_rules/not_written.rb +10 -6
- data/lib/nanoc/base/services/outdatedness_rules/rules_modified.rb +39 -35
- data/lib/nanoc/base/services/outdatedness_rules/uses_always_outdated_filter.rb +19 -15
- data/lib/nanoc/base/services/pruner.rb +2 -2
- data/lib/nanoc/base/views.rb +7 -0
- data/lib/nanoc/base/views/basic_item_view.rb +1 -1
- data/lib/nanoc/base/views/compilation_item_rep_view.rb +2 -2
- data/lib/nanoc/base/views/identifiable_collection_view.rb +2 -2
- data/lib/nanoc/base/views/mixins/document_view_mixin.rb +1 -1
- data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +5 -5
- data/lib/nanoc/base/views/mutable_item_collection_view.rb +3 -3
- data/lib/nanoc/base/views/mutable_layout_collection_view.rb +2 -2
- data/lib/nanoc/base/views/view_context_for_compilation.rb +6 -6
- data/lib/nanoc/base/views/view_context_for_pre_compilation.rb +2 -2
- data/lib/nanoc/base/views/view_context_for_shell.rb +2 -2
- data/lib/nanoc/checking/check.rb +1 -1
- data/lib/nanoc/cli/commands/compile_listeners/abstract.rb +24 -7
- data/lib/nanoc/cli/commands/compile_listeners/debug_printer.rb +79 -15
- data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +4 -7
- data/lib/nanoc/cli/commands/compile_listeners/file_action_printer.rb +15 -24
- data/lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb +22 -18
- data/lib/nanoc/cli/commands/create-site.rb +2 -7
- data/lib/nanoc/cli/commands/shell.rb +1 -1
- data/lib/nanoc/cli/commands/show-data.rb +9 -9
- data/lib/nanoc/cli/logger.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +8 -8
- data/lib/nanoc/filters/erb.rb +1 -1
- data/lib/nanoc/filters/erubi.rb +1 -1
- data/lib/nanoc/filters/erubis.rb +1 -1
- data/lib/nanoc/filters/haml.rb +1 -1
- data/lib/nanoc/filters/sass.rb +1 -1
- data/lib/nanoc/filters/slim.rb +1 -1
- data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
- data/lib/nanoc/helpers/capturing.rb +9 -8
- data/lib/nanoc/helpers/filtering.rb +2 -2
- data/lib/nanoc/helpers/rendering.rb +1 -1
- data/lib/nanoc/rule_dsl.rb +10 -0
- data/lib/nanoc/rule_dsl/action_provider.rb +3 -3
- data/lib/nanoc/rule_dsl/action_recorder.rb +3 -3
- data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +7 -7
- data/lib/nanoc/rule_dsl/compilation_rule.rb +2 -2
- data/lib/nanoc/rule_dsl/compilation_rule_context.rb +9 -9
- data/lib/nanoc/rule_dsl/compiler_dsl.rb +4 -4
- data/lib/nanoc/rule_dsl/routing_rule.rb +3 -3
- data/lib/nanoc/rule_dsl/rule.rb +5 -5
- data/lib/nanoc/rule_dsl/rule_context.rb +3 -3
- data/lib/nanoc/rule_dsl/rules_collection.rb +4 -4
- data/lib/nanoc/spec.rb +15 -15
- data/lib/nanoc/version.rb +1 -1
- metadata +10 -111
- data/lib/nanoc/base/contracts_support.rb +0 -130
- data/lib/nanoc/base/core_ext.rb +0 -5
- data/lib/nanoc/base/core_ext/array.rb +0 -50
- data/lib/nanoc/base/core_ext/hash.rb +0 -54
- data/lib/nanoc/base/core_ext/string.rb +0 -16
- data/lib/nanoc/base/entities/code_snippet.rb +0 -53
- data/lib/nanoc/base/entities/configuration-schema.json +0 -122
- data/lib/nanoc/base/entities/configuration.rb +0 -206
- data/lib/nanoc/base/entities/content.rb +0 -112
- data/lib/nanoc/base/entities/context.rb +0 -70
- data/lib/nanoc/base/entities/directed_graph.rb +0 -195
- data/lib/nanoc/base/entities/document.rb +0 -125
- data/lib/nanoc/base/entities/identifiable_collection.rb +0 -141
- data/lib/nanoc/base/entities/identifier.rb +0 -222
- data/lib/nanoc/base/entities/item.rb +0 -10
- data/lib/nanoc/base/entities/item_collection.rb +0 -14
- data/lib/nanoc/base/entities/item_rep.rb +0 -91
- data/lib/nanoc/base/entities/layout.rb +0 -10
- data/lib/nanoc/base/entities/layout_collection.rb +0 -14
- data/lib/nanoc/base/entities/lazy_value.rb +0 -43
- data/lib/nanoc/base/entities/pattern.rb +0 -85
- data/lib/nanoc/base/entities/processing_action.rb +0 -21
- data/lib/nanoc/base/entities/processing_actions.rb +0 -5
- data/lib/nanoc/base/entities/processing_actions/filter.rb +0 -36
- data/lib/nanoc/base/entities/processing_actions/layout.rb +0 -36
- data/lib/nanoc/base/entities/processing_actions/snapshot.rb +0 -46
- data/lib/nanoc/base/entities/snapshot_def.rb +0 -22
- data/lib/nanoc/base/repos/data_source.rb +0 -168
- data/lib/nanoc/base/repos/snapshot_repo.rb +0 -67
- data/lib/nanoc/base/services/checksummer.rb +0 -274
- data/lib/nanoc/base/services/notification_center.rb +0 -87
- data/lib/nanoc/base/services/temp_filename_factory.rb +0 -52
data/lib/nanoc/base/services.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require_relative 'services/action_provider'
|
4
4
|
require_relative 'services/action_sequence_builder'
|
5
|
-
require_relative 'services/checksummer'
|
6
5
|
require_relative 'services/compilation_context'
|
7
6
|
require_relative 'services/compiler'
|
8
7
|
require_relative 'services/compiler_loader'
|
@@ -14,9 +13,7 @@ require_relative 'services/item_rep_builder'
|
|
14
13
|
require_relative 'services/item_rep_router'
|
15
14
|
require_relative 'services/item_rep_selector'
|
16
15
|
require_relative 'services/item_rep_writer'
|
17
|
-
require_relative 'services/notification_center'
|
18
16
|
require_relative 'services/pruner'
|
19
|
-
require_relative 'services/temp_filename_factory'
|
20
17
|
require_relative 'services/outdatedness_rule'
|
21
18
|
require_relative 'services/outdatedness_rules'
|
22
19
|
|
@@ -24,3 +21,10 @@ require_relative 'services/compiler/phases'
|
|
24
21
|
require_relative 'services/compiler/stages'
|
25
22
|
|
26
23
|
require_relative 'services/outdatedness_checker'
|
24
|
+
|
25
|
+
# TODO: Move this into the entity, once the load order is improved (i.e. the
|
26
|
+
# checksummer is loaded after CodeSnippet).
|
27
|
+
Nanoc::Core::Checksummer.define_behavior(
|
28
|
+
Nanoc::Core::CodeSnippet,
|
29
|
+
Nanoc::Core::Checksummer::DataUpdateBehavior,
|
30
|
+
)
|
@@ -1,32 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Nanoc
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Nanoc
|
4
|
+
module Int
|
5
|
+
# @private
|
6
|
+
class ActionProvider
|
7
|
+
extend DDPlugin::Plugin
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def self.for(_site)
|
10
|
+
raise NotImplementedError
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
def rep_names_for(_item)
|
14
|
+
raise NotImplementedError
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
def action_sequence_for(_obj)
|
18
|
+
raise NotImplementedError
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
def need_preprocessing?
|
22
|
+
raise NotImplementedError
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
def preprocess(_site)
|
26
|
+
raise NotImplementedError
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
def postprocess(_site, _reps)
|
30
|
+
raise NotImplementedError
|
31
|
+
end
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -1,46 +1,54 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Nanoc
|
4
|
-
|
5
|
-
|
3
|
+
module Nanoc
|
4
|
+
module Int
|
5
|
+
class ActionSequenceBuilder
|
6
|
+
include Nanoc::Core::ContractsSupport
|
7
|
+
|
8
|
+
def self.build(rep)
|
9
|
+
builder = new(rep)
|
10
|
+
yield(builder)
|
11
|
+
builder.action_sequence
|
12
|
+
end
|
6
13
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
14
|
+
def initialize(item_rep)
|
15
|
+
@item_rep = item_rep
|
16
|
+
@actions = []
|
17
|
+
end
|
11
18
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
19
|
+
contract Symbol, Hash => self
|
20
|
+
def add_filter(filter_name, params)
|
21
|
+
@actions << Nanoc::Core::ProcessingActions::Filter.new(filter_name, params)
|
22
|
+
self
|
23
|
+
end
|
17
24
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
contract String, C::Maybe[Hash] => self
|
26
|
+
def add_layout(layout_identifier, params)
|
27
|
+
@actions << Nanoc::Core::ProcessingActions::Layout.new(layout_identifier, params)
|
28
|
+
self
|
29
|
+
end
|
23
30
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
31
|
+
contract Symbol, C::Maybe[String] => self
|
32
|
+
def add_snapshot(snapshot_name, path)
|
33
|
+
will_add_snapshot(snapshot_name)
|
34
|
+
@actions << Nanoc::Core::ProcessingActions::Snapshot.new([snapshot_name], path ? [path] : [])
|
35
|
+
self
|
36
|
+
end
|
30
37
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
contract C::None => Nanoc::Int::ActionSequence
|
39
|
+
def action_sequence
|
40
|
+
Nanoc::Int::ActionSequence.new(@item_rep, actions: @actions)
|
41
|
+
end
|
35
42
|
|
36
|
-
|
43
|
+
private
|
37
44
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
45
|
+
def will_add_snapshot(name)
|
46
|
+
@_snapshot_names ||= Set.new
|
47
|
+
if @_snapshot_names.include?(name)
|
48
|
+
raise Nanoc::Int::Errors::CannotCreateMultipleSnapshotsWithSameName.new(@item_rep, name)
|
49
|
+
else
|
50
|
+
@_snapshot_names << name
|
51
|
+
end
|
44
52
|
end
|
45
53
|
end
|
46
54
|
end
|
@@ -1,57 +1,59 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Nanoc
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def filter_name_and_args_for_layout(layout)
|
18
|
-
seq = @action_provider.action_sequence_for(layout)
|
19
|
-
if seq.nil? || seq.size != 1 || !seq[0].is_a?(Nanoc::Int::ProcessingActions::Filter)
|
20
|
-
raise Nanoc::Int::Errors::UndefinedFilterForLayout.new(layout)
|
3
|
+
module Nanoc
|
4
|
+
module Int
|
5
|
+
class CompilationContext
|
6
|
+
attr_reader :site
|
7
|
+
attr_reader :compiled_content_cache
|
8
|
+
attr_reader :compiled_content_store
|
9
|
+
|
10
|
+
def initialize(action_provider:, reps:, site:, compiled_content_cache:, compiled_content_store:)
|
11
|
+
@action_provider = action_provider
|
12
|
+
@reps = reps
|
13
|
+
@site = site
|
14
|
+
@compiled_content_cache = compiled_content_cache
|
15
|
+
@compiled_content_store = compiled_content_store
|
21
16
|
end
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Nanoc::ViewContextForCompilation.new(
|
28
|
-
reps: @reps,
|
29
|
-
items: @site.items,
|
30
|
-
dependency_tracker: dependency_tracker,
|
31
|
-
compilation_context: self,
|
32
|
-
snapshot_repo: @snapshot_repo,
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
def assigns_for(rep, dependency_tracker)
|
37
|
-
last_content = @snapshot_repo.get(rep, :last)
|
38
|
-
content_or_filename_assigns =
|
39
|
-
if last_content.binary?
|
40
|
-
{ filename: last_content.filename }
|
41
|
-
else
|
42
|
-
{ content: last_content.string }
|
18
|
+
def filter_name_and_args_for_layout(layout)
|
19
|
+
seq = @action_provider.action_sequence_for(layout)
|
20
|
+
if seq.nil? || seq.size != 1 || !seq[0].is_a?(Nanoc::Core::ProcessingActions::Filter)
|
21
|
+
raise Nanoc::Int::Errors::UndefinedFilterForLayout.new(layout)
|
43
22
|
end
|
44
23
|
|
45
|
-
|
24
|
+
[seq[0].filter_name, seq[0].params]
|
25
|
+
end
|
46
26
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
27
|
+
def create_view_context(dependency_tracker)
|
28
|
+
Nanoc::ViewContextForCompilation.new(
|
29
|
+
reps: @reps,
|
30
|
+
items: @site.items,
|
31
|
+
dependency_tracker: dependency_tracker,
|
32
|
+
compilation_context: self,
|
33
|
+
compiled_content_store: @compiled_content_store,
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def assigns_for(rep, dependency_tracker)
|
38
|
+
last_content = @compiled_content_store.get_current(rep)
|
39
|
+
content_or_filename_assigns =
|
40
|
+
if last_content.binary?
|
41
|
+
{ filename: last_content.filename }
|
42
|
+
else
|
43
|
+
{ content: last_content.string }
|
44
|
+
end
|
45
|
+
|
46
|
+
view_context = create_view_context(dependency_tracker)
|
47
|
+
|
48
|
+
content_or_filename_assigns.merge(
|
49
|
+
item: Nanoc::CompilationItemView.new(rep.item, view_context),
|
50
|
+
rep: Nanoc::CompilationItemRepView.new(rep, view_context),
|
51
|
+
item_rep: Nanoc::CompilationItemRepView.new(rep, view_context),
|
52
|
+
items: Nanoc::ItemCollectionWithRepsView.new(@site.items, view_context),
|
53
|
+
layouts: Nanoc::LayoutCollectionView.new(@site.layouts, view_context),
|
54
|
+
config: Nanoc::ConfigView.new(@site.config, view_context),
|
55
|
+
)
|
56
|
+
end
|
55
57
|
end
|
56
58
|
end
|
57
59
|
end
|
@@ -1,207 +1,214 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Nanoc
|
4
|
-
|
5
|
-
|
3
|
+
module Nanoc
|
4
|
+
module Int
|
5
|
+
class Compiler
|
6
|
+
include Nanoc::Core::ContractsSupport
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:)
|
9
|
+
@site = site
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
# Needed because configuration is mutable :(
|
12
|
+
@output_dirs = @site.config.output_dirs
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
@compiled_content_cache = compiled_content_cache
|
15
|
+
@checksum_store = checksum_store
|
16
|
+
@action_sequence_store = action_sequence_store
|
17
|
+
@dependency_store = dependency_store
|
18
|
+
@action_provider = action_provider
|
19
|
+
@outdatedness_store = outdatedness_store
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
@compiled_content_store = Nanoc::Int::CompiledContentStore.new
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
contract Nanoc::Int::Site => C::Any
|
25
|
+
def self.compile(site)
|
26
|
+
new_for(site).run_until_end
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
{}
|
29
|
+
contract Nanoc::Int::Site => Nanoc::Int::Compiler
|
30
|
+
def self.new_for(site)
|
31
|
+
Nanoc::Int::CompilerLoader.new.load(site)
|
32
32
|
end
|
33
|
-
end
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
def run_until_preprocessed
|
35
|
+
@_res_preprocessed ||= begin
|
36
|
+
preprocess_stage.call
|
37
|
+
{}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def run_until_reps_built
|
42
|
+
@_res_reps_built ||= begin
|
43
|
+
prev = run_until_preprocessed
|
44
|
+
|
45
|
+
res = build_reps_stage.call
|
46
|
+
|
47
|
+
prev.merge(
|
48
|
+
reps: res.fetch(:reps),
|
49
|
+
action_sequences: res.fetch(:action_sequences),
|
50
|
+
)
|
51
|
+
end
|
52
|
+
end
|
38
53
|
|
39
|
-
|
54
|
+
def run_until_precompiled
|
55
|
+
@_res_precompiled ||= begin
|
56
|
+
prev = run_until_reps_built
|
57
|
+
action_sequences = prev.fetch(:action_sequences)
|
58
|
+
reps = prev.fetch(:reps)
|
59
|
+
|
60
|
+
load_stores_stage.call
|
61
|
+
checksums = calculate_checksums_stage.call
|
62
|
+
outdatedness_checker = create_outdatedness_checker(
|
63
|
+
checksums: checksums,
|
64
|
+
action_sequences: action_sequences,
|
65
|
+
reps: reps,
|
66
|
+
)
|
67
|
+
outdated_items = determine_outdatedness_stage(outdatedness_checker, reps).call
|
68
|
+
|
69
|
+
prev.merge(
|
70
|
+
checksums: checksums,
|
71
|
+
dependency_store: @dependency_store,
|
72
|
+
outdatedness_checker: outdatedness_checker,
|
73
|
+
outdated_items: outdated_items,
|
74
|
+
)
|
75
|
+
end
|
76
|
+
end
|
40
77
|
|
41
|
-
|
42
|
-
|
43
|
-
|
78
|
+
def run_until_end
|
79
|
+
res = run_until_precompiled
|
80
|
+
action_sequences = res.fetch(:action_sequences)
|
81
|
+
reps = res.fetch(:reps)
|
82
|
+
checksums = res.fetch(:checksums)
|
83
|
+
outdated_items = res.fetch(:outdated_items)
|
84
|
+
|
85
|
+
forget_outdated_dependencies_stage.call(outdated_items)
|
86
|
+
store_pre_compilation_state_stage(action_sequences, reps).call(checksums)
|
87
|
+
prune_stage(reps).call
|
88
|
+
compile_reps_stage(action_sequences, reps).call
|
89
|
+
store_post_compilation_state_stage.call
|
90
|
+
postprocess_stage.call(self)
|
91
|
+
ensure
|
92
|
+
cleanup_stage.call
|
93
|
+
end
|
94
|
+
|
95
|
+
def compilation_context(reps:)
|
96
|
+
Nanoc::Int::CompilationContext.new(
|
97
|
+
action_provider: @action_provider,
|
98
|
+
reps: reps,
|
99
|
+
site: @site,
|
100
|
+
compiled_content_cache: @compiled_content_cache,
|
101
|
+
compiled_content_store: @compiled_content_store,
|
44
102
|
)
|
45
103
|
end
|
46
|
-
end
|
47
104
|
|
48
|
-
|
49
|
-
@_res_precompiled ||= begin
|
50
|
-
prev = run_until_reps_built
|
51
|
-
action_sequences = prev.fetch(:action_sequences)
|
52
|
-
reps = prev.fetch(:reps)
|
105
|
+
private
|
53
106
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
107
|
+
def create_outdatedness_checker(checksums:, action_sequences:, reps:)
|
108
|
+
Nanoc::Int::OutdatednessChecker.new(
|
109
|
+
site: @site,
|
110
|
+
checksum_store: @checksum_store,
|
111
|
+
dependency_store: @dependency_store,
|
112
|
+
action_sequence_store: @action_sequence_store,
|
58
113
|
action_sequences: action_sequences,
|
114
|
+
checksums: checksums,
|
59
115
|
reps: reps,
|
60
116
|
)
|
61
|
-
|
117
|
+
end
|
62
118
|
|
63
|
-
|
64
|
-
|
119
|
+
def preprocess_stage
|
120
|
+
@_preprocess_stage ||= Stages::Preprocess.new(
|
121
|
+
action_provider: @action_provider,
|
122
|
+
site: @site,
|
65
123
|
dependency_store: @dependency_store,
|
66
|
-
|
67
|
-
outdated_items: outdated_items,
|
124
|
+
checksum_store: @checksum_store,
|
68
125
|
)
|
69
126
|
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def run_until_end
|
73
|
-
res = run_until_precompiled
|
74
|
-
action_sequences = res.fetch(:action_sequences)
|
75
|
-
reps = res.fetch(:reps)
|
76
|
-
checksums = res.fetch(:checksums)
|
77
|
-
outdated_items = res.fetch(:outdated_items)
|
78
|
-
|
79
|
-
forget_outdated_dependencies_stage.call(outdated_items)
|
80
|
-
store_pre_compilation_state_stage(action_sequences, reps).call(checksums)
|
81
|
-
prune_stage(reps).call
|
82
|
-
compile_reps_stage(action_sequences, reps).call
|
83
|
-
store_post_compilation_state_stage.call
|
84
|
-
postprocess_stage.call(self)
|
85
|
-
ensure
|
86
|
-
cleanup_stage.call
|
87
|
-
end
|
88
|
-
|
89
|
-
def compilation_context(reps:)
|
90
|
-
Nanoc::Int::CompilationContext.new(
|
91
|
-
action_provider: @action_provider,
|
92
|
-
reps: reps,
|
93
|
-
site: @site,
|
94
|
-
compiled_content_cache: @compiled_content_cache,
|
95
|
-
snapshot_repo: @snapshot_repo,
|
96
|
-
)
|
97
|
-
end
|
98
|
-
|
99
|
-
private
|
100
|
-
|
101
|
-
def create_outdatedness_checker(checksums:, action_sequences:, reps:)
|
102
|
-
Nanoc::Int::OutdatednessChecker.new(
|
103
|
-
site: @site,
|
104
|
-
checksum_store: @checksum_store,
|
105
|
-
dependency_store: @dependency_store,
|
106
|
-
action_sequence_store: @action_sequence_store,
|
107
|
-
action_sequences: action_sequences,
|
108
|
-
checksums: checksums,
|
109
|
-
reps: reps,
|
110
|
-
)
|
111
|
-
end
|
112
|
-
|
113
|
-
def preprocess_stage
|
114
|
-
@_preprocess_stage ||= Stages::Preprocess.new(
|
115
|
-
action_provider: @action_provider,
|
116
|
-
site: @site,
|
117
|
-
dependency_store: @dependency_store,
|
118
|
-
checksum_store: @checksum_store,
|
119
|
-
)
|
120
|
-
end
|
121
127
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
+
def build_reps_stage
|
129
|
+
@_build_reps_stage ||= Stages::BuildReps.new(
|
130
|
+
site: @site,
|
131
|
+
action_provider: @action_provider,
|
132
|
+
)
|
133
|
+
end
|
128
134
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
+
def prune_stage(reps)
|
136
|
+
@_prune_stage ||= Stages::Prune.new(
|
137
|
+
config: @site.config,
|
138
|
+
reps: reps,
|
139
|
+
)
|
140
|
+
end
|
135
141
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
142
|
+
def load_stores_stage
|
143
|
+
@_load_stores_stage ||= Stages::LoadStores.new(
|
144
|
+
checksum_store: @checksum_store,
|
145
|
+
compiled_content_cache: @compiled_content_cache,
|
146
|
+
dependency_store: @dependency_store,
|
147
|
+
action_sequence_store: @action_sequence_store,
|
148
|
+
outdatedness_store: @outdatedness_store,
|
149
|
+
)
|
150
|
+
end
|
145
151
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
152
|
+
def calculate_checksums_stage
|
153
|
+
@_calculate_checksums_stage ||= Stages::CalculateChecksums.new(
|
154
|
+
items: @site.items,
|
155
|
+
layouts: @site.layouts,
|
156
|
+
code_snippets: @site.code_snippets,
|
157
|
+
config: @site.config,
|
158
|
+
)
|
159
|
+
end
|
154
160
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
161
|
+
def determine_outdatedness_stage(outdatedness_checker, reps)
|
162
|
+
@_determine_outdatedness_stage ||= Stages::DetermineOutdatedness.new(
|
163
|
+
reps: reps,
|
164
|
+
outdatedness_checker: outdatedness_checker,
|
165
|
+
outdatedness_store: @outdatedness_store,
|
166
|
+
)
|
167
|
+
end
|
162
168
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
169
|
+
def store_pre_compilation_state_stage(action_sequences, reps)
|
170
|
+
@_store_pre_compilation_state_stage ||= Stages::StorePreCompilationState.new(
|
171
|
+
reps: reps,
|
172
|
+
layouts: @site.layouts,
|
173
|
+
checksum_store: @checksum_store,
|
174
|
+
action_sequence_store: @action_sequence_store,
|
175
|
+
action_sequences: action_sequences,
|
176
|
+
)
|
177
|
+
end
|
172
178
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
179
|
+
def compile_reps_stage(action_sequences, reps)
|
180
|
+
@_compile_reps_stage ||= Stages::CompileReps.new(
|
181
|
+
reps: reps,
|
182
|
+
outdatedness_store: @outdatedness_store,
|
183
|
+
dependency_store: @dependency_store,
|
184
|
+
action_sequences: action_sequences,
|
185
|
+
compilation_context: compilation_context(reps: reps),
|
186
|
+
compiled_content_cache: @compiled_content_cache,
|
187
|
+
)
|
188
|
+
end
|
183
189
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
190
|
+
def store_post_compilation_state_stage
|
191
|
+
@_store_post_compilation_state_stage ||= Stages::StorePostCompilationState.new(
|
192
|
+
dependency_store: @dependency_store,
|
193
|
+
)
|
194
|
+
end
|
189
195
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
+
def postprocess_stage
|
197
|
+
@_postprocess_stage ||= Stages::Postprocess.new(
|
198
|
+
action_provider: @action_provider,
|
199
|
+
site: @site,
|
200
|
+
)
|
201
|
+
end
|
196
202
|
|
197
|
-
|
198
|
-
|
199
|
-
|
203
|
+
def cleanup_stage
|
204
|
+
@_cleanup_stage ||= Stages::Cleanup.new(@output_dirs)
|
205
|
+
end
|
200
206
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
207
|
+
def forget_outdated_dependencies_stage
|
208
|
+
@_forget_outdated_dependencies_stage ||= Stages::ForgetOutdatedDependencies.new(
|
209
|
+
dependency_store: @dependency_store,
|
210
|
+
)
|
211
|
+
end
|
205
212
|
end
|
206
213
|
end
|
207
214
|
end
|