tocer 18.7.0 → 19.0.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: f8c63ca6fd39d8ac6c4d49c1e34878326368cf0d16034303be8049459aa7e448
4
- data.tar.gz: fcc5f1fcd3e0f28429be95b3a2703d363f981c5803d6337722a912dd9d1297d8
3
+ metadata.gz: dcb24b29764231cb2b110e84d7a6531eec596b929290694ff6eb4da7268534ac
4
+ data.tar.gz: ed40db43edc069b95b3c655e923b6a116f08c46b1c7d7bc14e8ae36385d03a60
5
5
  SHA512:
6
- metadata.gz: ff8c8f73feded4603248e7b1a20c3305461478c21e2a432500860a67aa98a08b96e1fe898360585a52781fec7a7dc8b4723ba9da7cac5fffacae7f81c6fd03a9
7
- data.tar.gz: 9fe88f77085bde4427e5201724d6ff84a3334827cad34cbd93086477b5fde7fd1c90cb7d58aa3c3745dc50aed2409cf1926a865f979aa4113a74fc6f0ee8ca88
6
+ metadata.gz: a7657d642ad2625d05e10cec57740bd76d18b18d0dd30c31c33c42f7fba7bf1b502293fb49fa1ecf8d396f1447a9bfd22e7ef0f7d1db12c9c269833cf80ab6e8
7
+ data.tar.gz: 466c60ea13023bccf95bb5648e893ffaa6936d00d4b62df14c1b66b62115eb0708b82e6f96cff8eb3c08d398e946e4b3d4dc65a59fef7b660f911bc619cc4ef7
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/tocer/builder.rb CHANGED
@@ -6,25 +6,31 @@ module Tocer
6
6
  # Builds table of contents for a Markdown document.
7
7
  class Builder
8
8
  extend Forwardable
9
+ include Dependencies[:settings]
9
10
 
10
11
  CODE_BLOCK_PUNCTUATION = "```"
11
12
 
12
13
  def_delegators :comment_block, :start_index, :finish_index, :comments, :prependable?
13
14
 
14
- def initialize comment_block: Elements::CommentBlock.new, transformer: Transformers::Finder.new
15
+ def initialize(
16
+ comment_block: Elements::CommentBlock.new,
17
+ transformer: Transformers::Finder.new,
18
+ **
19
+ )
15
20
  @comment_block = comment_block
16
21
  @transformer = transformer
17
22
  @url_count = Hash.new 0
18
23
  @code_block = false
24
+ super(**)
19
25
  end
20
26
 
21
27
  def unbuildable?(lines) = comment_block.empty?(lines) && headers(lines).empty?
22
28
 
23
- def call lines, label: Container[:settings].label
29
+ def call lines
24
30
  return "" if headers(lines).empty?
25
31
 
26
32
  url_count.clear
27
- assemble(lines, label).join
33
+ assemble(lines).join
28
34
  end
29
35
 
30
36
  private
@@ -32,10 +38,10 @@ module Tocer
32
38
  attr_reader :comment_block, :transformer, :url_count
33
39
  attr_accessor :code_block
34
40
 
35
- def assemble lines, label
41
+ def assemble lines
36
42
  [
37
43
  "#{comment_block.start_tag}\n\n",
38
- "#{label}\n\n",
44
+ "#{settings.label}\n\n",
39
45
  links(lines).join("\n"),
40
46
  "\n\n#{comment_block.finish_tag}\n"
41
47
  ]
@@ -7,7 +7,7 @@ module Tocer
7
7
  module Actions
8
8
  # Stores table of contents label.
9
9
  class Label < Sod::Action
10
- include Import[:settings]
10
+ include Dependencies[:settings]
11
11
 
12
12
  description "Set label."
13
13
 
@@ -7,7 +7,7 @@ module Tocer
7
7
  module Actions
8
8
  # Stores table of contents file patterns.
9
9
  class Pattern < Sod::Action
10
- include Import[:settings]
10
+ include Dependencies[:settings]
11
11
 
12
12
  description "Set file patterns."
13
13
 
@@ -7,7 +7,7 @@ module Tocer
7
7
  module Actions
8
8
  # Stores table of contents root path.
9
9
  class Root < Sod::Action
10
- include Import[:settings]
10
+ include Dependencies[:settings]
11
11
 
12
12
  description "Set root directory."
13
13
 
@@ -6,7 +6,7 @@ module Tocer
6
6
  module CLI
7
7
  # The main Command Line Interface (CLI) object.
8
8
  class Shell
9
- include Import[:defaults_path, :xdg_config, :specification]
9
+ include Dependencies[:defaults_path, :xdg_config, :specification]
10
10
 
11
11
  def initialize(context: Sod::Context, dsl: Sod, **)
12
12
  super(**)
@@ -3,5 +3,5 @@
3
3
  require "infusible"
4
4
 
5
5
  module Tocer
6
- Import = Infusible[Container]
6
+ Dependencies = Infusible[Container]
7
7
  end
@@ -11,7 +11,6 @@ module Tocer
11
11
  def initialize start_id: "Tocer[start]",
12
12
  finish_id: "Tocer[finish]",
13
13
  message: "Auto-generated, don't remove."
14
-
15
14
  @start_id = start_id
16
15
  @finish_id = finish_id
17
16
  @message = message
@@ -9,7 +9,7 @@ module Tocer
9
9
  # Registers Rake tasks for use.
10
10
  class Register
11
11
  include ::Rake::DSL
12
- include Import[:settings]
12
+ include Dependencies[:settings]
13
13
 
14
14
  using Refinements::Struct
15
15
 
data/lib/tocer/runner.rb CHANGED
@@ -5,7 +5,7 @@ require "refinements/pathname"
5
5
  module Tocer
6
6
  # Generates/updates Table of Contents for files in root path.
7
7
  class Runner
8
- include Import[:settings, :io]
8
+ include Dependencies[:settings, :io]
9
9
 
10
10
  using Refinements::Pathname
11
11
 
@@ -19,7 +19,7 @@ module Tocer
19
19
  .files(%({#{settings.patterns.join ","}}))
20
20
  .each do |path|
21
21
  io.puts " #{path}"
22
- writer.call path, label: settings.label
22
+ writer.call path
23
23
  end
24
24
  end
25
25
 
data/lib/tocer/writer.rb CHANGED
@@ -24,10 +24,10 @@ module Tocer
24
24
  @builder = builder
25
25
  end
26
26
 
27
- def call path, label: Container[:settings].label
27
+ def call path
28
28
  path.rewrite do |body|
29
29
  lines = body.each_line.to_a
30
- builder.prependable?(lines) ? prepend(lines, label) : replace(lines, label)
30
+ builder.prependable?(lines) ? prepend(lines) : replace(lines)
31
31
  end
32
32
  end
33
33
 
@@ -35,7 +35,7 @@ module Tocer
35
35
 
36
36
  attr_reader :builder
37
37
 
38
- def replace lines, label
38
+ def replace lines
39
39
  start_index = builder.start_index lines
40
40
  finish_index = builder.finish_index lines
41
41
  klass = self.class
@@ -43,20 +43,20 @@ module Tocer
43
43
  klass.add(
44
44
  start_index:,
45
45
  old_lines: klass.remove(start_index, finish_index, lines),
46
- new_lines: new_lines(lines, label, finish_index)
46
+ new_lines: new_lines(lines, finish_index)
47
47
  ).join
48
48
  end
49
49
 
50
- def new_lines lines, label, finish_index
50
+ def new_lines lines, finish_index
51
51
  if builder.unbuildable? lines
52
52
  builder.comments
53
53
  else
54
- content lines[finish_index, lines.length], label
54
+ content lines[finish_index, lines.length]
55
55
  end
56
56
  end
57
57
 
58
- def prepend(lines, label) = [content(lines, label), lines.join].compress.join("\n")
58
+ def prepend(lines) = [content(lines), lines.join].compress.join("\n")
59
59
 
60
- def content(lines, label) = builder.call(lines, label:)
60
+ def content(lines) = builder.call lines
61
61
  end
62
62
  end
data/tocer.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "tocer"
5
- spec.version = "18.7.0"
5
+ spec.version = "19.0.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/tocer"
@@ -22,17 +22,17 @@ Gem::Specification.new do |spec|
22
22
  spec.signing_key = Gem.default_key_path
23
23
  spec.cert_chain = [Gem.default_cert_path]
24
24
 
25
- spec.required_ruby_version = ">= 3.3", "<= 3.4"
26
- spec.add_dependency "cogger", "~> 0.31"
27
- spec.add_dependency "containable", "~> 0.2"
28
- spec.add_dependency "core", "~> 1.10"
25
+ spec.required_ruby_version = "~> 3.4"
26
+ spec.add_dependency "cogger", "~> 1.0"
27
+ spec.add_dependency "containable", "~> 1.0"
28
+ spec.add_dependency "core", "~> 2.0"
29
29
  spec.add_dependency "dry-schema", "~> 1.13"
30
- spec.add_dependency "etcher", "~> 2.7"
31
- spec.add_dependency "infusible", "~> 3.12"
32
- spec.add_dependency "refinements", "~> 12.10"
33
- spec.add_dependency "runcom", "~> 11.10"
34
- spec.add_dependency "sod", "~> 0.20"
35
- spec.add_dependency "spek", "~> 3.0"
30
+ spec.add_dependency "etcher", "~> 3.0"
31
+ spec.add_dependency "infusible", "~> 4.0"
32
+ spec.add_dependency "refinements", "~> 13.0"
33
+ spec.add_dependency "runcom", "~> 12.0"
34
+ spec.add_dependency "sod", "~> 1.0"
35
+ spec.add_dependency "spek", "~> 4.0"
36
36
  spec.add_dependency "zeitwerk", "~> 2.7"
37
37
 
38
38
  spec.bindir = "exe"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,11 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tocer
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.7.0
4
+ version: 19.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain:
11
10
  - |
@@ -35,7 +34,7 @@ cert_chain:
35
34
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
35
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
36
  -----END CERTIFICATE-----
38
- date: 2024-11-09 00:00:00.000000000 Z
37
+ date: 2024-12-27 00:00:00.000000000 Z
39
38
  dependencies:
40
39
  - !ruby/object:Gem::Dependency
41
40
  name: cogger
@@ -43,42 +42,42 @@ dependencies:
43
42
  requirements:
44
43
  - - "~>"
45
44
  - !ruby/object:Gem::Version
46
- version: '0.31'
45
+ version: '1.0'
47
46
  type: :runtime
48
47
  prerelease: false
49
48
  version_requirements: !ruby/object:Gem::Requirement
50
49
  requirements:
51
50
  - - "~>"
52
51
  - !ruby/object:Gem::Version
53
- version: '0.31'
52
+ version: '1.0'
54
53
  - !ruby/object:Gem::Dependency
55
54
  name: containable
56
55
  requirement: !ruby/object:Gem::Requirement
57
56
  requirements:
58
57
  - - "~>"
59
58
  - !ruby/object:Gem::Version
60
- version: '0.2'
59
+ version: '1.0'
61
60
  type: :runtime
62
61
  prerelease: false
63
62
  version_requirements: !ruby/object:Gem::Requirement
64
63
  requirements:
65
64
  - - "~>"
66
65
  - !ruby/object:Gem::Version
67
- version: '0.2'
66
+ version: '1.0'
68
67
  - !ruby/object:Gem::Dependency
69
68
  name: core
70
69
  requirement: !ruby/object:Gem::Requirement
71
70
  requirements:
72
71
  - - "~>"
73
72
  - !ruby/object:Gem::Version
74
- version: '1.10'
73
+ version: '2.0'
75
74
  type: :runtime
76
75
  prerelease: false
77
76
  version_requirements: !ruby/object:Gem::Requirement
78
77
  requirements:
79
78
  - - "~>"
80
79
  - !ruby/object:Gem::Version
81
- version: '1.10'
80
+ version: '2.0'
82
81
  - !ruby/object:Gem::Dependency
83
82
  name: dry-schema
84
83
  requirement: !ruby/object:Gem::Requirement
@@ -99,84 +98,84 @@ dependencies:
99
98
  requirements:
100
99
  - - "~>"
101
100
  - !ruby/object:Gem::Version
102
- version: '2.7'
101
+ version: '3.0'
103
102
  type: :runtime
104
103
  prerelease: false
105
104
  version_requirements: !ruby/object:Gem::Requirement
106
105
  requirements:
107
106
  - - "~>"
108
107
  - !ruby/object:Gem::Version
109
- version: '2.7'
108
+ version: '3.0'
110
109
  - !ruby/object:Gem::Dependency
111
110
  name: infusible
112
111
  requirement: !ruby/object:Gem::Requirement
113
112
  requirements:
114
113
  - - "~>"
115
114
  - !ruby/object:Gem::Version
116
- version: '3.12'
115
+ version: '4.0'
117
116
  type: :runtime
118
117
  prerelease: false
119
118
  version_requirements: !ruby/object:Gem::Requirement
120
119
  requirements:
121
120
  - - "~>"
122
121
  - !ruby/object:Gem::Version
123
- version: '3.12'
122
+ version: '4.0'
124
123
  - !ruby/object:Gem::Dependency
125
124
  name: refinements
126
125
  requirement: !ruby/object:Gem::Requirement
127
126
  requirements:
128
127
  - - "~>"
129
128
  - !ruby/object:Gem::Version
130
- version: '12.10'
129
+ version: '13.0'
131
130
  type: :runtime
132
131
  prerelease: false
133
132
  version_requirements: !ruby/object:Gem::Requirement
134
133
  requirements:
135
134
  - - "~>"
136
135
  - !ruby/object:Gem::Version
137
- version: '12.10'
136
+ version: '13.0'
138
137
  - !ruby/object:Gem::Dependency
139
138
  name: runcom
140
139
  requirement: !ruby/object:Gem::Requirement
141
140
  requirements:
142
141
  - - "~>"
143
142
  - !ruby/object:Gem::Version
144
- version: '11.10'
143
+ version: '12.0'
145
144
  type: :runtime
146
145
  prerelease: false
147
146
  version_requirements: !ruby/object:Gem::Requirement
148
147
  requirements:
149
148
  - - "~>"
150
149
  - !ruby/object:Gem::Version
151
- version: '11.10'
150
+ version: '12.0'
152
151
  - !ruby/object:Gem::Dependency
153
152
  name: sod
154
153
  requirement: !ruby/object:Gem::Requirement
155
154
  requirements:
156
155
  - - "~>"
157
156
  - !ruby/object:Gem::Version
158
- version: '0.20'
157
+ version: '1.0'
159
158
  type: :runtime
160
159
  prerelease: false
161
160
  version_requirements: !ruby/object:Gem::Requirement
162
161
  requirements:
163
162
  - - "~>"
164
163
  - !ruby/object:Gem::Version
165
- version: '0.20'
164
+ version: '1.0'
166
165
  - !ruby/object:Gem::Dependency
167
166
  name: spek
168
167
  requirement: !ruby/object:Gem::Requirement
169
168
  requirements:
170
169
  - - "~>"
171
170
  - !ruby/object:Gem::Version
172
- version: '3.0'
171
+ version: '4.0'
173
172
  type: :runtime
174
173
  prerelease: false
175
174
  version_requirements: !ruby/object:Gem::Requirement
176
175
  requirements:
177
176
  - - "~>"
178
177
  - !ruby/object:Gem::Version
179
- version: '3.0'
178
+ version: '4.0'
180
179
  - !ruby/object:Gem::Dependency
181
180
  name: zeitwerk
182
181
  requirement: !ruby/object:Gem::Requirement
@@ -191,7 +190,6 @@ dependencies:
191
190
  - - "~>"
192
191
  - !ruby/object:Gem::Version
193
192
  version: '2.7'
194
- description:
195
193
  email:
196
194
  - brooke@alchemists.io
197
195
  executables:
@@ -215,8 +213,8 @@ files:
215
213
  - lib/tocer/configuration/defaults.yml
216
214
  - lib/tocer/configuration/model.rb
217
215
  - lib/tocer/container.rb
216
+ - lib/tocer/dependencies.rb
218
217
  - lib/tocer/elements/comment_block.rb
219
- - lib/tocer/import.rb
220
218
  - lib/tocer/parsers/header.rb
221
219
  - lib/tocer/rake/register.rb
222
220
  - lib/tocer/runner.rb
@@ -236,16 +234,12 @@ metadata:
236
234
  label: Tocer
237
235
  rubygems_mfa_required: 'true'
238
236
  source_code_uri: https://github.com/bkuhlmann/tocer
239
- post_install_message:
240
237
  rdoc_options: []
241
238
  require_paths:
242
239
  - lib
243
240
  required_ruby_version: !ruby/object:Gem::Requirement
244
241
  requirements:
245
- - - ">="
246
- - !ruby/object:Gem::Version
247
- version: '3.3'
248
- - - "<="
242
+ - - "~>"
249
243
  - !ruby/object:Gem::Version
250
244
  version: '3.4'
251
245
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -254,8 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
248
  - !ruby/object:Gem::Version
255
249
  version: '0'
256
250
  requirements: []
257
- rubygems_version: 3.5.23
258
- signing_key:
251
+ rubygems_version: 3.6.2
259
252
  specification_version: 4
260
253
  summary: A command line interface for generating Markdown table of contents.
261
254
  test_files: []
metadata.gz.sig CHANGED
Binary file