nanoc 4.11.0 → 4.11.1
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/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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81da98fdd728f76e389fc4618fc54a22e98827d40e20320e0102ab7dc4b2b89f
|
4
|
+
data.tar.gz: c642b86779f1564d1d09a499e4b3e6bbe0d60ebdb5d3c828c05dee3101bf4c08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '078c89114ddab916b9bf54fcf7f32359d51472351fd9bde7abe1d03e575797b13fa02782e228bb87677d1e74950d187b2afcfd6612b80b37fe9438f37fe65dc5'
|
7
|
+
data.tar.gz: 8ab157e67fc2172adf8aa910f52937cf92505a42441bc9b54ec2b5d0beae5c880cd0f62472bc0633a0445a7916fdc3cadc208f96a012dffaddbddcb87bbf93b0
|
data/NEWS.md
CHANGED
data/lib/nanoc.rb
CHANGED
@@ -2,18 +2,11 @@
|
|
2
2
|
|
3
3
|
# Load external dependencies
|
4
4
|
require 'addressable'
|
5
|
-
require 'ddmemoize'
|
6
|
-
require 'ddmetrics'
|
7
5
|
require 'ddplugin'
|
8
|
-
require 'hamster'
|
9
6
|
require 'json'
|
10
|
-
require 'json_schema'
|
11
7
|
require 'parallel'
|
12
|
-
require 'ref'
|
13
8
|
require 'slow_enumerator_tools'
|
14
9
|
|
15
|
-
DDMemoize.enable_metrics
|
16
|
-
|
17
10
|
module Nanoc
|
18
11
|
# @return [String] A string containing information about this Nanoc version
|
19
12
|
# and its environment (Ruby engine and version, Rubygems version if any).
|
@@ -46,6 +39,7 @@ require 'fiber'
|
|
46
39
|
require 'fileutils'
|
47
40
|
require 'find'
|
48
41
|
require 'forwardable'
|
42
|
+
require 'logger'
|
49
43
|
require 'net/http'
|
50
44
|
require 'net/https'
|
51
45
|
require 'open3'
|
@@ -62,6 +56,9 @@ require 'tmpdir'
|
|
62
56
|
require 'uri'
|
63
57
|
require 'yaml'
|
64
58
|
|
59
|
+
# Load extracted Nanoc dependencies
|
60
|
+
require 'nanoc-core'
|
61
|
+
|
65
62
|
# Load Nanoc
|
66
63
|
require 'nanoc/version'
|
67
64
|
require 'nanoc/base'
|
data/lib/nanoc/base.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# @api private
|
4
|
-
module Nanoc
|
4
|
+
module Nanoc
|
5
|
+
module Int
|
6
|
+
end
|
5
7
|
end
|
6
8
|
|
7
|
-
require_relative 'base/core_ext'
|
8
|
-
require_relative 'base/contracts_support'
|
9
9
|
require_relative 'base/error'
|
10
10
|
require_relative 'base/errors'
|
11
11
|
require_relative 'base/changes_stream'
|
data/lib/nanoc/base/entities.rb
CHANGED
@@ -1,29 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# Re-exported from Nanoc::Core
|
4
|
+
Nanoc::Identifier = Nanoc::Core::Identifier
|
5
5
|
|
6
|
-
require_relative 'entities/identifier'
|
7
|
-
require_relative 'entities/content'
|
8
|
-
require_relative 'entities/processing_action'
|
9
|
-
require_relative 'entities/processing_actions'
|
10
|
-
|
11
|
-
require_relative 'entities/identifiable_collection'
|
12
|
-
require_relative 'entities/item_collection'
|
13
|
-
require_relative 'entities/layout_collection'
|
14
|
-
|
15
|
-
require_relative 'entities/code_snippet'
|
16
|
-
require_relative 'entities/configuration'
|
17
|
-
require_relative 'entities/lazy_value'
|
18
|
-
require_relative 'entities/document'
|
19
|
-
require_relative 'entities/item'
|
20
|
-
require_relative 'entities/item_rep'
|
21
|
-
require_relative 'entities/layout'
|
22
|
-
require_relative 'entities/pattern'
|
23
6
|
require_relative 'entities/props'
|
24
7
|
require_relative 'entities/action_sequence'
|
25
8
|
require_relative 'entities/site'
|
26
|
-
require_relative 'entities/snapshot_def'
|
27
9
|
|
28
10
|
require_relative 'entities/checksum_collection'
|
29
11
|
require_relative 'entities/outdatedness_status'
|
@@ -1,84 +1,80 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Nanoc
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module Nanoc
|
4
|
+
module Int
|
5
|
+
class ActionSequence
|
6
|
+
include Nanoc::Core::ContractsSupport
|
7
|
+
include Enumerable
|
8
|
+
DDMemoize.activate(self)
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
attr_reader :item_rep
|
11
|
+
attr_reader :actions
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def self.build(rep)
|
18
|
-
builder = Nanoc::Int::ActionSequenceBuilder.new(rep)
|
19
|
-
yield(builder)
|
20
|
-
builder.action_sequence
|
21
|
-
end
|
13
|
+
def initialize(item_rep, actions: [])
|
14
|
+
@item_rep = item_rep
|
15
|
+
@actions = actions
|
16
|
+
end
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
contract C::None => Numeric
|
19
|
+
def size
|
20
|
+
@actions.size
|
21
|
+
end
|
27
22
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
23
|
+
contract Numeric => C::Maybe[Nanoc::Core::ProcessingAction]
|
24
|
+
def [](idx)
|
25
|
+
@actions[idx]
|
26
|
+
end
|
32
27
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
contract C::None => C::ArrayOf[Nanoc::Core::ProcessingAction]
|
29
|
+
def snapshot_actions
|
30
|
+
@actions.select { |a| a.is_a?(Nanoc::Core::ProcessingActions::Snapshot) }
|
31
|
+
end
|
37
32
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
33
|
+
contract C::None => Array
|
34
|
+
def paths
|
35
|
+
snapshot_actions.map { |a| [a.snapshot_names, a.paths] }
|
36
|
+
end
|
42
37
|
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
memoized def serialize
|
39
|
+
serialize_uncached
|
40
|
+
end
|
46
41
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
contract C::None => Array
|
43
|
+
def serialize_uncached
|
44
|
+
to_a.map(&:serialize)
|
45
|
+
end
|
51
46
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
|
48
|
+
def each
|
49
|
+
@actions.each { |a| yield(a) }
|
50
|
+
self
|
51
|
+
end
|
57
52
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
53
|
+
contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
|
54
|
+
def map
|
55
|
+
self.class.new(
|
56
|
+
@item_rep,
|
57
|
+
actions: @actions.map { |a| yield(a) },
|
58
|
+
)
|
59
|
+
end
|
65
60
|
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
def snapshots_defs
|
62
|
+
is_binary = @item_rep.item.content.binary?
|
63
|
+
snapshot_defs = []
|
69
64
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
65
|
+
each do |action|
|
66
|
+
case action
|
67
|
+
when Nanoc::Core::ProcessingActions::Snapshot
|
68
|
+
action.snapshot_names.each do |snapshot_name|
|
69
|
+
snapshot_defs << Nanoc::Core::SnapshotDef.new(snapshot_name, binary: is_binary)
|
70
|
+
end
|
71
|
+
when Nanoc::Core::ProcessingActions::Filter
|
72
|
+
is_binary = Nanoc::Filter.named!(action.filter_name).to_binary?
|
75
73
|
end
|
76
|
-
when Nanoc::Int::ProcessingActions::Filter
|
77
|
-
is_binary = Nanoc::Filter.named!(action.filter_name).to_binary?
|
78
74
|
end
|
79
|
-
end
|
80
75
|
|
81
|
-
|
76
|
+
snapshot_defs
|
77
|
+
end
|
82
78
|
end
|
83
79
|
end
|
84
80
|
end
|
@@ -1,32 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Nanoc
|
4
|
-
|
5
|
-
|
3
|
+
module Nanoc
|
4
|
+
module Int
|
5
|
+
class ChecksumCollection
|
6
|
+
include Nanoc::Core::ContractsSupport
|
6
7
|
|
7
|
-
|
8
|
+
c_obj = C::Or[Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::Configuration, Nanoc::Core::CodeSnippet]
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
def initialize(checksums)
|
11
|
+
@checksums = checksums
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
contract c_obj => C::Maybe[String]
|
15
|
+
def checksum_for(obj)
|
16
|
+
@checksums[obj.reference]
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
contract c_obj => C::Maybe[String]
|
20
|
+
def content_checksum_for(obj)
|
21
|
+
@checksums[[obj.reference, :content]]
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
contract c_obj => C::Maybe[C::HashOf[Symbol, String]]
|
25
|
+
def attributes_checksum_for(obj)
|
26
|
+
@checksums[[obj.reference, :each_attribute]]
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
def to_h
|
30
|
+
@checksums
|
31
|
+
end
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -1,33 +1,35 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Nanoc
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module Nanoc
|
4
|
+
module Int
|
5
|
+
# @api private
|
6
|
+
# A dependency between two items/layouts.
|
7
|
+
class Dependency
|
8
|
+
include Nanoc::Core::ContractsSupport
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
C_OBJ_FROM = C::Or[Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::Configuration, Nanoc::Core::IdentifiableCollection]
|
11
|
+
C_OBJ_TO = Nanoc::Core::Item
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
contract C::None => C::Maybe[C_OBJ_FROM]
|
14
|
+
attr_reader :from
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
contract C::None => C::Maybe[C_OBJ_TO]
|
17
|
+
attr_reader :to
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
contract C::None => Nanoc::Int::Props
|
20
|
+
attr_reader :props
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
contract C::Maybe[C_OBJ_FROM], C::Maybe[C_OBJ_TO], Nanoc::Int::Props => C::Any
|
23
|
+
def initialize(from, to, props)
|
24
|
+
@from = from
|
25
|
+
@to = to
|
26
|
+
@props = props
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
contract C::None => String
|
30
|
+
def inspect
|
31
|
+
"Dependency(#{@from.inspect} -> #{@to.inspect}, #{@props.inspect})"
|
32
|
+
end
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -1,86 +1,88 @@
|
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
module Nanoc
|
4
|
+
module Int
|
5
|
+
# Module that contains all outdatedness reasons.
|
6
|
+
#
|
7
|
+
# @api private
|
8
|
+
module OutdatednessReasons
|
9
|
+
# A generic outdatedness reason. An outdatedness reason is basically a
|
10
|
+
# descriptive message that explains why a given object is outdated.
|
11
|
+
class Generic
|
12
|
+
# @return [String] A descriptive message for this outdatedness reason
|
13
|
+
attr_reader :message
|
14
|
+
|
15
|
+
# @return [Nanoc::Int::Props]
|
16
|
+
attr_reader :props
|
17
|
+
|
18
|
+
# @param [String] message The descriptive message for this outdatedness
|
19
|
+
# reason
|
20
|
+
def initialize(message, props = Nanoc::Int::Props.new)
|
21
|
+
@message = message
|
22
|
+
@props = props
|
23
|
+
end
|
22
24
|
end
|
23
|
-
end
|
24
|
-
|
25
|
-
CodeSnippetsModified = Generic.new(
|
26
|
-
'The code snippets have been modified since the last time the site was compiled.',
|
27
|
-
Props.new(raw_content: true, attributes: true, compiled_content: true, path: true),
|
28
|
-
)
|
29
|
-
|
30
|
-
DependenciesOutdated = Generic.new(
|
31
|
-
'This item uses content or attributes that have changed since the last time the site was compiled.',
|
32
|
-
)
|
33
|
-
|
34
|
-
NotWritten = Generic.new(
|
35
|
-
'This item representation has not yet been written to the output directory (but it does have a path).',
|
36
|
-
Props.new(raw_content: true, attributes: true, compiled_content: true, path: true),
|
37
|
-
)
|
38
|
-
|
39
|
-
RulesModified = Generic.new(
|
40
|
-
'The rules file has been modified since the last time the site was compiled.',
|
41
|
-
Props.new(compiled_content: true, path: true),
|
42
|
-
)
|
43
|
-
|
44
|
-
ContentModified = Generic.new(
|
45
|
-
'The content of this item has been modified since the last time the site was compiled.',
|
46
|
-
Props.new(raw_content: true, compiled_content: true),
|
47
|
-
)
|
48
|
-
|
49
|
-
class DocumentCollectionExtended < Generic
|
50
|
-
attr_reader :objects
|
51
|
-
|
52
|
-
def initialize(objects)
|
53
|
-
super(
|
54
|
-
'New items/layouts have been added to the site.',
|
55
|
-
Props.new(raw_content: true),
|
56
|
-
)
|
57
25
|
|
58
|
-
|
26
|
+
CodeSnippetsModified = Generic.new(
|
27
|
+
'The code snippets have been modified since the last time the site was compiled.',
|
28
|
+
Props.new(raw_content: true, attributes: true, compiled_content: true, path: true),
|
29
|
+
)
|
30
|
+
|
31
|
+
DependenciesOutdated = Generic.new(
|
32
|
+
'This item uses content or attributes that have changed since the last time the site was compiled.',
|
33
|
+
)
|
34
|
+
|
35
|
+
NotWritten = Generic.new(
|
36
|
+
'This item representation has not yet been written to the output directory (but it does have a path).',
|
37
|
+
Props.new(raw_content: true, attributes: true, compiled_content: true, path: true),
|
38
|
+
)
|
39
|
+
|
40
|
+
RulesModified = Generic.new(
|
41
|
+
'The rules file has been modified since the last time the site was compiled.',
|
42
|
+
Props.new(compiled_content: true, path: true),
|
43
|
+
)
|
44
|
+
|
45
|
+
ContentModified = Generic.new(
|
46
|
+
'The content of this item has been modified since the last time the site was compiled.',
|
47
|
+
Props.new(raw_content: true, compiled_content: true),
|
48
|
+
)
|
49
|
+
|
50
|
+
class DocumentCollectionExtended < Generic
|
51
|
+
attr_reader :objects
|
52
|
+
|
53
|
+
def initialize(objects)
|
54
|
+
super(
|
55
|
+
'New items/layouts have been added to the site.',
|
56
|
+
Props.new(raw_content: true),
|
57
|
+
)
|
58
|
+
|
59
|
+
@objects = objects
|
60
|
+
end
|
59
61
|
end
|
60
|
-
end
|
61
62
|
|
62
|
-
|
63
|
-
|
63
|
+
class ItemCollectionExtended < DocumentCollectionExtended
|
64
|
+
end
|
64
65
|
|
65
|
-
|
66
|
-
|
66
|
+
class LayoutCollectionExtended < DocumentCollectionExtended
|
67
|
+
end
|
67
68
|
|
68
|
-
|
69
|
-
|
69
|
+
class AttributesModified < Generic
|
70
|
+
attr_reader :attributes
|
70
71
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
def initialize(attributes)
|
73
|
+
super(
|
74
|
+
'The attributes of this item have been modified since the last time the site was compiled.',
|
75
|
+
Props.new(attributes: true, compiled_content: true),
|
76
|
+
)
|
76
77
|
|
77
|
-
|
78
|
+
@attributes = attributes
|
79
|
+
end
|
78
80
|
end
|
79
|
-
end
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
UsesAlwaysOutdatedFilter = Generic.new(
|
83
|
+
'This item rep uses one or more filters that cannot track dependencies, and will thus always be considered as outdated.',
|
84
|
+
Props.new(raw_content: true, attributes: true, compiled_content: true),
|
85
|
+
)
|
86
|
+
end
|
85
87
|
end
|
86
88
|
end
|