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.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.md +6 -0
  3. data/lib/nanoc.rb +4 -7
  4. data/lib/nanoc/base.rb +3 -3
  5. data/lib/nanoc/base/assertions.rb +1 -1
  6. data/lib/nanoc/base/entities.rb +2 -20
  7. data/lib/nanoc/base/entities/action_sequence.rb +60 -64
  8. data/lib/nanoc/base/entities/checksum_collection.rb +23 -21
  9. data/lib/nanoc/base/entities/dependency.rb +24 -22
  10. data/lib/nanoc/base/entities/outdatedness_reasons.rb +74 -72
  11. data/lib/nanoc/base/entities/outdatedness_status.rb +19 -17
  12. data/lib/nanoc/base/entities/props.rb +119 -117
  13. data/lib/nanoc/base/entities/site.rb +46 -50
  14. data/lib/nanoc/base/errors.rb +183 -198
  15. data/lib/nanoc/base/repos.rb +4 -2
  16. data/lib/nanoc/base/repos/action_sequence_store.rb +44 -42
  17. data/lib/nanoc/base/repos/aggregate_data_source.rb +24 -22
  18. data/lib/nanoc/base/repos/checksum_store.rb +51 -49
  19. data/lib/nanoc/base/repos/compiled_content_cache.rb +47 -45
  20. data/lib/nanoc/base/repos/compiled_content_store.rb +76 -0
  21. data/lib/nanoc/base/repos/config_loader.rb +74 -72
  22. data/lib/nanoc/base/repos/dependency_store.rb +174 -172
  23. data/lib/nanoc/base/repos/in_mem_data_source.rb +17 -15
  24. data/lib/nanoc/base/repos/item_rep_repo.rb +26 -24
  25. data/lib/nanoc/base/repos/outdatedness_store.rb +50 -48
  26. data/lib/nanoc/base/repos/prefixed_data_source.rb +21 -19
  27. data/lib/nanoc/base/repos/site_loader.rb +75 -73
  28. data/lib/nanoc/base/repos/store.rb +93 -91
  29. data/lib/nanoc/base/services.rb +7 -3
  30. data/lib/nanoc/base/services/action_provider.rb +23 -21
  31. data/lib/nanoc/base/services/action_sequence_builder.rb +42 -34
  32. data/lib/nanoc/base/services/compilation_context.rb +49 -47
  33. data/lib/nanoc/base/services/compiler.rb +177 -170
  34. data/lib/nanoc/base/services/compiler/phases.rb +8 -1
  35. data/lib/nanoc/base/services/compiler/phases/abstract.rb +44 -38
  36. data/lib/nanoc/base/services/compiler/phases/cache.rb +34 -28
  37. data/lib/nanoc/base/services/compiler/phases/mark_done.rb +17 -11
  38. data/lib/nanoc/base/services/compiler/phases/notify.rb +21 -0
  39. data/lib/nanoc/base/services/compiler/phases/recalculate.rb +37 -31
  40. data/lib/nanoc/base/services/compiler/phases/resume.rb +47 -48
  41. data/lib/nanoc/base/services/compiler/phases/write.rb +65 -59
  42. data/lib/nanoc/base/services/compiler/stage.rb +27 -8
  43. data/lib/nanoc/base/services/compiler/stages.rb +7 -1
  44. data/lib/nanoc/base/services/compiler/stages/build_reps.rb +25 -19
  45. data/lib/nanoc/base/services/compiler/stages/calculate_checksums.rb +34 -28
  46. data/lib/nanoc/base/services/compiler/stages/cleanup.rb +33 -27
  47. data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +79 -69
  48. data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +46 -40
  49. data/lib/nanoc/base/services/compiler/stages/forget_outdated_dependencies.rb +15 -9
  50. data/lib/nanoc/base/services/compiler/stages/load_stores.rb +28 -22
  51. data/lib/nanoc/base/services/compiler/stages/postprocess.rb +16 -10
  52. data/lib/nanoc/base/services/compiler/stages/preprocess.rb +25 -19
  53. data/lib/nanoc/base/services/compiler/stages/prune.rb +23 -17
  54. data/lib/nanoc/base/services/compiler/stages/store_post_compilation_state.rb +15 -9
  55. data/lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb +26 -20
  56. data/lib/nanoc/base/services/compiler_loader.rb +26 -24
  57. data/lib/nanoc/base/services/dependency_tracker.rb +47 -45
  58. data/lib/nanoc/base/services/executor.rb +16 -15
  59. data/lib/nanoc/base/services/filter.rb +37 -5
  60. data/lib/nanoc/base/services/instrumentor.rb +12 -10
  61. data/lib/nanoc/base/services/item_rep_builder.rb +21 -19
  62. data/lib/nanoc/base/services/item_rep_router.rb +72 -70
  63. data/lib/nanoc/base/services/item_rep_selector.rb +48 -46
  64. data/lib/nanoc/base/services/item_rep_writer.rb +58 -53
  65. data/lib/nanoc/base/services/outdatedness_checker.rb +181 -179
  66. data/lib/nanoc/base/services/outdatedness_rule.rb +23 -21
  67. data/lib/nanoc/base/services/outdatedness_rules.rb +5 -3
  68. data/lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb +28 -24
  69. data/lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb +20 -16
  70. data/lib/nanoc/base/services/outdatedness_rules/content_modified.rb +13 -9
  71. data/lib/nanoc/base/services/outdatedness_rules/item_collection_extended.rb +12 -8
  72. data/lib/nanoc/base/services/outdatedness_rules/layout_collection_extended.rb +12 -8
  73. data/lib/nanoc/base/services/outdatedness_rules/not_written.rb +10 -6
  74. data/lib/nanoc/base/services/outdatedness_rules/rules_modified.rb +39 -35
  75. data/lib/nanoc/base/services/outdatedness_rules/uses_always_outdated_filter.rb +19 -15
  76. data/lib/nanoc/base/services/pruner.rb +2 -2
  77. data/lib/nanoc/base/views.rb +7 -0
  78. data/lib/nanoc/base/views/basic_item_view.rb +1 -1
  79. data/lib/nanoc/base/views/compilation_item_rep_view.rb +2 -2
  80. data/lib/nanoc/base/views/identifiable_collection_view.rb +2 -2
  81. data/lib/nanoc/base/views/mixins/document_view_mixin.rb +1 -1
  82. data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +5 -5
  83. data/lib/nanoc/base/views/mutable_item_collection_view.rb +3 -3
  84. data/lib/nanoc/base/views/mutable_layout_collection_view.rb +2 -2
  85. data/lib/nanoc/base/views/view_context_for_compilation.rb +6 -6
  86. data/lib/nanoc/base/views/view_context_for_pre_compilation.rb +2 -2
  87. data/lib/nanoc/base/views/view_context_for_shell.rb +2 -2
  88. data/lib/nanoc/checking/check.rb +1 -1
  89. data/lib/nanoc/cli/commands/compile_listeners/abstract.rb +24 -7
  90. data/lib/nanoc/cli/commands/compile_listeners/debug_printer.rb +79 -15
  91. data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +4 -7
  92. data/lib/nanoc/cli/commands/compile_listeners/file_action_printer.rb +15 -24
  93. data/lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb +22 -18
  94. data/lib/nanoc/cli/commands/create-site.rb +2 -7
  95. data/lib/nanoc/cli/commands/shell.rb +1 -1
  96. data/lib/nanoc/cli/commands/show-data.rb +9 -9
  97. data/lib/nanoc/cli/logger.rb +1 -1
  98. data/lib/nanoc/data_sources/filesystem.rb +8 -8
  99. data/lib/nanoc/filters/erb.rb +1 -1
  100. data/lib/nanoc/filters/erubi.rb +1 -1
  101. data/lib/nanoc/filters/erubis.rb +1 -1
  102. data/lib/nanoc/filters/haml.rb +1 -1
  103. data/lib/nanoc/filters/sass.rb +1 -1
  104. data/lib/nanoc/filters/slim.rb +1 -1
  105. data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
  106. data/lib/nanoc/helpers/capturing.rb +9 -8
  107. data/lib/nanoc/helpers/filtering.rb +2 -2
  108. data/lib/nanoc/helpers/rendering.rb +1 -1
  109. data/lib/nanoc/rule_dsl.rb +10 -0
  110. data/lib/nanoc/rule_dsl/action_provider.rb +3 -3
  111. data/lib/nanoc/rule_dsl/action_recorder.rb +3 -3
  112. data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +7 -7
  113. data/lib/nanoc/rule_dsl/compilation_rule.rb +2 -2
  114. data/lib/nanoc/rule_dsl/compilation_rule_context.rb +9 -9
  115. data/lib/nanoc/rule_dsl/compiler_dsl.rb +4 -4
  116. data/lib/nanoc/rule_dsl/routing_rule.rb +3 -3
  117. data/lib/nanoc/rule_dsl/rule.rb +5 -5
  118. data/lib/nanoc/rule_dsl/rule_context.rb +3 -3
  119. data/lib/nanoc/rule_dsl/rules_collection.rb +4 -4
  120. data/lib/nanoc/spec.rb +15 -15
  121. data/lib/nanoc/version.rb +1 -1
  122. metadata +10 -111
  123. data/lib/nanoc/base/contracts_support.rb +0 -130
  124. data/lib/nanoc/base/core_ext.rb +0 -5
  125. data/lib/nanoc/base/core_ext/array.rb +0 -50
  126. data/lib/nanoc/base/core_ext/hash.rb +0 -54
  127. data/lib/nanoc/base/core_ext/string.rb +0 -16
  128. data/lib/nanoc/base/entities/code_snippet.rb +0 -53
  129. data/lib/nanoc/base/entities/configuration-schema.json +0 -122
  130. data/lib/nanoc/base/entities/configuration.rb +0 -206
  131. data/lib/nanoc/base/entities/content.rb +0 -112
  132. data/lib/nanoc/base/entities/context.rb +0 -70
  133. data/lib/nanoc/base/entities/directed_graph.rb +0 -195
  134. data/lib/nanoc/base/entities/document.rb +0 -125
  135. data/lib/nanoc/base/entities/identifiable_collection.rb +0 -141
  136. data/lib/nanoc/base/entities/identifier.rb +0 -222
  137. data/lib/nanoc/base/entities/item.rb +0 -10
  138. data/lib/nanoc/base/entities/item_collection.rb +0 -14
  139. data/lib/nanoc/base/entities/item_rep.rb +0 -91
  140. data/lib/nanoc/base/entities/layout.rb +0 -10
  141. data/lib/nanoc/base/entities/layout_collection.rb +0 -14
  142. data/lib/nanoc/base/entities/lazy_value.rb +0 -43
  143. data/lib/nanoc/base/entities/pattern.rb +0 -85
  144. data/lib/nanoc/base/entities/processing_action.rb +0 -21
  145. data/lib/nanoc/base/entities/processing_actions.rb +0 -5
  146. data/lib/nanoc/base/entities/processing_actions/filter.rb +0 -36
  147. data/lib/nanoc/base/entities/processing_actions/layout.rb +0 -36
  148. data/lib/nanoc/base/entities/processing_actions/snapshot.rb +0 -46
  149. data/lib/nanoc/base/entities/snapshot_def.rb +0 -22
  150. data/lib/nanoc/base/repos/data_source.rb +0 -168
  151. data/lib/nanoc/base/repos/snapshot_repo.rb +0 -67
  152. data/lib/nanoc/base/services/checksummer.rb +0 -274
  153. data/lib/nanoc/base/services/notification_center.rb +0 -87
  154. 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: 24b2704181c12e6dc71bf46b7bb87dc14e31c18d7d4530a0420dd2c98ffb3e9b
4
- data.tar.gz: 913ca912414ce823d274704ba45e06ace2a4e603081472a6815fe0b9076dd1b2
3
+ metadata.gz: 81da98fdd728f76e389fc4618fc54a22e98827d40e20320e0102ab7dc4b2b89f
4
+ data.tar.gz: c642b86779f1564d1d09a499e4b3e6bbe0d60ebdb5d3c828c05dee3101bf4c08
5
5
  SHA512:
6
- metadata.gz: cb662339340e2682df52518b85d5295bab537b18014a9fcd001f65fe31cb62aae1ab9bccca0c877ba196025a1e839ac6cd6fd26538e4df00b6b250a06dff7b61
7
- data.tar.gz: d1b82c96c958141bdeb7d82511fd06d4a9499c251f6b656e300ea9120041377fcfde2c6562758c733e0d5e4eef593ba36fff5b3d16d4f719cc81f451014e2edb
6
+ metadata.gz: '078c89114ddab916b9bf54fcf7f32359d51472351fd9bde7abe1d03e575797b13fa02782e228bb87677d1e74950d187b2afcfd6612b80b37fe9438f37fe65dc5'
7
+ data.tar.gz: 8ab157e67fc2172adf8aa910f52937cf92505a42441bc9b54ec2b5d0beae5c880cd0f62472bc0633a0445a7916fdc3cadc208f96a012dffaddbddcb87bbf93b0
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.11.1 (2019-02-09)
4
+
5
+ Fixes:
6
+
7
+ * Fixed an issue which caused hardlinking to fail in certain situations (#1405, #1406)
8
+
3
9
  ## 4.11.0 (2018-12-01)
4
10
 
5
11
  Features:
@@ -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'
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # @api private
4
- module Nanoc::Int
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'
@@ -7,7 +7,7 @@ module Nanoc
7
7
 
8
8
  module Mixin
9
9
  def assert(assertion)
10
- return unless Nanoc::Int::ContractsSupport.enabled?
10
+ return unless Nanoc::Core::ContractsSupport.enabled?
11
11
 
12
12
  unless assertion.call
13
13
  raise AssertionFailure, "assertion failed: #{assertion.class}"
@@ -1,29 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'entities/context'
4
- require_relative 'entities/directed_graph'
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::Int
4
- class ActionSequence
5
- include Nanoc::Int::ContractsSupport
6
- include Enumerable
7
- DDMemoize.activate(self)
3
+ module Nanoc
4
+ module Int
5
+ class ActionSequence
6
+ include Nanoc::Core::ContractsSupport
7
+ include Enumerable
8
+ DDMemoize.activate(self)
8
9
 
9
- attr_reader :item_rep
10
- attr_reader :actions
10
+ attr_reader :item_rep
11
+ attr_reader :actions
11
12
 
12
- def initialize(item_rep, actions: [])
13
- @item_rep = item_rep
14
- @actions = actions
15
- end
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
- contract C::None => Numeric
24
- def size
25
- @actions.size
26
- end
18
+ contract C::None => Numeric
19
+ def size
20
+ @actions.size
21
+ end
27
22
 
28
- contract Numeric => C::Maybe[Nanoc::Int::ProcessingAction]
29
- def [](idx)
30
- @actions[idx]
31
- end
23
+ contract Numeric => C::Maybe[Nanoc::Core::ProcessingAction]
24
+ def [](idx)
25
+ @actions[idx]
26
+ end
32
27
 
33
- contract C::None => C::ArrayOf[Nanoc::Int::ProcessingAction]
34
- def snapshot_actions
35
- @actions.select { |a| a.is_a?(Nanoc::Int::ProcessingActions::Snapshot) }
36
- end
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
- contract C::None => Array
39
- def paths
40
- snapshot_actions.map { |a| [a.snapshot_names, a.paths] }
41
- end
33
+ contract C::None => Array
34
+ def paths
35
+ snapshot_actions.map { |a| [a.snapshot_names, a.paths] }
36
+ end
42
37
 
43
- memoized def serialize
44
- serialize_uncached
45
- end
38
+ memoized def serialize
39
+ serialize_uncached
40
+ end
46
41
 
47
- contract C::None => Array
48
- def serialize_uncached
49
- to_a.map(&:serialize)
50
- end
42
+ contract C::None => Array
43
+ def serialize_uncached
44
+ to_a.map(&:serialize)
45
+ end
51
46
 
52
- contract C::Func[Nanoc::Int::ProcessingAction => C::Any] => self
53
- def each
54
- @actions.each { |a| yield(a) }
55
- self
56
- end
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
- contract C::Func[Nanoc::Int::ProcessingAction => C::Any] => self
59
- def map
60
- self.class.new(
61
- @item_rep,
62
- actions: @actions.map { |a| yield(a) },
63
- )
64
- end
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
- def snapshots_defs
67
- is_binary = @item_rep.item.content.binary?
68
- snapshot_defs = []
61
+ def snapshots_defs
62
+ is_binary = @item_rep.item.content.binary?
63
+ snapshot_defs = []
69
64
 
70
- each do |action|
71
- case action
72
- when Nanoc::Int::ProcessingActions::Snapshot
73
- action.snapshot_names.each do |snapshot_name|
74
- snapshot_defs << Nanoc::Int::SnapshotDef.new(snapshot_name, binary: is_binary)
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
- snapshot_defs
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::Int
4
- class ChecksumCollection
5
- include Nanoc::Int::ContractsSupport
3
+ module Nanoc
4
+ module Int
5
+ class ChecksumCollection
6
+ include Nanoc::Core::ContractsSupport
6
7
 
7
- c_obj = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::Int::Configuration, Nanoc::Int::CodeSnippet]
8
+ c_obj = C::Or[Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::Configuration, Nanoc::Core::CodeSnippet]
8
9
 
9
- def initialize(checksums)
10
- @checksums = checksums
11
- end
10
+ def initialize(checksums)
11
+ @checksums = checksums
12
+ end
12
13
 
13
- contract c_obj => C::Maybe[String]
14
- def checksum_for(obj)
15
- @checksums[obj.reference]
16
- end
14
+ contract c_obj => C::Maybe[String]
15
+ def checksum_for(obj)
16
+ @checksums[obj.reference]
17
+ end
17
18
 
18
- contract c_obj => C::Maybe[String]
19
- def content_checksum_for(obj)
20
- @checksums[[obj.reference, :content]]
21
- end
19
+ contract c_obj => C::Maybe[String]
20
+ def content_checksum_for(obj)
21
+ @checksums[[obj.reference, :content]]
22
+ end
22
23
 
23
- contract c_obj => C::Maybe[C::HashOf[Symbol, String]]
24
- def attributes_checksum_for(obj)
25
- @checksums[[obj.reference, :each_attribute]]
26
- end
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
- def to_h
29
- @checksums
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::Int
4
- # @api private
5
- # A dependency between two items/layouts.
6
- class Dependency
7
- include Nanoc::Int::ContractsSupport
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
- C_OBJ_FROM = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::Int::Configuration, Nanoc::Int::IdentifiableCollection]
10
- C_OBJ_TO = Nanoc::Int::Item
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
- contract C::None => C::Maybe[C_OBJ_FROM]
13
- attr_reader :from
13
+ contract C::None => C::Maybe[C_OBJ_FROM]
14
+ attr_reader :from
14
15
 
15
- contract C::None => C::Maybe[C_OBJ_TO]
16
- attr_reader :to
16
+ contract C::None => C::Maybe[C_OBJ_TO]
17
+ attr_reader :to
17
18
 
18
- contract C::None => Nanoc::Int::Props
19
- attr_reader :props
19
+ contract C::None => Nanoc::Int::Props
20
+ attr_reader :props
20
21
 
21
- contract C::Maybe[C_OBJ_FROM], C::Maybe[C_OBJ_TO], Nanoc::Int::Props => C::Any
22
- def initialize(from, to, props)
23
- @from = from
24
- @to = to
25
- @props = props
26
- end
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
- contract C::None => String
29
- def inspect
30
- "Dependency(#{@from.inspect} -> #{@to.inspect}, #{@props.inspect})"
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::Int
4
- # Module that contains all outdatedness reasons.
5
- #
6
- # @api private
7
- module OutdatednessReasons
8
- # A generic outdatedness reason. An outdatedness reason is basically a
9
- # descriptive message that explains why a given object is outdated.
10
- class Generic
11
- # @return [String] A descriptive message for this outdatedness reason
12
- attr_reader :message
13
-
14
- # @return [Nanoc::Int::Props]
15
- attr_reader :props
16
-
17
- # @param [String] message The descriptive message for this outdatedness
18
- # reason
19
- def initialize(message, props = Nanoc::Int::Props.new)
20
- @message = message
21
- @props = props
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
- @objects = objects
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
- class ItemCollectionExtended < DocumentCollectionExtended
63
- end
63
+ class ItemCollectionExtended < DocumentCollectionExtended
64
+ end
64
65
 
65
- class LayoutCollectionExtended < DocumentCollectionExtended
66
- end
66
+ class LayoutCollectionExtended < DocumentCollectionExtended
67
+ end
67
68
 
68
- class AttributesModified < Generic
69
- attr_reader :attributes
69
+ class AttributesModified < Generic
70
+ attr_reader :attributes
70
71
 
71
- def initialize(attributes)
72
- super(
73
- 'The attributes of this item have been modified since the last time the site was compiled.',
74
- Props.new(attributes: true, compiled_content: true),
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
- @attributes = attributes
78
+ @attributes = attributes
79
+ end
78
80
  end
79
- end
80
81
 
81
- UsesAlwaysOutdatedFilter = Generic.new(
82
- 'This item rep uses one or more filters that cannot track dependencies, and will thus always be considered as outdated.',
83
- Props.new(raw_content: true, attributes: true, compiled_content: true),
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