nanoc 4.11.0 → 4.11.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,32 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int
4
- # @api private
5
- class OutdatednessRule
6
- include Nanoc::Int::ContractsSupport
7
- include Singleton
3
+ module Nanoc
4
+ module Int
5
+ # @api private
6
+ class OutdatednessRule
7
+ include Nanoc::Core::ContractsSupport
8
+ include Singleton
8
9
 
9
- def call(obj, outdatedness_checker)
10
- Nanoc::Int::Instrumentor.call(:outdatedness_rule_ran, self.class) do
11
- apply(obj, outdatedness_checker)
10
+ def call(obj, outdatedness_checker)
11
+ Nanoc::Int::Instrumentor.call(:outdatedness_rule_ran, self.class) do
12
+ apply(obj, outdatedness_checker)
13
+ end
12
14
  end
13
- end
14
15
 
15
- def apply(_obj, _outdatedness_checker)
16
- raise NotImplementedError.new('Nanoc::Int::OutdatednessRule subclasses must implement #apply')
17
- end
16
+ def apply(_obj, _outdatedness_checker)
17
+ raise NotImplementedError.new('Nanoc::Int::OutdatednessRule subclasses must implement #apply')
18
+ end
18
19
 
19
- contract C::None => String
20
- def inspect
21
- "#{self.class.name}(#{reason})"
22
- end
20
+ contract C::None => String
21
+ def inspect
22
+ "#{self.class.name}(#{reason})"
23
+ end
23
24
 
24
- def self.affects_props(*names)
25
- @affected_props = Set.new(names)
26
- end
25
+ def self.affects_props(*names)
26
+ @affected_props = Set.new(names)
27
+ end
27
28
 
28
- def self.affected_props
29
- @affected_props
29
+ def self.affected_props
30
+ @affected_props
31
+ end
30
32
  end
31
33
  end
32
34
  end
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int
4
- # @api private
5
- module OutdatednessRules
3
+ module Nanoc
4
+ module Int
5
+ # @api private
6
+ module OutdatednessRules
7
+ end
6
8
  end
7
9
  end
8
10
 
@@ -1,36 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int::OutdatednessRules
4
- class AttributesModified < Nanoc::Int::OutdatednessRule
5
- include Nanoc::Int::ContractsSupport
3
+ module Nanoc
4
+ module Int
5
+ module OutdatednessRules
6
+ class AttributesModified < Nanoc::Int::OutdatednessRule
7
+ include Nanoc::Core::ContractsSupport
6
8
 
7
- affects_props :attributes, :compiled_content
9
+ affects_props :attributes, :compiled_content
8
10
 
9
- contract C::Or[Nanoc::Int::ItemRep, Nanoc::Int::Item, Nanoc::Int::Configuration, Nanoc::Int::Layout], C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
10
- def apply(obj, outdatedness_checker)
11
- case obj
12
- when Nanoc::Int::ItemRep
13
- apply(obj.item, outdatedness_checker)
14
- when Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::Int::Configuration
15
- if outdatedness_checker.checksum_store[obj] == outdatedness_checker.checksums.checksum_for(obj)
16
- return nil
17
- end
11
+ contract C::Or[Nanoc::Core::ItemRep, Nanoc::Core::Item, Nanoc::Core::Configuration, Nanoc::Core::Layout], C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
12
+ def apply(obj, outdatedness_checker)
13
+ case obj
14
+ when Nanoc::Core::ItemRep
15
+ apply(obj.item, outdatedness_checker)
16
+ when Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::Configuration
17
+ if outdatedness_checker.checksum_store[obj] == outdatedness_checker.checksums.checksum_for(obj)
18
+ return nil
19
+ end
18
20
 
19
- old_checksums = outdatedness_checker.checksum_store.attributes_checksum_for(obj)
20
- unless old_checksums
21
- return Nanoc::Int::OutdatednessReasons::AttributesModified.new(true)
22
- end
21
+ old_checksums = outdatedness_checker.checksum_store.attributes_checksum_for(obj)
22
+ unless old_checksums
23
+ return Nanoc::Int::OutdatednessReasons::AttributesModified.new(true)
24
+ end
23
25
 
24
- new_checksums = outdatedness_checker.checksums.attributes_checksum_for(obj)
26
+ new_checksums = outdatedness_checker.checksums.attributes_checksum_for(obj)
25
27
 
26
- attributes = Set.new(old_checksums.keys) + Set.new(new_checksums.keys)
27
- changed_attributes = attributes.reject { |a| old_checksums[a] == new_checksums[a] }
28
+ attributes = Set.new(old_checksums.keys) + Set.new(new_checksums.keys)
29
+ changed_attributes = attributes.reject { |a| old_checksums[a] == new_checksums[a] }
28
30
 
29
- if changed_attributes.any?
30
- Nanoc::Int::OutdatednessReasons::AttributesModified.new(changed_attributes)
31
+ if changed_attributes.any?
32
+ Nanoc::Int::OutdatednessReasons::AttributesModified.new(changed_attributes)
33
+ end
34
+ else
35
+ raise ArgumentError
36
+ end
31
37
  end
32
- else
33
- raise ArgumentError
34
38
  end
35
39
  end
36
40
  end
@@ -1,26 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int::OutdatednessRules
4
- class CodeSnippetsModified < Nanoc::Int::OutdatednessRule
5
- DDMemoize.activate(self)
3
+ module Nanoc
4
+ module Int
5
+ module OutdatednessRules
6
+ class CodeSnippetsModified < Nanoc::Int::OutdatednessRule
7
+ DDMemoize.activate(self)
6
8
 
7
- include Nanoc::Int::ContractsSupport
9
+ include Nanoc::Core::ContractsSupport
8
10
 
9
- affects_props :raw_content, :attributes, :compiled_content, :path
11
+ affects_props :raw_content, :attributes, :compiled_content, :path
10
12
 
11
- def apply(_obj, outdatedness_checker)
12
- if any_snippets_modified?(outdatedness_checker)
13
- Nanoc::Int::OutdatednessReasons::CodeSnippetsModified
14
- end
15
- end
13
+ def apply(_obj, outdatedness_checker)
14
+ if any_snippets_modified?(outdatedness_checker)
15
+ Nanoc::Int::OutdatednessReasons::CodeSnippetsModified
16
+ end
17
+ end
16
18
 
17
- private
19
+ private
18
20
 
19
- memoized def any_snippets_modified?(outdatedness_checker)
20
- outdatedness_checker.site.code_snippets.any? do |cs|
21
- ch_old = outdatedness_checker.checksum_store[cs]
22
- ch_new = outdatedness_checker.checksums.checksum_for(cs)
23
- ch_old != ch_new
21
+ memoized def any_snippets_modified?(outdatedness_checker)
22
+ outdatedness_checker.site.code_snippets.any? do |cs|
23
+ ch_old = outdatedness_checker.checksum_store[cs]
24
+ ch_new = outdatedness_checker.checksums.checksum_for(cs)
25
+ ch_old != ch_new
26
+ end
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -1,16 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int::OutdatednessRules
4
- class ContentModified < Nanoc::Int::OutdatednessRule
5
- affects_props :raw_content, :compiled_content
3
+ module Nanoc
4
+ module Int
5
+ module OutdatednessRules
6
+ class ContentModified < Nanoc::Int::OutdatednessRule
7
+ affects_props :raw_content, :compiled_content
6
8
 
7
- def apply(obj, outdatedness_checker)
8
- obj = obj.item if obj.is_a?(Nanoc::Int::ItemRep)
9
+ def apply(obj, outdatedness_checker)
10
+ obj = obj.item if obj.is_a?(Nanoc::Core::ItemRep)
9
11
 
10
- ch_old = outdatedness_checker.checksum_store.content_checksum_for(obj)
11
- ch_new = outdatedness_checker.checksums.content_checksum_for(obj)
12
- if ch_old != ch_new
13
- Nanoc::Int::OutdatednessReasons::ContentModified
12
+ ch_old = outdatedness_checker.checksum_store.content_checksum_for(obj)
13
+ ch_new = outdatedness_checker.checksums.content_checksum_for(obj)
14
+ if ch_old != ch_new
15
+ Nanoc::Int::OutdatednessReasons::ContentModified
16
+ end
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -1,15 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int::OutdatednessRules
4
- class ItemCollectionExtended < Nanoc::Int::OutdatednessRule
5
- affects_props :raw_content
3
+ module Nanoc
4
+ module Int
5
+ module OutdatednessRules
6
+ class ItemCollectionExtended < Nanoc::Int::OutdatednessRule
7
+ affects_props :raw_content
6
8
 
7
- contract Nanoc::Int::ItemCollection, C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
8
- def apply(_obj, outdatedness_checker)
9
- new_items = outdatedness_checker.dependency_store.new_items
9
+ contract Nanoc::Core::ItemCollection, C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
10
+ def apply(_obj, outdatedness_checker)
11
+ new_items = outdatedness_checker.dependency_store.new_items
10
12
 
11
- if new_items.any?
12
- Nanoc::Int::OutdatednessReasons::ItemCollectionExtended.new(new_items)
13
+ if new_items.any?
14
+ Nanoc::Int::OutdatednessReasons::ItemCollectionExtended.new(new_items)
15
+ end
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,15 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int::OutdatednessRules
4
- class LayoutCollectionExtended < Nanoc::Int::OutdatednessRule
5
- affects_props :raw_content
3
+ module Nanoc
4
+ module Int
5
+ module OutdatednessRules
6
+ class LayoutCollectionExtended < Nanoc::Int::OutdatednessRule
7
+ affects_props :raw_content
6
8
 
7
- contract Nanoc::Int::LayoutCollection, C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
8
- def apply(_obj, outdatedness_checker)
9
- new_layouts = outdatedness_checker.dependency_store.new_layouts
9
+ contract Nanoc::Core::LayoutCollection, C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
10
+ def apply(_obj, outdatedness_checker)
11
+ new_layouts = outdatedness_checker.dependency_store.new_layouts
10
12
 
11
- if new_layouts.any?
12
- Nanoc::Int::OutdatednessReasons::LayoutCollectionExtended.new(new_layouts)
13
+ if new_layouts.any?
14
+ Nanoc::Int::OutdatednessReasons::LayoutCollectionExtended.new(new_layouts)
15
+ end
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,12 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int::OutdatednessRules
4
- class NotWritten < Nanoc::Int::OutdatednessRule
5
- affects_props :raw_content, :attributes, :compiled_content, :path
3
+ module Nanoc
4
+ module Int
5
+ module OutdatednessRules
6
+ class NotWritten < Nanoc::Int::OutdatednessRule
7
+ affects_props :raw_content, :attributes, :compiled_content, :path
6
8
 
7
- def apply(obj, _outdatedness_checker)
8
- if obj.raw_paths.values.flatten.compact.any? { |fn| !File.file?(fn) }
9
- Nanoc::Int::OutdatednessReasons::NotWritten
9
+ def apply(obj, _outdatedness_checker)
10
+ if obj.raw_paths.values.flatten.compact.any? { |fn| !File.file?(fn) }
11
+ Nanoc::Int::OutdatednessReasons::NotWritten
12
+ end
13
+ end
10
14
  end
11
15
  end
12
16
  end
@@ -1,41 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int::OutdatednessRules
4
- class RulesModified < Nanoc::Int::OutdatednessRule
5
- affects_props :compiled_content, :path
6
-
7
- def apply(obj, outdatedness_checker)
8
- # Check rules of obj itself
9
- if rules_modified?(obj, outdatedness_checker)
10
- return Nanoc::Int::OutdatednessReasons::RulesModified
3
+ module Nanoc
4
+ module Int
5
+ module OutdatednessRules
6
+ class RulesModified < Nanoc::Int::OutdatednessRule
7
+ affects_props :compiled_content, :path
8
+
9
+ def apply(obj, outdatedness_checker)
10
+ # Check rules of obj itself
11
+ if rules_modified?(obj, outdatedness_checker)
12
+ return Nanoc::Int::OutdatednessReasons::RulesModified
13
+ end
14
+
15
+ # Check rules of layouts used by obj
16
+ layouts = layouts_touched_by(obj, outdatedness_checker)
17
+ if layouts.any? { |layout| rules_modified?(layout, outdatedness_checker) }
18
+ return Nanoc::Int::OutdatednessReasons::RulesModified
19
+ end
20
+
21
+ nil
22
+ end
23
+
24
+ private
25
+
26
+ def rules_modified?(obj, outdatedness_checker)
27
+ seq_old = outdatedness_checker.action_sequence_store[obj]
28
+ seq_new = outdatedness_checker.action_sequence_for(obj).serialize
29
+
30
+ !seq_old.eql?(seq_new)
31
+ end
32
+
33
+ def layouts_touched_by(obj, outdatedness_checker)
34
+ actions = outdatedness_checker.action_sequence_store[obj]
35
+ layout_actions = actions.select { |a| a.first == :layout }
36
+
37
+ layout_actions.map do |layout_action|
38
+ layout_pattern = layout_action[1]
39
+ outdatedness_checker.site.layouts[layout_pattern]
40
+ end.compact
41
+ end
11
42
  end
12
-
13
- # Check rules of layouts used by obj
14
- layouts = layouts_touched_by(obj, outdatedness_checker)
15
- if layouts.any? { |layout| rules_modified?(layout, outdatedness_checker) }
16
- return Nanoc::Int::OutdatednessReasons::RulesModified
17
- end
18
-
19
- nil
20
- end
21
-
22
- private
23
-
24
- def rules_modified?(obj, outdatedness_checker)
25
- seq_old = outdatedness_checker.action_sequence_store[obj]
26
- seq_new = outdatedness_checker.action_sequence_for(obj).serialize
27
-
28
- !seq_old.eql?(seq_new)
29
- end
30
-
31
- def layouts_touched_by(obj, outdatedness_checker)
32
- actions = outdatedness_checker.action_sequence_store[obj]
33
- layout_actions = actions.select { |a| a.first == :layout }
34
-
35
- layout_actions.map do |layout_action|
36
- layout_pattern = layout_action[1]
37
- outdatedness_checker.site.layouts[layout_pattern]
38
- end.compact
39
43
  end
40
44
  end
41
45
  end
@@ -1,22 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Int::OutdatednessRules
4
- class UsesAlwaysOutdatedFilter < Nanoc::Int::OutdatednessRule
5
- affects_props :raw_content, :attributes, :path
3
+ module Nanoc
4
+ module Int
5
+ module OutdatednessRules
6
+ class UsesAlwaysOutdatedFilter < Nanoc::Int::OutdatednessRule
7
+ affects_props :raw_content, :attributes, :path
6
8
 
7
- def apply(obj, outdatedness_checker)
8
- seq = outdatedness_checker.action_sequence_for(obj)
9
- if any_always_outdated?(seq)
10
- Nanoc::Int::OutdatednessReasons::UsesAlwaysOutdatedFilter
11
- end
12
- end
9
+ def apply(obj, outdatedness_checker)
10
+ seq = outdatedness_checker.action_sequence_for(obj)
11
+ if any_always_outdated?(seq)
12
+ Nanoc::Int::OutdatednessReasons::UsesAlwaysOutdatedFilter
13
+ end
14
+ end
13
15
 
14
- def any_always_outdated?(seq)
15
- seq
16
- .select { |a| a.is_a?(Nanoc::Int::ProcessingActions::Filter) }
17
- .map { |a| Nanoc::Filter.named(a.filter_name) }
18
- .compact
19
- .any?(&:always_outdated?)
16
+ def any_always_outdated?(seq)
17
+ seq
18
+ .select { |a| a.is_a?(Nanoc::Core::ProcessingActions::Filter) }
19
+ .map { |a| Nanoc::Filter.named(a.filter_name) }
20
+ .compact
21
+ .any?(&:always_outdated?)
22
+ end
23
+ end
20
24
  end
21
25
  end
22
26
  end
@@ -6,9 +6,9 @@ module Nanoc
6
6
  #
7
7
  # @api private
8
8
  class Pruner
9
- include Nanoc::Int::ContractsSupport
9
+ include Nanoc::Core::ContractsSupport
10
10
 
11
- # @param [Nanoc::Int::Configuration] config
11
+ # @param [Nanoc::Core::Configuration] config
12
12
  #
13
13
  # @param [Nanoc::Int::ItemRepRepo] reps
14
14
  #
@@ -35,3 +35,10 @@ require_relative 'views/post_compile_item_view'
35
35
  require_relative 'views/post_compile_item_collection_view'
36
36
  require_relative 'views/post_compile_item_rep_view'
37
37
  require_relative 'views/post_compile_item_rep_collection_view'
38
+
39
+ # TODO: Move this, once the load order is improved (i.e. the checksummer is
40
+ # loded after the views are).
41
+ Nanoc::Core::Checksummer.define_behavior(
42
+ Nanoc::View,
43
+ Nanoc::Core::Checksummer::UnwrapUpdateBehavior,
44
+ )
@@ -13,7 +13,7 @@ module Nanoc
13
13
  raise Nanoc::Int::Errors::CannotGetParentOrChildrenOfNonLegacyItem.new(_unwrap.identifier)
14
14
  end
15
15
 
16
- children_pattern = Nanoc::Int::Pattern.from(_unwrap.identifier.to_s + '*/')
16
+ children_pattern = Nanoc::Core::Pattern.from(_unwrap.identifier.to_s + '*/')
17
17
  children = @context.items.select { |i| children_pattern.match?(i.identifier) }
18
18
 
19
19
  children.map { |i| self.class.new(i, @context) }.freeze