nanoc-core 4.12.0 → 4.12.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3785b5628c2b36382f5c6eed88988943304f6d4e8555a4a72c769b11e8f9a21e
4
- data.tar.gz: cb562257783d0a0d351822b25c19f9172e134a9910b2fd475ec27a2aa6a13321
3
+ metadata.gz: 696f833c95259f4ac196571804aad577bf848fefe59d4f52900ddf7be3ba1866
4
+ data.tar.gz: 4e058aa3ebc13f7140166d69a1e8668be7740fbcfd3dcf0cdb9c5d698d17bd0c
5
5
  SHA512:
6
- metadata.gz: 5386cce963813faa6c3ac38936b8b2ffce7e3fc94297b5f663a4b8b76df9590e62ee891013abfe665f5f2c06bd14cc754b3c56cbf473b38a079a97eab0e11900
7
- data.tar.gz: a038f93b08e01ecad024545e97fde14627c1522ed546d6f2cfebdb06f348ad3fdc4fbb2743d8dbe0a658333ba996a91d2f559bbfd8dbd7e5045d35f07b3302ba
6
+ metadata.gz: 6fba91ec4738cc64277c5cf0976704fee75355e5f6113691413b6d17b409aa08335221e0148f08de5ce4958cf8ad3a7b07cb315cd290be443b2b809728cc0b43
7
+ data.tar.gz: '09a8b04c706fa8e58e62510a19e7f8b426d826fd6209d12c092d99ec44abbd80db5665d9f34bc3f030bca8949435c52fd2d60f69f346940cf202ddce44d83cf8'
@@ -3,9 +3,9 @@
3
3
  module Nanoc
4
4
  module Core
5
5
  class ActionSequence
6
- include Nanoc::Core::ContractsSupport
6
+ # include Nanoc::Core::ContractsSupport
7
7
  include Enumerable
8
- DDMemoize.activate(self)
8
+ prepend MemoWise
9
9
 
10
10
  attr_reader :item_rep
11
11
  attr_reader :actions
@@ -15,42 +15,43 @@ module Nanoc
15
15
  @actions = actions
16
16
  end
17
17
 
18
- contract C::None => Numeric
18
+ # contract C::None => Numeric
19
19
  def size
20
20
  @actions.size
21
21
  end
22
22
 
23
- contract Numeric => C::Maybe[Nanoc::Core::ProcessingAction]
23
+ # contract Numeric => C::Maybe[Nanoc::Core::ProcessingAction]
24
24
  def [](idx)
25
25
  @actions[idx]
26
26
  end
27
27
 
28
- contract C::None => C::ArrayOf[Nanoc::Core::ProcessingAction]
28
+ # contract C::None => C::ArrayOf[Nanoc::Core::ProcessingAction]
29
29
  def snapshot_actions
30
30
  @actions.select { |a| a.is_a?(Nanoc::Core::ProcessingActions::Snapshot) }
31
31
  end
32
32
 
33
- contract C::None => Array
33
+ # contract C::None => Array
34
34
  def paths
35
35
  snapshot_actions.map { |a| [a.snapshot_names, a.paths] }
36
36
  end
37
37
 
38
- memoized def serialize
38
+ def serialize
39
39
  serialize_uncached
40
40
  end
41
+ memo_wise :serialize
41
42
 
42
- contract C::None => Array
43
+ # contract C::None => Array
43
44
  def serialize_uncached
44
45
  to_a.map(&:serialize)
45
46
  end
46
47
 
47
- contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
48
+ # contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
48
49
  def each
49
50
  @actions.each { |a| yield(a) }
50
51
  self
51
52
  end
52
53
 
53
- contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
54
+ # contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
54
55
  def map
55
56
  self.class.new(
56
57
  @item_rep,
@@ -36,7 +36,13 @@ module Nanoc
36
36
  # @return [void]
37
37
  def load
38
38
  # rubocop:disable Security/Eval
39
- eval('def self.use_helper(mod); Nanoc::Core::Context.instance_eval { include mod }; end', TOPLEVEL_BINDING)
39
+ eval(<<~CODE, TOPLEVEL_BINDING)
40
+ unless respond_to?(:use_helper)
41
+ def self.use_helper(mod)
42
+ Nanoc::Core::Context.instance_eval { include mod }
43
+ end
44
+ end
45
+ CODE
40
46
  eval(@data, TOPLEVEL_BINDING, @filename)
41
47
  # rubocop:enable Security/Eval
42
48
  nil
@@ -34,7 +34,7 @@ module Nanoc
34
34
  if res
35
35
  start = Time.now
36
36
  sleep 0.05 until File.file?(res) || Time.now - start > FILE_APPEAR_TIMEOUT
37
- raise Nanoc::Core::Errors::InternalInconsistency, "File did not apear in time: #{res}" unless File.file?(res)
37
+ raise Nanoc::Core::Errors::InternalInconsistency, "File raw_path did not appear in time (#{FILE_APPEAR_TIMEOUT}s): #{res}" unless File.file?(res)
38
38
  end
39
39
 
40
40
  res
@@ -18,15 +18,20 @@ module Nanoc
18
18
  contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
19
19
  def run(rep, is_outdated:)
20
20
  if can_reuse_content_for_rep?(rep, is_outdated: is_outdated)
21
+ # If cached content can be used for this item rep, do so, and skip
22
+ # recalculation of the item rep compiled content.
21
23
  Nanoc::Core::NotificationCenter.post(:cached_content_used, rep)
22
-
23
24
  @compiled_content_store.set_all(rep, @compiled_content_cache[rep])
24
25
  else
26
+ # Cached content couldn’t be used for this rep. Continue as usual with
27
+ # recalculation of the item rep compiled content.
25
28
  yield
29
+
30
+ # Update compiled content cache, now that the item rep is compiled.
31
+ @compiled_content_cache[rep] = @compiled_content_store.get_all(rep)
26
32
  end
27
33
 
28
34
  rep.compiled = true
29
- @compiled_content_cache[rep] = @compiled_content_store.get_all(rep)
30
35
  end
31
36
 
32
37
  contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Bool
@@ -29,12 +29,7 @@ module Nanoc
29
29
 
30
30
  # @return [String]
31
31
  def self.config_filename_for_cwd
32
- filenames =
33
- if Nanoc::Core::Feature.enabled?(Nanoc::Core::Feature::TOML)
34
- %w[nanoc.yaml config.yaml nanoc.toml]
35
- else
36
- %w[nanoc.yaml config.yaml]
37
- end
32
+ filenames = %w[nanoc.yaml config.yaml]
38
33
  candidate = filenames.find { |f| File.file?(f) }
39
34
  candidate && File.expand_path(candidate)
40
35
  end
@@ -59,14 +54,7 @@ module Nanoc
59
54
  end
60
55
 
61
56
  def load_file(filename)
62
- case File.extname(filename)
63
- when '.yaml'
64
- YAML.load_file(filename)
65
- when '.toml'
66
- Tomlrb.load_file(filename)
67
- else
68
- raise Nanoc::Core::Errors::InternalInconsistency, 'Unhandled config file extension'
69
- end
57
+ YAML.load_file(filename)
70
58
  end
71
59
 
72
60
  # @api private
@@ -11,7 +11,7 @@ module Nanoc
11
11
  contract C::Maybe[String] => C::Any
12
12
  def initialize(filename)
13
13
  if filename && Pathname.new(filename).relative?
14
- raise ArgumentError, 'Content filename is not absolute'
14
+ raise ArgumentError, "Content filename #{filename} is not absolute"
15
15
  end
16
16
 
17
17
  @filename = filename
@@ -19,20 +19,25 @@ module Nanoc
19
19
  def initialize(items, layouts, config)
20
20
  super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'dependencies'), 5)
21
21
 
22
+ @config = config
22
23
  @items = items
23
24
  @layouts = layouts
24
25
 
25
- @refs2objs = {}
26
- items.each { |o| add_vertex_for(o) }
27
- layouts.each { |o| add_vertex_for(o) }
28
- add_vertex_for(config)
29
- add_vertex_for(items)
30
- add_vertex_for(layouts)
26
+ rebuild_refs2objs
31
27
 
32
28
  @new_objects = []
33
29
  @graph = Nanoc::Core::DirectedGraph.new([nil] + objs2refs(@items) + objs2refs(@layouts))
34
30
  end
35
31
 
32
+ def rebuild_refs2objs
33
+ @refs2objs = {}
34
+ @items.each { |o| add_vertex_for(o) }
35
+ @layouts.each { |o| add_vertex_for(o) }
36
+ add_vertex_for(@config)
37
+ add_vertex_for(@items)
38
+ add_vertex_for(@layouts)
39
+ end
40
+
36
41
  contract C_OBJ_SRC => C::ArrayOf[Nanoc::Core::Dependency]
37
42
  def dependencies_causing_outdatedness_of(object)
38
43
  objects_causing_outdatedness_of(object).map do |other_object|
@@ -53,14 +58,12 @@ module Nanoc
53
58
 
54
59
  def items=(items)
55
60
  @items = items
56
- items.each { |o| @refs2objs[obj2ref(o)] = o }
57
- add_vertex_for(items)
61
+ rebuild_refs2objs
58
62
  end
59
63
 
60
64
  def layouts=(layouts)
61
65
  @layouts = layouts
62
- layouts.each { |o| @refs2objs[obj2ref(o)] = o }
63
- add_vertex_for(layouts)
66
+ rebuild_refs2objs
64
67
  end
65
68
 
66
69
  def new_items
@@ -3,9 +3,9 @@
3
3
  module Nanoc
4
4
  module Core
5
5
  class IdentifiableCollection
6
- DDMemoize.activate(self)
6
+ prepend MemoWise
7
7
 
8
- include Nanoc::Core::ContractsSupport
8
+ # include Nanoc::Core::ContractsSupport
9
9
  include Enumerable
10
10
 
11
11
  extend Forwardable
@@ -17,19 +17,19 @@ module Nanoc
17
17
  raise 'IdentifiableCollection is abstract and cannot be instantiated'
18
18
  end
19
19
 
20
- contract C::Or[Hash, C::Named['Nanoc::Core::Configuration']], C::IterOf[C::RespondTo[:identifier]], C::Maybe[String] => C::Any
20
+ # contract C::Or[Hash, C::Named['Nanoc::Core::Configuration']], C::IterOf[C::RespondTo[:identifier]], C::Maybe[String] => C::Any
21
21
  def initialize_basic(config, objects = [], name = nil)
22
22
  @config = config
23
23
  @objects = Hamster::Vector.new(objects)
24
24
  @name = name
25
25
  end
26
26
 
27
- contract C::None => String
27
+ # contract C::None => String
28
28
  def inspect
29
29
  "<#{self.class}>"
30
30
  end
31
31
 
32
- contract C::None => self
32
+ # contract C::None => self
33
33
  def freeze
34
34
  @objects.freeze
35
35
  each(&:freeze)
@@ -37,7 +37,7 @@ module Nanoc
37
37
  super
38
38
  end
39
39
 
40
- contract C::Any => C::Maybe[C::RespondTo[:identifier]]
40
+ # contract C::Any => C::Maybe[C::RespondTo[:identifier]]
41
41
  def [](arg)
42
42
  if frozen?
43
43
  get_memoized(arg)
@@ -46,7 +46,7 @@ module Nanoc
46
46
  end
47
47
  end
48
48
 
49
- contract C::Any => C::IterOf[C::RespondTo[:identifier]]
49
+ # contract C::Any => C::IterOf[C::RespondTo[:identifier]]
50
50
  def find_all(arg)
51
51
  if frozen?
52
52
  find_all_memoized(arg)
@@ -55,27 +55,27 @@ module Nanoc
55
55
  end
56
56
  end
57
57
 
58
- contract C::None => C::ArrayOf[C::RespondTo[:identifier]]
58
+ # contract C::None => C::ArrayOf[C::RespondTo[:identifier]]
59
59
  def to_a
60
60
  @objects.to_a
61
61
  end
62
62
 
63
- contract C::None => C::Bool
63
+ # contract C::None => C::Bool
64
64
  def empty?
65
65
  @objects.empty?
66
66
  end
67
67
 
68
- contract C::RespondTo[:identifier] => self
68
+ # contract C::RespondTo[:identifier] => self
69
69
  def add(obj)
70
70
  self.class.new(@config, @objects.add(obj))
71
71
  end
72
72
 
73
- contract C::Func[C::RespondTo[:identifier] => C::Any] => self
73
+ # contract C::Func[C::RespondTo[:identifier] => C::Any] => self
74
74
  def reject(&block)
75
75
  self.class.new(@config, @objects.reject(&block))
76
76
  end
77
77
 
78
- contract C::Any => C::Maybe[C::RespondTo[:identifier]]
78
+ # contract C::Any => C::Maybe[C::RespondTo[:identifier]]
79
79
  def object_with_identifier(identifier)
80
80
  if frozen?
81
81
  @mapping[identifier.to_s]
@@ -86,7 +86,7 @@ module Nanoc
86
86
 
87
87
  protected
88
88
 
89
- contract C::Any => C::Maybe[C::RespondTo[:identifier]]
89
+ # contract C::Any => C::Maybe[C::RespondTo[:identifier]]
90
90
  def get_unmemoized(arg)
91
91
  case arg
92
92
  when Nanoc::Core::Identifier
@@ -100,21 +100,23 @@ module Nanoc
100
100
  end
101
101
  end
102
102
 
103
- contract C::Any => C::Maybe[C::RespondTo[:identifier]]
104
- memoized def get_memoized(arg)
105
- get_unmemoized(arg)
103
+ # contract C::Any => C::Maybe[C::RespondTo[:identifier]]
104
+ def get_memoized(_arg)
105
+ # TODO: Figure out how to get memo_wise to work with subclasses
106
+ raise 'implement in subclasses'
106
107
  end
107
108
 
108
- contract C::Any => C::IterOf[C::RespondTo[:identifier]]
109
+ # contract C::Any => C::IterOf[C::RespondTo[:identifier]]
109
110
  def find_all_unmemoized(arg)
110
111
  pat = Pattern.from(arg)
111
112
  select { |i| pat.match?(i.identifier) }
112
113
  end
113
114
 
114
- contract C::Any => C::IterOf[C::RespondTo[:identifier]]
115
- memoized def find_all_memoized(arg)
115
+ # contract C::Any => C::IterOf[C::RespondTo[:identifier]]
116
+ def find_all_memoized(arg)
116
117
  find_all_unmemoized(arg)
117
118
  end
119
+ memo_wise :find_all_memoized
118
120
 
119
121
  def object_matching_glob(glob)
120
122
  if use_globs?
@@ -130,7 +132,7 @@ module Nanoc
130
132
  end
131
133
  end
132
134
 
133
- contract C::None => C::Bool
135
+ # contract C::None => C::Bool
134
136
  def use_globs?
135
137
  @config[:string_pattern_type] == 'glob'
136
138
  end
@@ -3,10 +3,18 @@
3
3
  module Nanoc
4
4
  module Core
5
5
  class ItemCollection < IdentifiableCollection
6
+ prepend MemoWise
7
+
6
8
  def initialize(config, objects = [])
7
9
  initialize_basic(config, objects, 'items')
8
10
  end
9
11
 
12
+ # contract C::Any => C::Maybe[C::RespondTo[:identifier]]
13
+ def get_memoized(arg)
14
+ get_unmemoized(arg)
15
+ end
16
+ memo_wise :get_memoized
17
+
10
18
  def reference
11
19
  'items'
12
20
  end
@@ -3,10 +3,18 @@
3
3
  module Nanoc
4
4
  module Core
5
5
  class LayoutCollection < IdentifiableCollection
6
+ prepend MemoWise
7
+
6
8
  def initialize(config, objects = [])
7
9
  initialize_basic(config, objects, 'layouts')
8
10
  end
9
11
 
12
+ # contract C::Any => C::Maybe[C::RespondTo[:identifier]]
13
+ def get_memoized(arg)
14
+ get_unmemoized(arg)
15
+ end
16
+ memo_wise :get_memoized
17
+
10
18
  def reference
11
19
  'layouts'
12
20
  end
@@ -7,9 +7,9 @@ module Nanoc
7
7
  # @api private
8
8
  class OutdatednessChecker
9
9
  class Basic
10
- DDMemoize.activate(self)
10
+ prepend MemoWise
11
11
 
12
- include Nanoc::Core::ContractsSupport
12
+ # include Nanoc::Core::ContractsSupport
13
13
 
14
14
  Rules = Nanoc::Core::OutdatednessRules
15
15
 
@@ -46,16 +46,16 @@ module Nanoc
46
46
  Rules::LayoutCollectionExtended,
47
47
  ].freeze
48
48
 
49
- C_OBJ_MAYBE_REP = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep, Nanoc::Core::Configuration, Nanoc::Core::Layout, Nanoc::Core::ItemCollection, Nanoc::Core::LayoutCollection]
49
+ # C_OBJ_MAYBE_REP = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep, Nanoc::Core::Configuration, Nanoc::Core::Layout, Nanoc::Core::ItemCollection, Nanoc::Core::LayoutCollection]
50
50
 
51
- contract C::KeywordArgs[outdatedness_checker: OutdatednessChecker, reps: Nanoc::Core::ItemRepRepo] => C::Any
51
+ # contract C::KeywordArgs[outdatedness_checker: OutdatednessChecker, reps: Nanoc::Core::ItemRepRepo] => C::Any
52
52
  def initialize(outdatedness_checker:, reps:)
53
53
  @outdatedness_checker = outdatedness_checker
54
54
  @reps = reps
55
55
  end
56
56
 
57
- contract C_OBJ_MAYBE_REP => C::Maybe[Nanoc::Core::OutdatednessStatus]
58
- memoized def outdatedness_status_for(obj)
57
+ # contract C_OBJ_MAYBE_REP => C::Maybe[Nanoc::Core::OutdatednessStatus]
58
+ def outdatedness_status_for(obj)
59
59
  case obj
60
60
  when Nanoc::Core::ItemRep
61
61
  apply_rules(RULES_FOR_ITEM_REP, obj)
@@ -73,10 +73,11 @@ module Nanoc
73
73
  raise Nanoc::Core::Errors::InternalInconsistency, "do not know how to check outdatedness of #{obj.inspect}"
74
74
  end
75
75
  end
76
+ memo_wise :outdatedness_status_for
76
77
 
77
78
  private
78
79
 
79
- contract C::ArrayOf[Class], C_OBJ_MAYBE_REP, Nanoc::Core::OutdatednessStatus => C::Maybe[Nanoc::Core::OutdatednessStatus]
80
+ # contract C::ArrayOf[Class], C_OBJ_MAYBE_REP, Nanoc::Core::OutdatednessStatus => C::Maybe[Nanoc::Core::OutdatednessStatus]
80
81
  def apply_rules(rules, obj, status = Nanoc::Core::OutdatednessStatus.new)
81
82
  rules.inject(status) do |acc, rule|
82
83
  if !acc.useful_to_apply?(rule)
@@ -92,15 +93,15 @@ module Nanoc
92
93
  end
93
94
  end
94
95
 
95
- contract C::ArrayOf[Class], C::ArrayOf[C_OBJ_MAYBE_REP] => C::Maybe[Nanoc::Core::OutdatednessStatus]
96
+ # contract C::ArrayOf[Class], C::ArrayOf[C_OBJ_MAYBE_REP] => C::Maybe[Nanoc::Core::OutdatednessStatus]
96
97
  def apply_rules_multi(rules, objs)
97
98
  objs.inject(Nanoc::Core::OutdatednessStatus.new) { |acc, elem| apply_rules(rules, elem, acc) }
98
99
  end
99
100
  end
100
101
 
101
- DDMemoize.activate(self)
102
+ prepend MemoWise
102
103
 
103
- include Nanoc::Core::ContractsSupport
104
+ # include Nanoc::Core::ContractsSupport
104
105
 
105
106
  attr_reader :checksum_store
106
107
  attr_reader :checksums
@@ -111,11 +112,11 @@ module Nanoc
111
112
 
112
113
  Reasons = Nanoc::Core::OutdatednessReasons
113
114
 
114
- C_OBJ = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep, Nanoc::Core::Configuration, Nanoc::Core::Layout, Nanoc::Core::ItemCollection]
115
- C_ITEM_OR_REP = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep]
116
- C_ACTION_SEQUENCES = C::HashOf[C_OBJ => Nanoc::Core::ActionSequence]
115
+ # C_OBJ = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep, Nanoc::Core::Configuration, Nanoc::Core::Layout, Nanoc::Core::ItemCollection]
116
+ # C_ITEM_OR_REP = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep]
117
+ # C_ACTION_SEQUENCES = C::HashOf[C_OBJ => Nanoc::Core::ActionSequence]
117
118
 
118
- contract C::KeywordArgs[site: Nanoc::Core::Site, checksum_store: Nanoc::Core::ChecksumStore, checksums: Nanoc::Core::ChecksumCollection, dependency_store: Nanoc::Core::DependencyStore, action_sequence_store: Nanoc::Core::ActionSequenceStore, action_sequences: C_ACTION_SEQUENCES, reps: Nanoc::Core::ItemRepRepo] => C::Any
119
+ # contract C::KeywordArgs[site: Nanoc::Core::Site, checksum_store: Nanoc::Core::ChecksumStore, checksums: Nanoc::Core::ChecksumCollection, dependency_store: Nanoc::Core::DependencyStore, action_sequence_store: Nanoc::Core::ActionSequenceStore, action_sequences: C_ACTION_SEQUENCES, reps: Nanoc::Core::ItemRepRepo] => C::Any
119
120
  def initialize(site:, checksum_store:, checksums:, dependency_store:, action_sequence_store:, action_sequences:, reps:)
120
121
  @site = site
121
122
  @checksum_store = checksum_store
@@ -132,12 +133,12 @@ module Nanoc
132
133
  @action_sequences.fetch(rep)
133
134
  end
134
135
 
135
- contract C_OBJ => C::Bool
136
+ # contract C_OBJ => C::Bool
136
137
  def outdated?(obj)
137
138
  outdatedness_reasons_for(obj).any?
138
139
  end
139
140
 
140
- contract C_OBJ => C::IterOf[Reasons::Generic]
141
+ # contract C_OBJ => C::IterOf[Reasons::Generic]
141
142
  def outdatedness_reasons_for(obj)
142
143
  reasons = basic.outdatedness_status_for(obj).reasons
143
144
  if reasons.any?
@@ -151,12 +152,12 @@ module Nanoc
151
152
 
152
153
  private
153
154
 
154
- contract C::None => Basic
155
+ # contract C::None => Basic
155
156
  def basic
156
157
  @_basic ||= Basic.new(outdatedness_checker: self, reps: @reps)
157
158
  end
158
159
 
159
- contract C_OBJ, Hamster::Set => C::Bool
160
+ # contract C_OBJ, Hamster::Set => C::Bool
160
161
  def outdated_due_to_dependencies?(obj, processed = Hamster::Set.new)
161
162
  # Convert from rep to item if necessary
162
163
  obj = obj.item if obj.is_a?(Nanoc::Core::ItemRep)
@@ -188,7 +189,7 @@ module Nanoc
188
189
  is_outdated
189
190
  end
190
191
 
191
- contract Nanoc::Core::Dependency => C::Bool
192
+ # contract Nanoc::Core::Dependency => C::Bool
192
193
  def dependency_causes_outdatedness?(dependency)
193
194
  return true if dependency.from.nil?
194
195
 
@@ -4,9 +4,9 @@ module Nanoc
4
4
  module Core
5
5
  module OutdatednessRules
6
6
  class CodeSnippetsModified < Nanoc::Core::OutdatednessRule
7
- DDMemoize.activate(self)
7
+ prepend MemoWise
8
8
 
9
- include Nanoc::Core::ContractsSupport
9
+ # include Nanoc::Core::ContractsSupport
10
10
 
11
11
  affects_props :raw_content, :attributes, :compiled_content, :path
12
12
 
@@ -18,13 +18,14 @@ module Nanoc
18
18
 
19
19
  private
20
20
 
21
- memoized def any_snippets_modified?(outdatedness_checker)
21
+ def any_snippets_modified?(outdatedness_checker)
22
22
  outdatedness_checker.site.code_snippets.any? do |cs|
23
23
  ch_old = outdatedness_checker.checksum_store[cs]
24
24
  ch_new = outdatedness_checker.checksums.checksum_for(cs)
25
25
  ch_old != ch_new
26
26
  end
27
27
  end
28
+ memo_wise :any_snippets_modified?
28
29
  end
29
30
  end
30
31
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Core
5
- VERSION = '4.12.0'
5
+ VERSION = '4.12.4'
6
6
  end
7
7
  end
data/lib/nanoc/core.rb CHANGED
@@ -11,12 +11,11 @@ require 'yaml'
11
11
  # External gems
12
12
  require 'concurrent-ruby'
13
13
  require 'json_schema'
14
- require 'ddmemoize'
15
14
  require 'ddmetrics'
16
15
  require 'ddplugin'
17
16
  require 'hamster'
17
+ require 'memo_wise'
18
18
  require 'slow_enumerator_tools'
19
- require 'tomlrb'
20
19
  require 'tty-platform'
21
20
  require 'zeitwerk'
22
21
 
@@ -39,7 +38,7 @@ module Nanoc
39
38
  #
40
39
  # @api private
41
40
  def self.version_information
42
- "Nanoc #{Nanoc::VERSION} © 2007–2021 Denis Defreyne.\n" \
41
+ "Nanoc #{Nanoc::VERSION} © 2007–2022 Denis Defreyne.\n" \
43
42
  "Running #{RUBY_ENGINE} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} with RubyGems #{Gem::VERSION}.\n"
44
43
  end
45
44
 
@@ -52,8 +51,6 @@ module Nanoc
52
51
  end
53
52
  end
54
53
 
55
- DDMemoize.enable_metrics
56
-
57
54
  inflector_class = Class.new(Zeitwerk::Inflector) do
58
55
  def camelize(basename, abspath)
59
56
  case basename
@@ -76,7 +73,3 @@ loader.eager_load
76
73
  require_relative 'core/core_ext/array'
77
74
  require_relative 'core/core_ext/hash'
78
75
  require_relative 'core/core_ext/string'
79
-
80
- # Tracking issue:
81
- # https://github.com/nanoc/features/issues/40
82
- Nanoc::Core::Feature.define('toml', version: '4.12')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.0
4
+ version: 4.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-20 00:00:00.000000000 Z
11
+ date: 2022-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.1'
27
- - !ruby/object:Gem::Dependency
28
- name: ddmemoize
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: ddmetrics
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -95,33 +81,33 @@ dependencies:
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0.19'
97
83
  - !ruby/object:Gem::Dependency
98
- name: slow_enumerator_tools
84
+ name: memo_wise
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '1.0'
89
+ version: '1.5'
104
90
  type: :runtime
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '1.0'
96
+ version: '1.5'
111
97
  - !ruby/object:Gem::Dependency
112
- name: tomlrb
98
+ name: slow_enumerator_tools
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '1.2'
103
+ version: '1.0'
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: '1.2'
110
+ version: '1.0'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: tty-platform
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -298,7 +284,8 @@ files:
298
284
  homepage: https://nanoc.ws/
299
285
  licenses:
300
286
  - MIT
301
- metadata: {}
287
+ metadata:
288
+ rubygems_mfa_required: 'true'
302
289
  post_install_message:
303
290
  rdoc_options: []
304
291
  require_paths:
@@ -307,14 +294,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
307
294
  requirements:
308
295
  - - ">="
309
296
  - !ruby/object:Gem::Version
310
- version: '2.5'
297
+ version: '2.6'
311
298
  required_rubygems_version: !ruby/object:Gem::Requirement
312
299
  requirements:
313
300
  - - ">="
314
301
  - !ruby/object:Gem::Version
315
302
  version: '0'
316
303
  requirements: []
317
- rubygems_version: 3.2.11
304
+ rubygems_version: 3.3.4
318
305
  signing_key:
319
306
  specification_version: 4
320
307
  summary: Core of Nanoc