nanoc 4.12.21 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28408245b8e292560660f368cba6239710507eeb50cf7875882f678bd63716dc
4
- data.tar.gz: c8dccabf7933ff565b75bfb1021393bb1c4ba2432ce28c9fdb45b77d5bb8fe81
3
+ metadata.gz: 48a0bdf76aa79dd9d4f2ea05f2a8d4fd0b4d431e9889d91856878aaaf0ff39c9
4
+ data.tar.gz: 8d6ae45464a308e01d7d90cd1d5f81496df31d6512f84a80ee6d4f4c9133c1fb
5
5
  SHA512:
6
- metadata.gz: 4e5b6933046445063948e9675791aae5f13a84678a0c5a3e22de9a167611e8b2d1cc3c08559d28b460348114b48026027408a10d6320284811bc4c9a72f37730
7
- data.tar.gz: e5c0dc7d42a8354b9bcad95390ee870bf5d05c6adac69c75f8e153e5e75dfefd518b0f93ad200fb68007f03aa996ce172565f751962f490616d3116112bbe9c8
6
+ metadata.gz: 22448a320d47169e6709a0f74ad962a5b6369bda3ab4c371bf0b7f475c8a40a3bb7077a1f6bec6d9da4d06499310582bf9d3ec5e5627a90abcb8c16eb4ebb972
7
+ data.tar.gz: 711d80a0ceed374cb8ccdb24d84136d6ae49e3f49b130a5e9789b4bc9fe75d3bdc466a4e360e9e993b4bde971d262a2859e0eac2d8fd2742c04a38be9d3c1ff5
data/NEWS.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.13.0 (2024-06-19)
4
+
5
+ Features:
6
+
7
+ - Added `--focus` option to the `compile` and `live` commands (#1707)
8
+
9
+ Fixes:
10
+
11
+ - Made `delete` log lines use relative (not absolute) paths (#1706)
12
+
13
+ Changes:
14
+
15
+ - Dropped support for Ruby 3.0 (EOL) (#1704)
16
+
3
17
  ## 4.12.21 (2024-04-27)
4
18
 
5
19
  Fixes:
@@ -35,7 +35,7 @@ class Nanoc::DataSources::Filesystem
35
35
  content = content_filename ? Tools.read_file(content_filename, config: @config) : ''
36
36
  meta_raw = Tools.read_file(meta_filename, config: @config)
37
37
  meta = parse_metadata(meta_raw, meta_filename)
38
- ParseResult.new(content: content, attributes: meta, attributes_data: meta_raw)
38
+ ParseResult.new(content:, attributes: meta, attributes_data: meta_raw)
39
39
  end
40
40
 
41
41
  # @return [ParseResult]
@@ -54,7 +54,7 @@ class Nanoc::DataSources::Filesystem
54
54
  meta = parse_metadata(pieces[2], content_filename)
55
55
  content = pieces[4].sub(/\A\n/, '')
56
56
 
57
- ParseResult.new(content: content, attributes: meta, attributes_data: pieces[2])
57
+ ParseResult.new(content:, attributes: meta, attributes_data: pieces[2])
58
58
  end
59
59
 
60
60
  # @return [Hash]
@@ -248,8 +248,8 @@ module Nanoc::DataSources
248
248
  def extra_attributes_for(content_filename, meta_filename)
249
249
  {
250
250
  filename: content_filename,
251
- content_filename: content_filename,
252
- meta_filename: meta_filename,
251
+ content_filename:,
252
+ meta_filename:,
253
253
  extension: content_filename ? ext_of(content_filename)[1..] : nil,
254
254
  mtime: mtime_of(content_filename, meta_filename),
255
255
  }
@@ -25,7 +25,7 @@ module Nanoc
25
25
  x # and a U+0078 LATIN SMALL LETTER X character.
26
26
  )
27
27
  )*
28
- /x.freeze
28
+ /x
29
29
 
30
30
  def initialize(value)
31
31
  @value = value
@@ -27,7 +27,7 @@ module Nanoc::Filters
27
27
 
28
28
  # Get result
29
29
  trim_mode = params[:trim_mode]
30
- erb = ::ERB.new(content, trim_mode: trim_mode)
30
+ erb = ::ERB.new(content, trim_mode:)
31
31
  erb.filename = filename
32
32
  erb.result(assigns_binding)
33
33
  end
@@ -23,7 +23,7 @@ module Nanoc::Filters
23
23
  assigns_binding = context.get_binding(&proc)
24
24
 
25
25
  # Get result
26
- engine_opts = { bufvar: '_erbout', filename: filename }.merge(params)
26
+ engine_opts = { bufvar: '_erbout', filename: }.merge(params)
27
27
  engine = ::Erubi::Engine.new(content, engine_opts)
28
28
  eval(engine.src, assigns_binding, filename)
29
29
  end
@@ -22,7 +22,7 @@ module Nanoc::Filters
22
22
  assigns_binding = context.get_binding(&proc)
23
23
 
24
24
  # Get result
25
- erubis_with_erbout.new(content, filename: filename).result(assigns_binding)
25
+ erubis_with_erbout.new(content, filename:).result(assigns_binding)
26
26
  end
27
27
 
28
28
  private
@@ -15,7 +15,7 @@ module Nanoc::Filters
15
15
  # @return [String] The filtered content
16
16
  def run(content, params = {})
17
17
  # Get options
18
- options = params.merge(filename: filename)
18
+ options = params.merge(filename:)
19
19
 
20
20
  # Create context
21
21
  context = ::Nanoc::Core::Context.new(assigns)
@@ -22,7 +22,7 @@ module Nanoc::Filters
22
22
  # Add filename to load path
23
23
  paths = [File.dirname(@item[:content_filename])]
24
24
  on_main_fiber do
25
- parser = ::Less::Parser.new(paths: paths)
25
+ parser = ::Less::Parser.new(paths:)
26
26
  parser.parse(content).to_css(params)
27
27
  end
28
28
  end
@@ -21,7 +21,7 @@ module Nanoc::Filters
21
21
 
22
22
  options = params.merge(
23
23
  load_paths: [importer, *params[:load_paths]&.reject { |p| p.is_a?(String) && %r{^content/} =~ p }],
24
- importer: importer,
24
+ importer:,
25
25
  filename: rep.item.identifier.to_s,
26
26
  cache: false,
27
27
  )
@@ -40,7 +40,7 @@ module Nanoc::Filters
40
40
  encoded = "data:application/json;base64,#{Base64.urlsafe_encode64(sourcemap)}"
41
41
  [css.gsub(%r{^/\*#\s+sourceMappingURL=\s*#{sourcemap_path}\s*\*/$}, "/*# sourceMappingURL=#{encoded} */")]
42
42
  else
43
- sourcemap = sourcemap&.to_json(css_path: css_path, sourcemap_path: sourcemap_path, type: params[:sources_content] ? :inline : :auto)
43
+ sourcemap = sourcemap&.to_json(css_path:, sourcemap_path:, type: params[:sources_content] ? :inline : :auto)
44
44
  sourcemap = sourcemap&.split("\n")&.reject { |l| l =~ /^\s*"file":\s*"#{filter.object_id}"\s*$/ }&.join("\n")
45
45
  [css, sourcemap]
46
46
  end
@@ -33,12 +33,12 @@ module Nanoc::Helpers
33
33
 
34
34
  # e.g. unfold(10.class, &:superclass)
35
35
  # => [Integer, Numeric, Object, BasicObject]
36
- def self.unfold(obj, &blk)
36
+ def self.unfold(obj, &)
37
37
  acc = [obj]
38
38
 
39
39
  res = yield(obj)
40
40
  if res
41
- acc + unfold(res, &blk)
41
+ acc + unfold(res, &)
42
42
  else
43
43
  acc
44
44
  end
@@ -13,11 +13,11 @@ module Nanoc::Helpers
13
13
  @item = item
14
14
  end
15
15
 
16
- def run(&block)
16
+ def run(&)
17
17
  existing_behavior = @params.fetch(:existing, :error)
18
18
 
19
19
  # Capture
20
- content_string = capture(&block)
20
+ content_string = capture(&)
21
21
 
22
22
  # Get existing contents and prep for store
23
23
  compiled_content_store = @item._context.compiled_content_store
@@ -102,7 +102,7 @@ module Nanoc::Helpers
102
102
  # @overload content_for(item, name)
103
103
  # @param [Symbol, String] name
104
104
  # @return [String]
105
- def content_for(*args, &block)
105
+ def content_for(*args, &)
106
106
  if block_given? # Set content
107
107
  name = args[0]
108
108
  params =
@@ -116,7 +116,7 @@ module Nanoc::Helpers
116
116
  "of the capture, and optionally params) but got #{args.size} instead"
117
117
  end
118
118
 
119
- SetContent.new(name, params, @item).run(&block)
119
+ SetContent.new(name, params, @item).run(&)
120
120
  elsif args.size > 1 && (args.first.is_a?(Symbol) || args.first.is_a?(String)) # Set content
121
121
  name = args[0]
122
122
  content = args.last
@@ -22,8 +22,8 @@ module Nanoc::OrigCLI::Commands
22
22
  items = site.items.sort_by(&:identifier)
23
23
  layouts = site.layouts.sort_by(&:identifier)
24
24
 
25
- items.each { |e| explain_item(e, rules: rules, reps: reps) }
26
- layouts.each { |e| explain_layout(e, rules: rules) }
25
+ items.each { |e| explain_item(e, rules:, reps:) }
26
+ layouts.each { |e| explain_layout(e, rules:) }
27
27
  end
28
28
 
29
29
  def explain_item(item, rules:, reps:)
@@ -12,7 +12,7 @@ module Nanoc::RuleDSL
12
12
 
13
13
  action_sequence_calculator =
14
14
  Nanoc::RuleDSL::ActionSequenceCalculator.new(
15
- rules_collection: rules_collection, site: site,
15
+ rules_collection:, site:,
16
16
  )
17
17
 
18
18
  action_provider = new(rules_collection, action_sequence_calculator)
@@ -61,10 +61,10 @@ module Nanoc::RuleDSL
61
61
 
62
62
  view_context =
63
63
  Nanoc::Core::ViewContextForCompilation.new(
64
- reps: reps,
64
+ reps:,
65
65
  items: site.items,
66
- dependency_tracker: dependency_tracker,
67
- compilation_context: compiler.compilation_context(reps: reps),
66
+ dependency_tracker:,
67
+ compilation_context: compiler.compilation_context(reps:),
68
68
  compiled_content_store: Nanoc::Core::CompiledContentStore.new,
69
69
  )
70
70
  ctx = new_postprocessor_context(site, view_context)
@@ -62,7 +62,7 @@ module Nanoc::RuleDSL
62
62
  end
63
63
 
64
64
  recorder.snapshot(:raw)
65
- rule.apply_to(rep, recorder: recorder, site: @site, view_context: view_context)
65
+ rule.apply_to(rep, recorder:, site: @site, view_context:)
66
66
  recorder.snapshot(:post) if recorder.any_layouts?
67
67
  recorder.snapshot(:last)
68
68
  recorder.snapshot(:pre) unless recorder.pre_snapshot?
@@ -70,7 +70,7 @@ module Nanoc::RuleDSL
70
70
  copy_paths_from_routing_rules(
71
71
  compact_snapshots(recorder.action_sequence),
72
72
  recorder.snapshots_for_which_to_skip_routing_rule,
73
- rep: rep,
73
+ rep:,
74
74
  )
75
75
  end
76
76
 
@@ -98,7 +98,7 @@ module Nanoc::RuleDSL
98
98
  actions << action
99
99
  end
100
100
  end
101
- Nanoc::Core::ActionSequence.new(actions: actions)
101
+ Nanoc::Core::ActionSequence.new(actions:)
102
102
  end
103
103
 
104
104
  def copy_paths_from_routing_rules(seq, snapshots_for_which_to_skip_routing_rule, rep:)
@@ -119,7 +119,7 @@ module Nanoc::RuleDSL
119
119
  # For each snapshot name, find a path from a routing rule. The routing
120
120
  # rule might return nil, so we need #compact.
121
121
  paths = action.snapshot_names.map { |sn| basic_path_from_rules_for(rep, sn) }.compact
122
- action.update(snapshot_names: [], paths: paths)
122
+ action.update(snapshot_names: [], paths:)
123
123
  end
124
124
  end
125
125
 
@@ -136,7 +136,7 @@ module Nanoc::RuleDSL
136
136
  routing_rule.apply_to(
137
137
  rep,
138
138
  site: @site,
139
- view_context: view_context,
139
+ view_context:,
140
140
  )
141
141
 
142
142
  if basic_path && !basic_path.start_with?('/')
@@ -11,10 +11,10 @@ module Nanoc::RuleDSL
11
11
  ] => C::Any
12
12
  def apply_to(rep, site:, recorder:, view_context:)
13
13
  context = Nanoc::RuleDSL::CompilationRuleContext.new(
14
- rep: rep,
15
- recorder: recorder,
16
- site: site,
17
- view_context: view_context,
14
+ rep:,
15
+ recorder:,
16
+ site:,
17
+ view_context:,
18
18
  )
19
19
 
20
20
  context.instance_exec(matches(rep.item.identifier), &@block)
@@ -13,7 +13,7 @@ module Nanoc::RuleDSL
13
13
  def initialize(rep:, site:, recorder:, view_context:)
14
14
  @_recorder = recorder
15
15
 
16
- super(rep: rep, site: site, view_context: view_context)
16
+ super(rep:, site:, view_context:)
17
17
  end
18
18
 
19
19
  # Filters the current representation (calls {Nanoc::Core::ItemRep#filter} with
@@ -56,7 +56,7 @@ module Nanoc::RuleDSL
56
56
  #
57
57
  # @return [void]
58
58
  def snapshot(snapshot_name, path: Nanoc::Core::UNDEFINED)
59
- @_recorder.snapshot(snapshot_name, path: path)
59
+ @_recorder.snapshot(snapshot_name, path:)
60
60
  end
61
61
 
62
62
  # Creates a snapshot named :last the current compiled item content, with
@@ -79,7 +79,7 @@ module Nanoc::RuleDSL
79
79
  if arg.key?(:ext)
80
80
  ext = arg[:ext].sub(/\A\./, '')
81
81
  path = @item.identifier.without_exts + '.' + ext
82
- snapshot(snapshot_name, path: path)
82
+ snapshot(snapshot_name, path:)
83
83
  else
84
84
  raise ArgumentError, 'Cannot call #write this way (need path or :ext)'
85
85
  end
@@ -20,7 +20,7 @@ module Nanoc::RuleDSL
20
20
  def initialize(rules_collection, config)
21
21
  @rules_collection = rules_collection
22
22
  @config = config
23
- super({ config: config })
23
+ super({ config: })
24
24
  end
25
25
 
26
26
  # Creates a preprocessor block that will be executed after all data is
@@ -20,7 +20,7 @@ module Nanoc::RuleDSL
20
20
  ] => C::Any
21
21
  def apply_to(rep, site:, view_context:)
22
22
  context = Nanoc::RuleDSL::RoutingRuleContext.new(
23
- rep: rep, site: site, view_context: view_context,
23
+ rep:, site:, view_context:,
24
24
  )
25
25
 
26
26
  context.instance_exec(matches(rep.item.identifier), &@block)
data/lib/nanoc/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.12.21'
5
+ VERSION = '4.13.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
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: addressable
@@ -64,28 +64,28 @@ dependencies:
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 4.12.21
67
+ version: 4.13.0
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 4.12.21
74
+ version: 4.13.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: nanoc-core
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 4.12.21
81
+ version: 4.13.0
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 4.12.21
88
+ version: 4.13.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: nanoc-deploying
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -233,7 +233,7 @@ licenses:
233
233
  - MIT
234
234
  metadata:
235
235
  rubygems_mfa_required: 'true'
236
- source_code_uri: https://github.com/nanoc/nanoc/tree/4.12.21/nanoc
236
+ source_code_uri: https://github.com/nanoc/nanoc/tree/4.13.0/nanoc
237
237
  post_install_message:
238
238
  rdoc_options: []
239
239
  require_paths:
@@ -242,14 +242,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
242
  requirements:
243
243
  - - ">="
244
244
  - !ruby/object:Gem::Version
245
- version: '2.7'
245
+ version: '3.1'
246
246
  required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
251
  requirements: []
252
- rubygems_version: 3.5.9
252
+ rubygems_version: 3.5.11
253
253
  signing_key:
254
254
  specification_version: 4
255
255
  summary: A static-site generator with a focus on flexibility.