nanoc-core 4.12.21 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nanoc/core/action_sequence.rb +4 -4
  3. data/lib/nanoc/core/action_sequence_store.rb +1 -1
  4. data/lib/nanoc/core/basic_item_rep_view.rb +1 -1
  5. data/lib/nanoc/core/binary_compiled_content_cache.rb +1 -1
  6. data/lib/nanoc/core/changes_stream.rb +4 -4
  7. data/lib/nanoc/core/checksum_store.rb +1 -1
  8. data/lib/nanoc/core/compilation_item_rep_view.rb +2 -2
  9. data/lib/nanoc/core/compilation_item_view.rb +2 -2
  10. data/lib/nanoc/core/compilation_phases/abstract.rb +2 -2
  11. data/lib/nanoc/core/compilation_phases/cache.rb +2 -2
  12. data/lib/nanoc/core/compilation_phases/mark_done.rb +1 -1
  13. data/lib/nanoc/core/compilation_phases/resume.rb +1 -1
  14. data/lib/nanoc/core/compilation_phases/write.rb +1 -1
  15. data/lib/nanoc/core/compilation_stages/build_reps.rb +2 -2
  16. data/lib/nanoc/core/compilation_stages/compile_reps.rb +24 -7
  17. data/lib/nanoc/core/compiled_content_cache.rb +3 -3
  18. data/lib/nanoc/core/compiled_content_store.rb +1 -1
  19. data/lib/nanoc/core/compiler.rb +25 -23
  20. data/lib/nanoc/core/compiler_loader.rb +9 -8
  21. data/lib/nanoc/core/config_view.rb +3 -3
  22. data/lib/nanoc/core/configuration.rb +4 -4
  23. data/lib/nanoc/core/content.rb +1 -1
  24. data/lib/nanoc/core/context.rb +1 -1
  25. data/lib/nanoc/core/data_source.rb +3 -3
  26. data/lib/nanoc/core/dependency_props.rb +2 -2
  27. data/lib/nanoc/core/dependency_store.rb +4 -4
  28. data/lib/nanoc/core/dependency_tracker.rb +5 -5
  29. data/lib/nanoc/core/document_view_mixin.rb +1 -1
  30. data/lib/nanoc/core/feature.rb +1 -1
  31. data/lib/nanoc/core/identifiable_collection.rb +2 -2
  32. data/lib/nanoc/core/identifiable_collection_view.rb +2 -2
  33. data/lib/nanoc/core/item.rb +1 -1
  34. data/lib/nanoc/core/item_rep_repo.rb +2 -2
  35. data/lib/nanoc/core/layout.rb +1 -1
  36. data/lib/nanoc/core/mutable_identifiable_collection_view.rb +1 -1
  37. data/lib/nanoc/core/mutable_item_collection_view.rb +1 -1
  38. data/lib/nanoc/core/notification_center.rb +3 -3
  39. data/lib/nanoc/core/outdatedness_store.rb +1 -1
  40. data/lib/nanoc/core/post_compile_item_rep_view.rb +1 -1
  41. data/lib/nanoc/core/site_loader.rb +5 -5
  42. data/lib/nanoc/core/textual_compiled_content_cache.rb +1 -1
  43. data/lib/nanoc/core/version.rb +1 -1
  44. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6675a38101ebd10dc14bdea793786af898d8824034f13386ae3ebd1b66ca6f5
4
- data.tar.gz: b4618d8ac489152d3bd30274365aea2fccda7a96f75875b25dbca604d0fac9a8
3
+ metadata.gz: d667fdfe9740b04cfb89b52ae97602abc239d3744d85667b049a477fd7340c3a
4
+ data.tar.gz: 58b70ca67a73647560e0761af9cc6d26ebd9eef643fa5145eae850209a096194
5
5
  SHA512:
6
- metadata.gz: 5db81b09e8c17f60baa6b190bb52864bf2ba526cb38c5e6d304c46021c00e6a0ed6aa7d9e8d55221398cd5dee7535e910ed5859fba7084bdb5950ace2a4eb6c6
7
- data.tar.gz: 8c90d0f5dea91f2bd4d5d67f5280a34428f58553689cfc9b5576222a5a37378f46bf0668c4400426f3e2008320d106db7617ccaa8166045c7f66d033f14374fc
6
+ metadata.gz: f4199cfa2dbbc0306afb33e476c72b258b1dd61fc979ca3d8ea4d4a49fb3d66fc8972f9577ea5d3ac264bdf15be6782538d392758ae5642cf304580e7e56259e
7
+ data.tar.gz: cfc6633370c3a6784061518d8001396fc094c5529e596c2283b75cc4ec8f581f29ac5c401c12253df1cb4a5982192648f3a02d5ad67a271d218ea53e729b8544
@@ -44,15 +44,15 @@ module Nanoc
44
44
  end
45
45
 
46
46
  # contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
47
- def each(&block)
48
- @actions.each(&block)
47
+ def each(&)
48
+ @actions.each(&)
49
49
  self
50
50
  end
51
51
 
52
52
  # contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
53
- def map(&block)
53
+ def map(&)
54
54
  self.class.new(
55
- actions: @actions.map(&block),
55
+ actions: @actions.map(&),
56
56
  )
57
57
  end
58
58
  end
@@ -11,7 +11,7 @@ module Nanoc
11
11
 
12
12
  contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
13
13
  def initialize(config:)
14
- super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'rule_memory'), 2)
14
+ super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'rule_memory'), 2)
15
15
 
16
16
  @action_sequences = {}
17
17
  end
@@ -57,7 +57,7 @@ module Nanoc
57
57
  # @return [String] The item rep’s path.
58
58
  def path(snapshot: :last)
59
59
  @context.dependency_tracker.bounce(_unwrap.item, path: true)
60
- @item_rep.path(snapshot: snapshot)
60
+ @item_rep.path(snapshot:)
61
61
  end
62
62
 
63
63
  # Returns the item that this item rep belongs to.
@@ -11,7 +11,7 @@ module Nanoc
11
11
 
12
12
  contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
13
13
  def initialize(config:)
14
- super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'binary_content'), 3)
14
+ super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'binary_content'), 3)
15
15
 
16
16
  @cache = {}
17
17
  end
@@ -38,16 +38,16 @@ module Nanoc
38
38
  @listener&.to_stop&.call
39
39
  end
40
40
 
41
- def map(&block)
42
- self.class.new(enum: @enum.map(&block))
41
+ def map(&)
42
+ self.class.new(enum: @enum.map(&))
43
43
  end
44
44
 
45
45
  def to_enum
46
46
  @enum
47
47
  end
48
48
 
49
- def each(&block)
50
- @enum.each(&block)
49
+ def each(&)
50
+ @enum.each(&)
51
51
  nil
52
52
  end
53
53
  end
@@ -16,7 +16,7 @@ module Nanoc
16
16
 
17
17
  contract C::KeywordArgs[config: Nanoc::Core::Configuration, objects: C::IterOf[c_obj]] => C::Any
18
18
  def initialize(config:, objects:)
19
- super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'checksums'), 3)
19
+ super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'checksums'), 3)
20
20
 
21
21
  @objects = objects
22
22
 
@@ -24,7 +24,7 @@ module Nanoc
24
24
  def raw_path(snapshot: :last)
25
25
  @context.dependency_tracker.bounce(_unwrap.item, compiled_content: true)
26
26
 
27
- res = @item_rep.raw_path(snapshot: snapshot)
27
+ res = @item_rep.raw_path(snapshot:)
28
28
 
29
29
  unless @item_rep.compiled?
30
30
  Fiber.yield(Nanoc::Core::Errors::UnmetDependency.new(@item_rep, snapshot))
@@ -50,7 +50,7 @@ module Nanoc
50
50
  # @return [String] The content at the given snapshot.
51
51
  def compiled_content(snapshot: nil)
52
52
  @context.dependency_tracker.bounce(_unwrap.item, compiled_content: true)
53
- @context.compiled_content_store.compiled_content(rep: _unwrap, snapshot: snapshot)
53
+ @context.compiled_content_store.compiled_content(rep: _unwrap, snapshot:)
54
54
  end
55
55
  end
56
56
  end
@@ -16,7 +16,7 @@ module Nanoc
16
16
  #
17
17
  # @return [String] The content of the given rep at the given snapshot.
18
18
  def compiled_content(rep: :default, snapshot: nil)
19
- reps.fetch(rep).compiled_content(snapshot: snapshot)
19
+ reps.fetch(rep).compiled_content(snapshot:)
20
20
  end
21
21
 
22
22
  # Returns the item path, as used when being linked to. It starts
@@ -33,7 +33,7 @@ module Nanoc
33
33
  #
34
34
  # @return [String] The item’s path.
35
35
  def path(rep: :default, snapshot: :last)
36
- reps.fetch(rep).path(snapshot: snapshot)
36
+ reps.fetch(rep).path(snapshot:)
37
37
  end
38
38
 
39
39
  # Returns the representations of this item.
@@ -20,9 +20,9 @@ module Nanoc
20
20
 
21
21
  def call(rep, is_outdated:)
22
22
  notify(:phase_started, rep)
23
- run(rep, is_outdated: is_outdated) do
23
+ run(rep, is_outdated:) do
24
24
  notify(:phase_yielded, rep)
25
- @wrapped.call(rep, is_outdated: is_outdated)
25
+ @wrapped.call(rep, is_outdated:)
26
26
  notify(:phase_resumed, rep)
27
27
  end
28
28
  notify(:phase_ended, rep)
@@ -9,7 +9,7 @@ module Nanoc
9
9
  include Nanoc::Core::ContractsSupport
10
10
 
11
11
  def initialize(wrapped:, compiled_content_cache:, compiled_content_store:)
12
- super(wrapped: wrapped)
12
+ super(wrapped:)
13
13
 
14
14
  @compiled_content_cache = compiled_content_cache
15
15
  @compiled_content_store = compiled_content_store
@@ -17,7 +17,7 @@ module Nanoc
17
17
 
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
- if can_reuse_content_for_rep?(rep, is_outdated: is_outdated)
20
+ if can_reuse_content_for_rep?(rep, is_outdated:)
21
21
  # If cached content can be used for this item rep, do so, and skip
22
22
  # recalculation of the item rep compiled content.
23
23
  Nanoc::Core::NotificationCenter.post(:cached_content_used, rep)
@@ -7,7 +7,7 @@ module Nanoc
7
7
  include Nanoc::Core::ContractsSupport
8
8
 
9
9
  def initialize(wrapped:, outdatedness_store:)
10
- super(wrapped: wrapped)
10
+ super(wrapped:)
11
11
 
12
12
  @outdatedness_store = outdatedness_store
13
13
  end
@@ -11,7 +11,7 @@ module Nanoc
11
11
 
12
12
  contract Nanoc::Core::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any
13
13
  def run(rep, is_outdated:, &block)
14
- fiber = fiber_for(rep, is_outdated: is_outdated, &block)
14
+ fiber = fiber_for(rep, is_outdated:, &block)
15
15
  while fiber.alive?
16
16
  res = fiber.resume
17
17
 
@@ -9,7 +9,7 @@ module Nanoc
9
9
  WORKER_POOL_SIZE = 5
10
10
 
11
11
  def initialize(compiled_content_store:, wrapped:)
12
- super(wrapped: wrapped)
12
+ super(wrapped:)
13
13
 
14
14
  @compiled_content_store = compiled_content_store
15
15
 
@@ -26,8 +26,8 @@ module Nanoc
26
26
  end
27
27
 
28
28
  {
29
- reps: reps,
30
- action_sequences: action_sequences,
29
+ reps:,
30
+ action_sequences:,
31
31
  }
32
32
  end
33
33
  end
@@ -7,30 +7,47 @@ module Nanoc
7
7
  include Nanoc::Core::ContractsSupport
8
8
  include Nanoc::Core::Assertions::Mixin
9
9
 
10
- def initialize(reps:, outdatedness_store:, dependency_store:, action_sequences:, compilation_context:, compiled_content_cache:)
10
+ def initialize(reps:, outdatedness_store:, dependency_store:, action_sequences:, compilation_context:, compiled_content_cache:, focus:)
11
11
  @reps = reps
12
12
  @outdatedness_store = outdatedness_store
13
13
  @dependency_store = dependency_store
14
14
  @action_sequences = action_sequences
15
15
  @compilation_context = compilation_context
16
16
  @compiled_content_cache = compiled_content_cache
17
+ @focus = focus
17
18
  end
18
19
 
19
20
  def run
20
21
  outdated_reps = @reps.select { |r| @outdatedness_store.include?(r) }
22
+
23
+ # If a focus is specified, only compile reps that match this focus.
24
+ # (If no focus is specified, `@focus` will be `nil`, not an empty array.)
25
+ if @focus
26
+ focus_patterns = @focus.map { |f| Nanoc::Core::Pattern.from(f) }
27
+
28
+ # Find reps for which at least one focus pattern matches.
29
+ outdated_reps = outdated_reps.select do |irep|
30
+ focus_patterns.any? do |focus_pattern|
31
+ focus_pattern.match?(irep.item.identifier)
32
+ end
33
+ end
34
+ end
35
+
21
36
  selector = Nanoc::Core::ItemRepSelector.new(outdated_reps)
22
37
  run_phase_stack do |phase_stack|
23
38
  selector.each do |rep|
24
39
  handle_errors_while(rep) do
25
- compile_rep(rep, phase_stack: phase_stack, is_outdated: @outdatedness_store.include?(rep))
40
+ compile_rep(rep, phase_stack:, is_outdated: @outdatedness_store.include?(rep))
26
41
  end
27
42
  end
28
43
  end
29
44
 
30
- assert Nanoc::Core::Assertions::AllItemRepsHaveCompiledContent.new(
31
- compiled_content_cache: @compiled_content_cache,
32
- item_reps: @reps,
33
- )
45
+ unless @focus
46
+ assert Nanoc::Core::Assertions::AllItemRepsHaveCompiledContent.new(
47
+ compiled_content_cache: @compiled_content_cache,
48
+ item_reps: @reps,
49
+ )
50
+ end
34
51
  ensure
35
52
  @outdatedness_store.store
36
53
  @compiled_content_cache.prune(items: @reps.map(&:item).uniq)
@@ -46,7 +63,7 @@ module Nanoc
46
63
  end
47
64
 
48
65
  def compile_rep(rep, phase_stack:, is_outdated:)
49
- phase_stack.call(rep, is_outdated: is_outdated)
66
+ phase_stack.call(rep, is_outdated:)
50
67
  end
51
68
 
52
69
  def run_phase_stack
@@ -11,8 +11,8 @@ module Nanoc
11
11
 
12
12
  contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
13
13
  def initialize(config:)
14
- @textual_cache = Nanoc::Core::TextualCompiledContentCache.new(config: config)
15
- @binary_cache = Nanoc::Core::BinaryCompiledContentCache.new(config: config)
14
+ @textual_cache = Nanoc::Core::TextualCompiledContentCache.new(config:)
15
+ @binary_cache = Nanoc::Core::BinaryCompiledContentCache.new(config:)
16
16
 
17
17
  @wrapped_caches = [@textual_cache, @binary_cache]
18
18
  end
@@ -47,7 +47,7 @@ module Nanoc
47
47
  end
48
48
 
49
49
  def prune(items:)
50
- @wrapped_caches.each { |w| w.prune(items: items) }
50
+ @wrapped_caches.each { |w| w.prune(items:) }
51
51
  end
52
52
 
53
53
  # True if there is cached compiled content available for this item, and
@@ -64,7 +64,7 @@ module Nanoc
64
64
 
65
65
  contract C::KeywordArgs[rep: Nanoc::Core::ItemRep, snapshot: C::Optional[C::Maybe[Symbol]]] => String
66
66
  def compiled_content(rep:, snapshot: nil)
67
- snapshot_content = raw_compiled_content(rep: rep, snapshot: snapshot)
67
+ snapshot_content = raw_compiled_content(rep:, snapshot:)
68
68
 
69
69
  if snapshot_content.binary?
70
70
  raise Nanoc::Core::Errors::CannotGetCompiledContentOfBinaryItem.new(rep)
@@ -6,16 +6,16 @@ module Nanoc
6
6
  include Nanoc::Core::ContractsSupport
7
7
 
8
8
  contract Nanoc::Core::Site => C::Any
9
- def self.compile(site)
10
- new_for(site).run_until_end
9
+ def self.compile(site, focus: nil)
10
+ new_for(site, focus:).run_until_end
11
11
  end
12
12
 
13
13
  contract Nanoc::Core::Site => Nanoc::Core::Compiler
14
- def self.new_for(site)
15
- Nanoc::Core::CompilerLoader.new.load(site)
14
+ def self.new_for(site, focus: nil)
15
+ Nanoc::Core::CompilerLoader.new.load(site, focus:)
16
16
  end
17
17
 
18
- def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:)
18
+ def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:, focus:)
19
19
  @site = site
20
20
 
21
21
  # Needed because configuration is mutable :(
@@ -27,6 +27,7 @@ module Nanoc
27
27
  @dependency_store = dependency_store
28
28
  @action_provider = action_provider
29
29
  @outdatedness_store = outdatedness_store
30
+ @focus = focus
30
31
 
31
32
  @compiled_content_store = Nanoc::Core::CompiledContentStore.new
32
33
  end
@@ -60,17 +61,17 @@ module Nanoc
60
61
  load_stores_stage.call
61
62
  checksums = calculate_checksums_stage.call
62
63
  outdatedness_checker = create_outdatedness_checker(
63
- checksums: checksums,
64
- action_sequences: action_sequences,
65
- reps: reps,
64
+ checksums:,
65
+ action_sequences:,
66
+ reps:,
66
67
  )
67
68
  outdated_items = determine_outdatedness_stage(outdatedness_checker, reps).call
68
69
 
69
70
  prev.merge(
70
- checksums: checksums,
71
+ checksums:,
71
72
  dependency_store: @dependency_store,
72
- outdatedness_checker: outdatedness_checker,
73
- outdated_items: outdated_items,
73
+ outdatedness_checker:,
74
+ outdated_items:,
74
75
  )
75
76
  end
76
77
  end
@@ -95,7 +96,7 @@ module Nanoc
95
96
  def compilation_context(reps:)
96
97
  Nanoc::Core::CompilationContext.new(
97
98
  action_provider: @action_provider,
98
- reps: reps,
99
+ reps:,
99
100
  site: @site,
100
101
  compiled_content_cache: @compiled_content_cache,
101
102
  compiled_content_store: @compiled_content_store,
@@ -110,9 +111,9 @@ module Nanoc
110
111
  checksum_store: @checksum_store,
111
112
  dependency_store: @dependency_store,
112
113
  action_sequence_store: @action_sequence_store,
113
- action_sequences: action_sequences,
114
- checksums: checksums,
115
- reps: reps,
114
+ action_sequences:,
115
+ checksums:,
116
+ reps:,
116
117
  )
117
118
  end
118
119
 
@@ -135,7 +136,7 @@ module Nanoc
135
136
  def prune_stage(reps)
136
137
  @_prune_stage ||= ::Nanoc::Core::CompilationStages::Prune.new(
137
138
  config: @site.config,
138
- reps: reps,
139
+ reps:,
139
140
  )
140
141
  end
141
142
 
@@ -160,30 +161,31 @@ module Nanoc
160
161
 
161
162
  def determine_outdatedness_stage(outdatedness_checker, reps)
162
163
  @_determine_outdatedness_stage ||= ::Nanoc::Core::CompilationStages::DetermineOutdatedness.new(
163
- reps: reps,
164
- outdatedness_checker: outdatedness_checker,
164
+ reps:,
165
+ outdatedness_checker:,
165
166
  outdatedness_store: @outdatedness_store,
166
167
  )
167
168
  end
168
169
 
169
170
  def store_pre_compilation_state_stage(action_sequences, reps)
170
171
  @_store_pre_compilation_state_stage ||= ::Nanoc::Core::CompilationStages::StorePreCompilationState.new(
171
- reps: reps,
172
+ reps:,
172
173
  layouts: @site.layouts,
173
174
  checksum_store: @checksum_store,
174
175
  action_sequence_store: @action_sequence_store,
175
- action_sequences: action_sequences,
176
+ action_sequences:,
176
177
  )
177
178
  end
178
179
 
179
180
  def compile_reps_stage(action_sequences, reps)
180
181
  @_compile_reps_stage ||= ::Nanoc::Core::CompilationStages::CompileReps.new(
181
- reps: reps,
182
+ reps:,
182
183
  outdatedness_store: @outdatedness_store,
183
184
  dependency_store: @dependency_store,
184
- action_sequences: action_sequences,
185
- compilation_context: compilation_context(reps: reps),
185
+ action_sequences:,
186
+ compilation_context: compilation_context(reps:),
186
187
  compiled_content_cache: @compiled_content_cache,
188
+ focus: @focus,
187
189
  )
188
190
  end
189
191
 
@@ -4,7 +4,7 @@ module Nanoc
4
4
  module Core
5
5
  # @api private
6
6
  class CompilerLoader
7
- def load(site, action_provider: nil)
7
+ def load(site, focus: nil, action_provider: nil)
8
8
  action_sequence_store = Nanoc::Core::ActionSequenceStore.new(config: site.config)
9
9
 
10
10
  dependency_store =
@@ -13,7 +13,7 @@ module Nanoc
13
13
  objects = site.items.to_a + site.layouts.to_a + site.code_snippets + [site.config]
14
14
 
15
15
  checksum_store =
16
- Nanoc::Core::ChecksumStore.new(config: site.config, objects: objects)
16
+ Nanoc::Core::ChecksumStore.new(config: site.config, objects:)
17
17
 
18
18
  action_provider ||= Nanoc::Core::ActionProvider.named(site.config.action_provider).for(site)
19
19
 
@@ -24,12 +24,13 @@ module Nanoc
24
24
  compiled_content_cache_class.new(config: site.config)
25
25
 
26
26
  params = {
27
- compiled_content_cache: compiled_content_cache,
28
- checksum_store: checksum_store,
29
- action_sequence_store: action_sequence_store,
30
- dependency_store: dependency_store,
31
- action_provider: action_provider,
32
- outdatedness_store: outdatedness_store,
27
+ compiled_content_cache:,
28
+ checksum_store:,
29
+ action_sequence_store:,
30
+ dependency_store:,
31
+ action_provider:,
32
+ outdatedness_store:,
33
+ focus:,
33
34
  }
34
35
 
35
36
  Nanoc::Core::Compiler.new(site, **params)
@@ -20,7 +20,7 @@ module Nanoc
20
20
  end
21
21
 
22
22
  # @see Hash#fetch
23
- def fetch(key, fallback = Nanoc::Core::UNDEFINED, &_block)
23
+ def fetch(key, fallback = Nanoc::Core::UNDEFINED, &)
24
24
  @context.dependency_tracker.bounce(_unwrap, attributes: [key])
25
25
  @config.fetch(key) do
26
26
  if !Nanoc::Core::UNDEFINED.equal?(fallback)
@@ -46,9 +46,9 @@ module Nanoc
46
46
  end
47
47
 
48
48
  # @see Hash#each
49
- def each(&block)
49
+ def each(&)
50
50
  @context.dependency_tracker.bounce(_unwrap, attributes: true)
51
- @config.each(&block)
51
+ @config.each(&)
52
52
  end
53
53
 
54
54
  # @see Configuration#env_name
@@ -72,7 +72,7 @@ module Nanoc
72
72
  # Load given environment configuration
73
73
  env_config = @wrapped[ENVIRONMENTS_CONFIG_KEY].fetch(env_name.to_sym, {})
74
74
 
75
- self.class.new(hash: @wrapped, dir: @dir, env_name: env_name).merge(env_config)
75
+ self.class.new(hash: @wrapped, dir: @dir, env_name:).merge(env_config)
76
76
  end
77
77
 
78
78
  contract C::None => Hash
@@ -102,7 +102,7 @@ module Nanoc
102
102
  end
103
103
 
104
104
  contract C::Any, C::Maybe[C::Any], C::Maybe[C::Func[C::None => C::Any]] => C::Any
105
- def fetch(key, fallback = Nanoc::Core::UNDEFINED, &_block)
105
+ def fetch(key, fallback = Nanoc::Core::UNDEFINED, &)
106
106
  @wrapped.fetch(key) do
107
107
  if !Nanoc::Core::UNDEFINED.equal?(fallback)
108
108
  fallback
@@ -136,8 +136,8 @@ module Nanoc
136
136
  end
137
137
 
138
138
  contract C::Func[C::Any, C::Any => C::Any] => self
139
- def each(&block)
140
- @wrapped.each(&block)
139
+ def each(&)
140
+ @wrapped.each(&)
141
141
  self
142
142
  end
143
143
 
@@ -14,7 +14,7 @@ module Nanoc
14
14
  elsif binary
15
15
  Nanoc::Core::BinaryContent.new(content)
16
16
  else
17
- Nanoc::Core::TextualContent.new(content, filename: filename)
17
+ Nanoc::Core::TextualContent.new(content, filename:)
18
18
  end
19
19
  end
20
20
 
@@ -39,7 +39,7 @@ module Nanoc
39
39
  end
40
40
  # rubocop:enable Naming/AccessorMethodName
41
41
 
42
- def method_missing(method, *args, &blk)
42
+ def method_missing(method, *args, &)
43
43
  ivar_name = '@' + method.to_s
44
44
  if instance_variable_defined?(ivar_name)
45
45
  instance_variable_get(ivar_name)
@@ -144,8 +144,8 @@ module Nanoc
144
144
  #
145
145
  # @param [String, nil] attributes_checksum_data
146
146
  def new_item(content, attributes, identifier, binary: false, checksum_data: nil, content_checksum_data: nil, attributes_checksum_data: nil)
147
- content = Nanoc::Core::Content.create(content, binary: binary)
148
- Nanoc::Core::Item.new(content, attributes, identifier, checksum_data: checksum_data, content_checksum_data: content_checksum_data, attributes_checksum_data: attributes_checksum_data)
147
+ content = Nanoc::Core::Content.create(content, binary:)
148
+ Nanoc::Core::Item.new(content, attributes, identifier, checksum_data:, content_checksum_data:, attributes_checksum_data:)
149
149
  end
150
150
 
151
151
  # Creates a new in-memory layout instance. This is intended for use within
@@ -163,7 +163,7 @@ module Nanoc
163
163
  #
164
164
  # @param [String, nil] attributes_checksum_data
165
165
  def new_layout(raw_content, attributes, identifier, checksum_data: nil, content_checksum_data: nil, attributes_checksum_data: nil)
166
- Nanoc::Core::Layout.new(raw_content, attributes, identifier, checksum_data: checksum_data, content_checksum_data: content_checksum_data, attributes_checksum_data: attributes_checksum_data)
166
+ Nanoc::Core::Layout.new(raw_content, attributes, identifier, checksum_data:, content_checksum_data:, attributes_checksum_data:)
167
167
  end
168
168
  end
169
169
  end
@@ -195,8 +195,8 @@ module Nanoc
195
195
  contract C::None => Hash
196
196
  def to_h
197
197
  {
198
- raw_content: raw_content,
199
- attributes: attributes,
198
+ raw_content:,
199
+ attributes:,
200
200
  compiled_content: compiled_content?,
201
201
  path: path?,
202
202
  }
@@ -42,7 +42,7 @@ module Nanoc
42
42
 
43
43
  contract Nanoc::Core::ItemCollection, Nanoc::Core::LayoutCollection, Nanoc::Core::Configuration => C::Any
44
44
  def initialize(items, layouts, config)
45
- super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'dependencies'), 6)
45
+ super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'dependencies'), 6)
46
46
 
47
47
  @config = config
48
48
  @items = items
@@ -142,10 +142,10 @@ module Nanoc
142
142
  end
143
143
 
144
144
  existing_props = @graph.props_for(dst_ref, src_ref)
145
- new_props = Nanoc::Core::DependencyProps.new(raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
145
+ new_props = Nanoc::Core::DependencyProps.new(raw_content:, attributes:, compiled_content:, path:)
146
146
  props = existing_props ? existing_props.merge(new_props) : new_props
147
147
 
148
- @graph.add_edge(dst_ref, src_ref, props: props)
148
+ @graph.add_edge(dst_ref, src_ref, props:)
149
149
  end
150
150
 
151
151
  def add_vertex_for(obj)
@@ -231,7 +231,7 @@ module Nanoc
231
231
  to = to_index && previous_refs[to_index]
232
232
  props = Nanoc::Core::DependencyProps.new(**props)
233
233
 
234
- @graph.add_edge(from, to, props: props)
234
+ @graph.add_edge(from, to, props:)
235
235
  end
236
236
 
237
237
  # Record dependency from all items on new items
@@ -49,10 +49,10 @@ module Nanoc
49
49
  @dependency_store.record_dependency(
50
50
  @stack.last,
51
51
  obj,
52
- raw_content: raw_content,
53
- attributes: attributes,
54
- compiled_content: compiled_content,
55
- path: path,
52
+ raw_content:,
53
+ attributes:,
54
+ compiled_content:,
55
+ path:,
56
56
  )
57
57
  end
58
58
 
@@ -66,7 +66,7 @@ module Nanoc
66
66
 
67
67
  contract C_OBJ, C_ARGS => C::Any
68
68
  def bounce(obj, raw_content: false, attributes: false, compiled_content: false, path: false)
69
- enter(obj, raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
69
+ enter(obj, raw_content:, attributes:, compiled_content:, path:)
70
70
  exit
71
71
  end
72
72
 
@@ -48,7 +48,7 @@ module Nanoc
48
48
  end
49
49
 
50
50
  # @see Hash#fetch
51
- def fetch(key, fallback = Nanoc::Core::UNDEFINED, &_block)
51
+ def fetch(key, fallback = Nanoc::Core::UNDEFINED, &)
52
52
  @context.dependency_tracker.bounce(_unwrap, attributes: [key])
53
53
 
54
54
  if _unwrap.attributes.key?(key)
@@ -91,4 +91,4 @@ module Nanoc
91
91
  end
92
92
  end
93
93
 
94
- Nanoc::Core::Feature.define('where', version: '4.12')
94
+ Nanoc::Core::Feature.define('where', version: '4.13')
@@ -62,8 +62,8 @@ module Nanoc
62
62
  end
63
63
 
64
64
  # contract C::Func[C::RespondTo[:identifier] => C::Any] => self
65
- def reject(&block)
66
- self.class.new(@config, @objects.reject(&block))
65
+ def reject(&)
66
+ self.class.new(@config, @objects.reject(&))
67
67
  end
68
68
 
69
69
  def object_with_identifier(identifier)
@@ -49,10 +49,10 @@ module Nanoc
49
49
  # @param [String, Regex] arg
50
50
  #
51
51
  # @return [Enumerable]
52
- def find_all(arg = NOTHING, &block)
52
+ def find_all(arg = NOTHING, &)
53
53
  if NOTHING.equal?(arg)
54
54
  @context.dependency_tracker.bounce(_unwrap, raw_content: true)
55
- return @objects.map { |i| view_class.new(i, @context) }.select(&block)
55
+ return @objects.map { |i| view_class.new(i, @context) }.select(&)
56
56
  end
57
57
 
58
58
  prop_attribute =
@@ -8,7 +8,7 @@ module Nanoc
8
8
  end
9
9
 
10
10
  def identifier=(new_identifier)
11
- super(new_identifier)
11
+ super
12
12
 
13
13
  # Invalidate memoization cache
14
14
  @_reference = nil
@@ -24,8 +24,8 @@ module Nanoc
24
24
  @reps
25
25
  end
26
26
 
27
- def each(&block)
28
- @reps.each(&block)
27
+ def each(&)
28
+ @reps.each(&)
29
29
  self
30
30
  end
31
31
 
@@ -8,7 +8,7 @@ module Nanoc
8
8
  end
9
9
 
10
10
  def identifier=(new_identifier)
11
- super(new_identifier)
11
+ super
12
12
 
13
13
  # Invalidate memoization cache
14
14
  @_reference = nil
@@ -10,7 +10,7 @@ module Nanoc
10
10
  # @yieldreturn [Boolean]
11
11
  #
12
12
  # @return [self]
13
- def delete_if(&_block)
13
+ def delete_if(&)
14
14
  @objects = @objects.reject { |o| yield(view_class.new(o, @context)) }
15
15
  self
16
16
  end
@@ -25,7 +25,7 @@ module Nanoc
25
25
  #
26
26
  # @return [self]
27
27
  def create(content, attributes, identifier, binary: false, filename: nil)
28
- content = Nanoc::Core::Content.create(content, binary: binary, filename: filename)
28
+ content = Nanoc::Core::Content.create(content, binary:, filename:)
29
29
  @objects = @objects.add(Nanoc::Core::Item.new(content, attributes, identifier))
30
30
  self
31
31
  end
@@ -53,7 +53,7 @@ module Nanoc
53
53
  end
54
54
 
55
55
  def on(name, id = nil, &block)
56
- @notifications[name] << { id: id, block: block }
56
+ @notifications[name] << { id:, block: }
57
57
  end
58
58
 
59
59
  def remove(name, id)
@@ -75,8 +75,8 @@ module Nanoc
75
75
  @_instance ||= new.tap(&:start)
76
76
  end
77
77
 
78
- def on(name, id = nil, &block)
79
- instance.on(name, id, &block)
78
+ def on(name, id = nil, &)
79
+ instance.on(name, id, &)
80
80
  end
81
81
 
82
82
  def post(name, *args)
@@ -8,7 +8,7 @@ module Nanoc
8
8
 
9
9
  contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
10
10
  def initialize(config:)
11
- super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'outdatedness'), 2)
11
+ super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'outdatedness'), 2)
12
12
 
13
13
  @outdated_refs = Set.new
14
14
  end
@@ -26,7 +26,7 @@ module Nanoc
26
26
  end
27
27
 
28
28
  def raw_path(snapshot: :last)
29
- @item_rep.raw_path(snapshot: snapshot)
29
+ @item_rep.raw_path(snapshot:)
30
30
  end
31
31
  end
32
32
  end
@@ -3,7 +3,7 @@
3
3
  module Nanoc
4
4
  module Core
5
5
  class SiteLoader
6
- ENCODING_REGEX = /\A#\s+(-\*-\s+)?(en)?coding: (?<encoding>[^\s]+)(\s+-\*-\s*)?\n{0,2}/.freeze
6
+ ENCODING_REGEX = /\A#\s+(-\*-\s+)?(en)?coding: (?<encoding>[^\s]+)(\s+-\*-\s*)?\n{0,2}/
7
7
  # @return [Boolean]
8
8
  def self.cwd_is_nanoc_site?
9
9
  Nanoc::Core::ConfigLoader.cwd_is_nanoc_site?
@@ -33,13 +33,13 @@ module Nanoc
33
33
  data_source = gen_data_source_for_config(config)
34
34
 
35
35
  Nanoc::Core::Site.new(
36
- config: config,
37
- code_snippets: code_snippets,
38
- data_source: data_source,
36
+ config:,
37
+ code_snippets:,
38
+ data_source:,
39
39
  )
40
40
  end
41
41
 
42
- def with_data_sources(config, &_block)
42
+ def with_data_sources(config, &)
43
43
  data_sources = create_data_sources(config)
44
44
 
45
45
  begin
@@ -11,7 +11,7 @@ module Nanoc
11
11
 
12
12
  contract C::KeywordArgs[config: Nanoc::Core::Configuration] => C::Any
13
13
  def initialize(config:)
14
- super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'compiled_content'), 4)
14
+ super(Nanoc::Core::Store.tmp_path_for(config:, store_name: 'compiled_content'), 4)
15
15
 
16
16
  @cache = {}
17
17
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Core
5
- VERSION = '4.12.21'
5
+ VERSION = '4.13.0'
6
6
  end
7
7
  end
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.21
4
+ version: 4.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-27 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -322,7 +322,7 @@ licenses:
322
322
  - MIT
323
323
  metadata:
324
324
  rubygems_mfa_required: 'true'
325
- source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-core-v4.12.21/nanoc-core
325
+ source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-core-v4.13.0/nanoc-core
326
326
  post_install_message:
327
327
  rdoc_options: []
328
328
  require_paths:
@@ -331,14 +331,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
331
331
  requirements:
332
332
  - - ">="
333
333
  - !ruby/object:Gem::Version
334
- version: '2.7'
334
+ version: '3.1'
335
335
  required_rubygems_version: !ruby/object:Gem::Requirement
336
336
  requirements:
337
337
  - - ">="
338
338
  - !ruby/object:Gem::Version
339
339
  version: '0'
340
340
  requirements: []
341
- rubygems_version: 3.5.9
341
+ rubygems_version: 3.5.11
342
342
  signing_key:
343
343
  specification_version: 4
344
344
  summary: Core of Nanoc