nanoc 4.11.12 → 4.11.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +7 -1
- data/bin/nanoc +1 -1
- data/lib/nanoc.rb +2 -27
- data/lib/nanoc/base.rb +3 -6
- data/lib/nanoc/base/errors.rb +6 -104
- data/lib/nanoc/checking/check.rb +4 -4
- data/lib/nanoc/checking/checks/external_links.rb +1 -1
- data/lib/nanoc/checking/checks/stale.rb +1 -1
- data/lib/nanoc/checking/runner.rb +2 -2
- data/lib/nanoc/data_sources/filesystem/tools.rb +4 -4
- data/lib/nanoc/extra.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +8 -8
- data/lib/nanoc/helpers/capturing.rb +1 -1
- data/lib/nanoc/helpers/link_to.rb +1 -1
- data/lib/nanoc/orig_cli.rb +20 -0
- data/lib/nanoc/{cli → orig_cli}/commands/check.rb +3 -3
- data/lib/nanoc/{cli → orig_cli}/commands/deploy.rb +8 -8
- data/lib/nanoc/{cli → orig_cli}/commands/show-rules.rb +3 -3
- data/lib/nanoc/rule_dsl/action_provider.rb +5 -5
- data/lib/nanoc/rule_dsl/action_recorder.rb +4 -4
- data/lib/nanoc/rule_dsl/compilation_rule_context.rb +1 -1
- data/lib/nanoc/rule_dsl/compiler_dsl.rb +1 -1
- data/lib/nanoc/rule_dsl/rule_context.rb +6 -6
- data/lib/nanoc/version.rb +1 -1
- metadata +13 -152
- data/lib/nanoc/base/error.rb +0 -7
- data/lib/nanoc/base/feature.rb +0 -104
- data/lib/nanoc/base/repos.rb +0 -4
- data/lib/nanoc/base/repos/config_loader.rb +0 -95
- data/lib/nanoc/base/repos/site_loader.rb +0 -102
- data/lib/nanoc/base/services.rb +0 -23
- data/lib/nanoc/base/services/compiler.rb +0 -214
- data/lib/nanoc/base/services/compiler/phases.rb +0 -19
- data/lib/nanoc/base/services/compiler/phases/abstract.rb +0 -50
- data/lib/nanoc/base/services/compiler/phases/cache.rb +0 -45
- data/lib/nanoc/base/services/compiler/phases/mark_done.rb +0 -25
- data/lib/nanoc/base/services/compiler/phases/notify.rb +0 -21
- data/lib/nanoc/base/services/compiler/phases/recalculate.rb +0 -51
- data/lib/nanoc/base/services/compiler/phases/resume.rb +0 -54
- data/lib/nanoc/base/services/compiler/phases/write.rb +0 -86
- data/lib/nanoc/base/services/compiler/stages.rb +0 -23
- data/lib/nanoc/base/services/compiler/stages/build_reps.rb +0 -38
- data/lib/nanoc/base/services/compiler/stages/calculate_checksums.rb +0 -44
- data/lib/nanoc/base/services/compiler/stages/cleanup.rb +0 -45
- data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +0 -98
- data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +0 -51
- data/lib/nanoc/base/services/compiler/stages/forget_outdated_dependencies.rb +0 -22
- data/lib/nanoc/base/services/compiler/stages/load_stores.rb +0 -37
- data/lib/nanoc/base/services/compiler/stages/postprocess.rb +0 -23
- data/lib/nanoc/base/services/compiler/stages/preprocess.rb +0 -34
- data/lib/nanoc/base/services/compiler/stages/prune.rb +0 -32
- data/lib/nanoc/base/services/compiler/stages/store_post_compilation_state.rb +0 -22
- data/lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb +0 -34
- data/lib/nanoc/base/services/compiler_loader.rb +0 -48
- data/lib/nanoc/base/services/executor.rb +0 -134
- data/lib/nanoc/base/services/filter.rb +0 -267
- data/lib/nanoc/base/services/item_rep_builder.rb +0 -54
- data/lib/nanoc/base/services/item_rep_selector.rb +0 -69
- data/lib/nanoc/base/services/item_rep_writer.rb +0 -86
- data/lib/nanoc/base/services/outdatedness_checker.rb +0 -222
- data/lib/nanoc/base/services/outdatedness_rules.rb +0 -18
- data/lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb +0 -41
- data/lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb +0 -31
- data/lib/nanoc/base/services/outdatedness_rules/content_modified.rb +0 -21
- data/lib/nanoc/base/services/outdatedness_rules/item_collection_extended.rb +0 -20
- data/lib/nanoc/base/services/outdatedness_rules/layout_collection_extended.rb +0 -20
- data/lib/nanoc/base/services/outdatedness_rules/not_written.rb +0 -17
- data/lib/nanoc/base/services/outdatedness_rules/rules_modified.rb +0 -45
- data/lib/nanoc/base/services/outdatedness_rules/uses_always_outdated_filter.rb +0 -26
- data/lib/nanoc/base/services/pruner.rb +0 -123
- data/lib/nanoc/base/views.rb +0 -40
- data/lib/nanoc/base/views/basic_item_rep_collection_view.rb +0 -86
- data/lib/nanoc/base/views/basic_item_rep_view.rb +0 -81
- data/lib/nanoc/base/views/basic_item_view.rb +0 -52
- data/lib/nanoc/base/views/compilation_item_rep_collection_view.rb +0 -10
- data/lib/nanoc/base/views/compilation_item_rep_view.rb +0 -49
- data/lib/nanoc/base/views/compilation_item_view.rb +0 -45
- data/lib/nanoc/base/views/config_view.rb +0 -68
- data/lib/nanoc/base/views/identifiable_collection_view.rb +0 -109
- data/lib/nanoc/base/views/item_collection_with_reps_view.rb +0 -10
- data/lib/nanoc/base/views/item_collection_without_reps_view.rb +0 -10
- data/lib/nanoc/base/views/layout_collection_view.rb +0 -10
- data/lib/nanoc/base/views/layout_view.rb +0 -7
- data/lib/nanoc/base/views/mixins/document_view_mixin.rb +0 -88
- data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +0 -58
- data/lib/nanoc/base/views/mutable_config_view.rb +0 -14
- data/lib/nanoc/base/views/mutable_identifiable_collection_view.rb +0 -17
- data/lib/nanoc/base/views/mutable_item_collection_view.rb +0 -32
- data/lib/nanoc/base/views/mutable_item_view.rb +0 -7
- data/lib/nanoc/base/views/mutable_layout_collection_view.rb +0 -24
- data/lib/nanoc/base/views/mutable_layout_view.rb +0 -7
- data/lib/nanoc/base/views/post_compile_item_collection_view.rb +0 -10
- data/lib/nanoc/base/views/post_compile_item_rep_collection_view.rb +0 -10
- data/lib/nanoc/base/views/post_compile_item_rep_view.rb +0 -31
- data/lib/nanoc/base/views/post_compile_item_view.rb +0 -18
- data/lib/nanoc/base/views/view.rb +0 -41
- data/lib/nanoc/cli.rb +0 -241
- data/lib/nanoc/cli/ansi_string_colorizer.rb +0 -28
- data/lib/nanoc/cli/cleaning_stream.rb +0 -160
- data/lib/nanoc/cli/command_runner.rb +0 -72
- data/lib/nanoc/cli/commands/compile.rb +0 -57
- data/lib/nanoc/cli/commands/compile_listeners/abstract.rb +0 -58
- data/lib/nanoc/cli/commands/compile_listeners/aggregate.rb +0 -50
- data/lib/nanoc/cli/commands/compile_listeners/debug_printer.rb +0 -100
- data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +0 -101
- data/lib/nanoc/cli/commands/compile_listeners/file_action_printer.rb +0 -76
- data/lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb +0 -170
- data/lib/nanoc/cli/commands/create-site.rb +0 -257
- data/lib/nanoc/cli/commands/nanoc.rb +0 -42
- data/lib/nanoc/cli/commands/prune.rb +0 -49
- data/lib/nanoc/cli/commands/shell.rb +0 -57
- data/lib/nanoc/cli/commands/show-data.rb +0 -185
- data/lib/nanoc/cli/commands/show-plugins.rb +0 -89
- data/lib/nanoc/cli/commands/view.rb +0 -68
- data/lib/nanoc/cli/error_handler.rb +0 -365
- data/lib/nanoc/cli/logger.rb +0 -75
- data/lib/nanoc/cli/stack_trace_writer.rb +0 -50
- data/lib/nanoc/cli/stream_cleaners.rb +0 -10
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +0 -21
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -13
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +0 -17
- data/lib/nanoc/cli/transform.rb +0 -16
- data/lib/nanoc/spec.rb +0 -240
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Phases
|
7
|
-
class Abstract
|
8
|
-
include Nanoc::Core::ContractsSupport
|
9
|
-
|
10
|
-
def initialize(wrapped:)
|
11
|
-
@wrapped = wrapped
|
12
|
-
end
|
13
|
-
|
14
|
-
def start
|
15
|
-
@wrapped&.start
|
16
|
-
end
|
17
|
-
|
18
|
-
def stop
|
19
|
-
@wrapped&.stop
|
20
|
-
end
|
21
|
-
|
22
|
-
def call(rep, is_outdated:)
|
23
|
-
notify(:phase_started, rep)
|
24
|
-
run(rep, is_outdated: is_outdated) do
|
25
|
-
notify(:phase_yielded, rep)
|
26
|
-
@wrapped.call(rep, is_outdated: is_outdated)
|
27
|
-
notify(:phase_resumed, rep)
|
28
|
-
end
|
29
|
-
notify(:phase_ended, rep)
|
30
|
-
rescue
|
31
|
-
notify(:phase_aborted, rep)
|
32
|
-
raise
|
33
|
-
end
|
34
|
-
|
35
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
36
|
-
def run(_rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
37
|
-
raise NotImplementedError
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def notify(sym, rep)
|
43
|
-
name = self.class.to_s.sub(/^.*::/, '')
|
44
|
-
Nanoc::Core::NotificationCenter.post(sym, name, rep)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Phases
|
7
|
-
# Provides functionality for (re)calculating the content of an item rep, with caching or
|
8
|
-
# outdatedness checking. Delegates to s::Recalculate if outdated or no cache available.
|
9
|
-
class Cache < Abstract
|
10
|
-
include Nanoc::Core::ContractsSupport
|
11
|
-
|
12
|
-
def initialize(wrapped:, compiled_content_cache:, compiled_content_store:)
|
13
|
-
super(wrapped: wrapped)
|
14
|
-
|
15
|
-
@compiled_content_cache = compiled_content_cache
|
16
|
-
@compiled_content_store = compiled_content_store
|
17
|
-
end
|
18
|
-
|
19
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
20
|
-
def run(rep, is_outdated:)
|
21
|
-
if can_reuse_content_for_rep?(rep, is_outdated: is_outdated)
|
22
|
-
Nanoc::Core::NotificationCenter.post(:cached_content_used, rep)
|
23
|
-
|
24
|
-
@compiled_content_store.set_all(rep, @compiled_content_cache[rep])
|
25
|
-
else
|
26
|
-
yield
|
27
|
-
end
|
28
|
-
|
29
|
-
rep.compiled = true
|
30
|
-
@compiled_content_cache[rep] = @compiled_content_store.get_all(rep)
|
31
|
-
end
|
32
|
-
|
33
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Bool
|
34
|
-
def can_reuse_content_for_rep?(rep, is_outdated:)
|
35
|
-
if is_outdated
|
36
|
-
false
|
37
|
-
else
|
38
|
-
@compiled_content_cache.full_cache_available?(rep)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Phases
|
7
|
-
class MarkDone < Abstract
|
8
|
-
include Nanoc::Core::ContractsSupport
|
9
|
-
|
10
|
-
def initialize(wrapped:, outdatedness_store:)
|
11
|
-
super(wrapped: wrapped)
|
12
|
-
|
13
|
-
@outdatedness_store = outdatedness_store
|
14
|
-
end
|
15
|
-
|
16
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
17
|
-
def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
18
|
-
yield
|
19
|
-
@outdatedness_store.remove(rep)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Phases
|
7
|
-
# Provides functionality for notifying start and end of compilation.
|
8
|
-
class Notify < Abstract
|
9
|
-
include Nanoc::Core::ContractsSupport
|
10
|
-
|
11
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
12
|
-
def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
13
|
-
Nanoc::Core::NotificationCenter.post(:compilation_started, rep)
|
14
|
-
yield
|
15
|
-
Nanoc::Core::NotificationCenter.post(:compilation_ended, rep)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Phases
|
7
|
-
# Provides functionality for (re)calculating the content of an item rep, without caching or
|
8
|
-
# outdatedness checking.
|
9
|
-
class Recalculate < Abstract
|
10
|
-
include Nanoc::Core::ContractsSupport
|
11
|
-
|
12
|
-
def initialize(action_sequences:, dependency_store:, compilation_context:)
|
13
|
-
super(wrapped: nil)
|
14
|
-
|
15
|
-
@action_sequences = action_sequences
|
16
|
-
@dependency_store = dependency_store
|
17
|
-
@compilation_context = compilation_context
|
18
|
-
end
|
19
|
-
|
20
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
21
|
-
def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
22
|
-
dependency_tracker = Nanoc::Core::DependencyTracker.new(@dependency_store)
|
23
|
-
dependency_tracker.enter(rep.item)
|
24
|
-
|
25
|
-
executor = Nanoc::Int::Executor.new(rep, @compilation_context, dependency_tracker)
|
26
|
-
|
27
|
-
@compilation_context.compiled_content_store.set_current(rep, rep.item.content)
|
28
|
-
|
29
|
-
actions = @action_sequences[rep]
|
30
|
-
actions.each do |action|
|
31
|
-
case action
|
32
|
-
when Nanoc::Core::ProcessingActions::Filter
|
33
|
-
executor.filter(action.filter_name, action.params)
|
34
|
-
when Nanoc::Core::ProcessingActions::Layout
|
35
|
-
executor.layout(action.layout_identifier, action.params)
|
36
|
-
when Nanoc::Core::ProcessingActions::Snapshot
|
37
|
-
action.snapshot_names.each do |snapshot_name|
|
38
|
-
executor.snapshot(snapshot_name)
|
39
|
-
end
|
40
|
-
else
|
41
|
-
raise Nanoc::Int::Errors::InternalInconsistency, "unknown action #{action.inspect}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
ensure
|
45
|
-
dependency_tracker.exit
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Phases
|
7
|
-
# Provides functionality for suspending and resuming item rep compilation (using fibers).
|
8
|
-
class Resume < Abstract
|
9
|
-
include Nanoc::Core::ContractsSupport
|
10
|
-
|
11
|
-
DONE = Object.new
|
12
|
-
|
13
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
14
|
-
def run(rep, is_outdated:)
|
15
|
-
fiber = fiber_for(rep, is_outdated: is_outdated) { yield }
|
16
|
-
while fiber.alive?
|
17
|
-
res = fiber.resume
|
18
|
-
|
19
|
-
case res
|
20
|
-
when Nanoc::Int::Errors::UnmetDependency
|
21
|
-
Nanoc::Core::NotificationCenter.post(:compilation_suspended, rep, res.rep, res.snapshot_name)
|
22
|
-
raise(res)
|
23
|
-
when Proc
|
24
|
-
fiber.resume(res.call)
|
25
|
-
when DONE # rubocop:disable Lint/EmptyWhen
|
26
|
-
# ignore
|
27
|
-
else
|
28
|
-
raise Nanoc::Int::Errors::InternalInconsistency.new(
|
29
|
-
"Fiber yielded object of unexpected type #{res.class}",
|
30
|
-
)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => Fiber
|
38
|
-
def fiber_for(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
39
|
-
@fibers ||= {}
|
40
|
-
|
41
|
-
@fibers[rep] ||=
|
42
|
-
Fiber.new do
|
43
|
-
yield
|
44
|
-
@fibers.delete(rep)
|
45
|
-
DONE
|
46
|
-
end
|
47
|
-
|
48
|
-
@fibers[rep]
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Phases
|
7
|
-
class Write < Abstract
|
8
|
-
include Nanoc::Core::ContractsSupport
|
9
|
-
|
10
|
-
class Worker
|
11
|
-
def initialize(queue:, compiled_content_store:)
|
12
|
-
@queue = queue
|
13
|
-
@compiled_content_store = compiled_content_store
|
14
|
-
end
|
15
|
-
|
16
|
-
def start
|
17
|
-
@thread = Thread.new do
|
18
|
-
Thread.current.abort_on_exception = true
|
19
|
-
Thread.current.priority = -1 # schedule I/O work ASAP
|
20
|
-
|
21
|
-
writer = Nanoc::Int::ItemRepWriter.new
|
22
|
-
|
23
|
-
while rep = @queue.pop # rubocop:disable Lint/AssignmentInCondition
|
24
|
-
writer.write_all(rep, @compiled_content_store)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def join
|
30
|
-
@thread.join
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class WorkerPool
|
35
|
-
def initialize(queue:, size:, compiled_content_store:)
|
36
|
-
@workers = Array.new(size) { Worker.new(queue: queue, compiled_content_store: compiled_content_store) }
|
37
|
-
end
|
38
|
-
|
39
|
-
def start
|
40
|
-
@workers.each(&:start)
|
41
|
-
end
|
42
|
-
|
43
|
-
def join
|
44
|
-
@workers.each(&:join)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
QUEUE_SIZE = 40
|
49
|
-
WORKER_POOL_SIZE = 5
|
50
|
-
|
51
|
-
def initialize(compiled_content_store:, wrapped:)
|
52
|
-
super(wrapped: wrapped)
|
53
|
-
|
54
|
-
@compiled_content_store = compiled_content_store
|
55
|
-
|
56
|
-
@queue = SizedQueue.new(QUEUE_SIZE)
|
57
|
-
@worker_pool = WorkerPool.new(queue: @queue, size: WORKER_POOL_SIZE, compiled_content_store: @compiled_content_store)
|
58
|
-
end
|
59
|
-
|
60
|
-
def start
|
61
|
-
super
|
62
|
-
@worker_pool.start
|
63
|
-
end
|
64
|
-
|
65
|
-
def stop
|
66
|
-
super
|
67
|
-
@queue.close
|
68
|
-
@worker_pool.join
|
69
|
-
end
|
70
|
-
|
71
|
-
contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
|
72
|
-
def run(rep, is_outdated:) # rubocop:disable Lint/UnusedMethodArgument
|
73
|
-
yield
|
74
|
-
|
75
|
-
# Caution: Notification must be posted before enqueueing the rep,
|
76
|
-
# or we risk a race condition where the :rep_write_ended
|
77
|
-
# notification happens before the :rep_write_enqueued one.
|
78
|
-
Nanoc::Core::NotificationCenter.post(:rep_write_enqueued, rep)
|
79
|
-
|
80
|
-
@queue << rep
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Stages
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
require_relative 'stages/calculate_checksums'
|
13
|
-
require_relative 'stages/cleanup'
|
14
|
-
require_relative 'stages/compile_reps'
|
15
|
-
require_relative 'stages/determine_outdatedness'
|
16
|
-
require_relative 'stages/prune'
|
17
|
-
require_relative 'stages/preprocess'
|
18
|
-
require_relative 'stages/load_stores'
|
19
|
-
require_relative 'stages/forget_outdated_dependencies'
|
20
|
-
require_relative 'stages/store_pre_compilation_state'
|
21
|
-
require_relative 'stages/store_post_compilation_state'
|
22
|
-
require_relative 'stages/postprocess'
|
23
|
-
require_relative 'stages/build_reps'
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Stages
|
7
|
-
class BuildReps < Nanoc::Core::CompilationStage
|
8
|
-
include Nanoc::Core::ContractsSupport
|
9
|
-
|
10
|
-
contract C::KeywordArgs[site: Nanoc::Core::Site, action_provider: Nanoc::Core::ActionProvider] => C::Any
|
11
|
-
def initialize(site:, action_provider:)
|
12
|
-
@site = site
|
13
|
-
@action_provider = action_provider
|
14
|
-
end
|
15
|
-
|
16
|
-
def run
|
17
|
-
reps = Nanoc::Core::ItemRepRepo.new
|
18
|
-
|
19
|
-
builder = Nanoc::Int::ItemRepBuilder.new(
|
20
|
-
@site, @action_provider, reps
|
21
|
-
)
|
22
|
-
|
23
|
-
action_sequences = builder.run
|
24
|
-
|
25
|
-
@site.layouts.each do |layout|
|
26
|
-
action_sequences[layout] = @action_provider.action_sequence_for(layout)
|
27
|
-
end
|
28
|
-
|
29
|
-
{
|
30
|
-
reps: reps,
|
31
|
-
action_sequences: action_sequences,
|
32
|
-
}
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class Compiler
|
6
|
-
module Stages
|
7
|
-
class CalculateChecksums < Nanoc::Core::CompilationStage
|
8
|
-
def initialize(items:, layouts:, code_snippets:, config:)
|
9
|
-
@items = items
|
10
|
-
@layouts = layouts
|
11
|
-
@code_snippets = code_snippets
|
12
|
-
@config = config
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
checksums = {}
|
17
|
-
|
18
|
-
[@items, @layouts].each do |documents|
|
19
|
-
documents.each do |document|
|
20
|
-
checksums[[document.reference, :content]] =
|
21
|
-
Nanoc::Core::Checksummer.calc_for_content_of(document)
|
22
|
-
checksums[[document.reference, :each_attribute]] =
|
23
|
-
Nanoc::Core::Checksummer.calc_for_each_attribute_of(document)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
[@items, @layouts, @code_snippets].each do |objs|
|
28
|
-
objs.each do |obj|
|
29
|
-
checksums[obj.reference] = Nanoc::Core::Checksummer.calc(obj)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
checksums[@config.reference] =
|
34
|
-
Nanoc::Core::Checksummer.calc(@config)
|
35
|
-
checksums[[@config.reference, :each_attribute]] =
|
36
|
-
Nanoc::Core::Checksummer.calc_for_each_attribute_of(@config)
|
37
|
-
|
38
|
-
Nanoc::Core::ChecksumCollection.new(checksums)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|