tocer 17.5.0 → 18.1.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: a01d6e9fbe498db758de89311f7b32a62542d78c32f12c826cf85d0069600680
4
- data.tar.gz: c0acfe365286d446c42c10051e43b098cc2f3e6c310919456030e2a8245099ea
3
+ metadata.gz: e9014699e067c4ff934b7d1c71e4a77c46509cf9d80fb4e4b4a68c6416b34fc3
4
+ data.tar.gz: 472e9acf6db4fee804f69cbdddb6085f63a1cda20221d2d7ae76a54068208cdc
5
5
  SHA512:
6
- metadata.gz: b13030024c572690373dcdaf92af030c76f9df88e072ded755a9c89368d115942e5051aa0debbcb96987688e0d7363c3ffa7702f11bee86570d1335e063104a2
7
- data.tar.gz: ec3407114f4f8ec3e8a719cc3887adf6141bd2bf8b56f4f1c0296b823c10cff54b871a158a8ba0a8e98da165b184688997b5b9c5a7369634591c980a5ec72a99
6
+ metadata.gz: f5fea95886c1bf45159975de72c2eaba9262cdedc8e2e1df2edcc5dff162596d0bc681b3bc942ab97ae815aeb001c1d38cc856b6d044ae4858f0c5d7af1eca5e
7
+ data.tar.gz: 84f37e307388814bc8a7efbf85813d5f1ed52d04eafdeef95f0f2a57bb1e7f4bf8a08e7fbe5a8084bfe827c255d524289adce77a1e1f42e298c03cd94ed7d18b
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/tocer/builder.rb CHANGED
@@ -20,7 +20,7 @@ module Tocer
20
20
 
21
21
  def unbuildable?(lines) = comment_block.empty?(lines) && headers(lines).empty?
22
22
 
23
- def call lines, label: Container[:configuration].label
23
+ def call lines, label: Container[:settings].label
24
24
  return "" if headers(lines).empty?
25
25
 
26
26
  url_count.clear
@@ -7,15 +7,15 @@ module Tocer
7
7
  module Actions
8
8
  # Stores table of contents label.
9
9
  class Label < Sod::Action
10
- include Import[:input]
10
+ include Import[:settings]
11
11
 
12
12
  description "Set label."
13
13
 
14
14
  on %w[-l --label], argument: "[TEXT]"
15
15
 
16
- default { Container[:configuration].label }
16
+ default { Container[:settings].label }
17
17
 
18
- def call(label = nil) = input.label = label || default
18
+ def call(label = nil) = settings.label = label || default
19
19
  end
20
20
  end
21
21
  end
@@ -7,15 +7,15 @@ module Tocer
7
7
  module Actions
8
8
  # Stores table of contents file patterns.
9
9
  class Pattern < Sod::Action
10
- include Import[:input]
10
+ include Import[:settings]
11
11
 
12
12
  description "Set file patterns."
13
13
 
14
14
  on %w[-p --patterns], argument: "[a,b,c]"
15
15
 
16
- default { Container[:configuration].patterns }
16
+ default { Container[:settings].patterns }
17
17
 
18
- def call(patterns = nil) = input.patterns = Array(patterns || default)
18
+ def call(patterns = nil) = settings.patterns = Array(patterns || default)
19
19
  end
20
20
  end
21
21
  end
@@ -7,15 +7,15 @@ module Tocer
7
7
  module Actions
8
8
  # Stores table of contents root path.
9
9
  class Root < Sod::Action
10
- include Import[:input]
10
+ include Import[:settings]
11
11
 
12
12
  description "Set root directory."
13
13
 
14
14
  on %w[-r --root], argument: "[PATH]"
15
15
 
16
- default { Container[:configuration].root_dir }
16
+ default { Container[:settings].root_dir }
17
17
 
18
- def call(path = nil) = input.root_dir = Pathname(path || default)
18
+ def call(path = nil) = settings.root_dir = Pathname(path || default)
19
19
  end
20
20
  end
21
21
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pathname"
4
- require "refinements/struct"
5
3
  require "sod"
6
4
 
7
5
  module Tocer
@@ -9,8 +7,6 @@ module Tocer
9
7
  module Commands
10
8
  # Stores table of contents root path.
11
9
  class Upsert < Sod::Command
12
- include Import[:input, :kernel]
13
-
14
10
  handle "upsert"
15
11
 
16
12
  description "Update/insert table of contents."
@@ -20,11 +16,11 @@ module Tocer
20
16
  on Actions::Pattern
21
17
 
22
18
  def initialize(runner: Runner.new, **)
23
- super(**)
24
19
  @runner = runner
20
+ super(**)
25
21
  end
26
22
 
27
- def call = runner.call input
23
+ def call = runner.call
28
24
 
29
25
  private
30
26
 
@@ -11,21 +11,17 @@ module Tocer
11
11
  module Container
12
12
  extend Containable
13
13
 
14
- register :configuration do
15
- self[:defaults].add_loader(:yaml, self[:xdg_config].active)
16
- .then { |registry| Etcher.call registry }
17
- end
18
-
19
- register :defaults do
14
+ register :registry do
20
15
  Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
21
16
  .add_loader(:yaml, self[:defaults_path])
17
+ .add_loader(:yaml, self[:xdg_config].active)
22
18
  end
23
19
 
24
- register(:input) { self[:configuration].dup }
20
+ register(:settings) { Etcher.call(self[:registry]).dup }
25
21
  register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
26
22
  register(:xdg_config) { Runcom::Config.new "tocer/configuration.yml" }
27
23
  register(:specification) { Spek::Loader.call "#{__dir__}/../../tocer.gemspec" }
28
24
  register(:logger) { Cogger.new id: :tocer }
29
- register :kernel, Kernel
25
+ register :io, STDOUT
30
26
  end
31
27
  end
@@ -9,25 +9,28 @@ module Tocer
9
9
  # Registers Rake tasks for use.
10
10
  class Register
11
11
  include ::Rake::DSL
12
+ include Import[:settings]
13
+
12
14
  using Refinements::Struct
13
15
 
14
16
  def self.call = new.call
15
17
 
16
- def initialize configuration = Container[:configuration], runner: Runner.new
17
- @configuration = configuration
18
+ def initialize(runner: Runner.new, **)
18
19
  @runner = runner
20
+ super(**)
19
21
  end
20
22
 
21
23
  def call
22
24
  desc "Update/Insert Table of Contents"
23
25
  task :toc, %i[label patterns] do |_task, arguments|
24
- runner.call configuration.merge(arguments.to_h)
26
+ settings.merge! arguments
27
+ runner.call
25
28
  end
26
29
  end
27
30
 
28
31
  private
29
32
 
30
- attr_reader :configuration, :runner
33
+ attr_reader :runner
31
34
  end
32
35
  end
33
36
  end
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[:kernel]
8
+ include Import[:settings, :io]
9
9
 
10
10
  using Refinements::Pathname
11
11
 
@@ -14,14 +14,13 @@ module Tocer
14
14
  @writer = writer
15
15
  end
16
16
 
17
- # :reek:FeatureEnvy
18
- def call configuration
19
- configuration.root_dir
20
- .files(%({#{configuration.patterns.join ","}}))
21
- .each do |path|
22
- kernel.puts " #{path}"
23
- writer.call path, label: configuration.label
24
- end
17
+ def call
18
+ settings.root_dir
19
+ .files(%({#{settings.patterns.join ","}}))
20
+ .each do |path|
21
+ io.puts " #{path}"
22
+ writer.call path, label: settings.label
23
+ end
25
24
  end
26
25
 
27
26
  private
data/lib/tocer/writer.rb CHANGED
@@ -24,7 +24,7 @@ module Tocer
24
24
  @builder = builder
25
25
  end
26
26
 
27
- def call path, label: Container[:configuration].label
27
+ def call path, label: Container[:settings].label
28
28
  path.rewrite do |body|
29
29
  lines = body.each_line.to_a
30
30
  builder.prependable?(lines) ? prepend(lines, label) : replace(lines, label)
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 = "17.5.0"
5
+ spec.version = "18.1.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/tocer"
@@ -23,15 +23,15 @@ Gem::Specification.new do |spec|
23
23
  spec.cert_chain = [Gem.default_cert_path]
24
24
 
25
25
  spec.required_ruby_version = "~> 3.3"
26
- spec.add_dependency "cogger", "~> 0.15"
27
- spec.add_dependency "containable", "~> 0.0"
26
+ spec.add_dependency "cogger", "~> 0.21"
27
+ spec.add_dependency "containable", "~> 0.2"
28
28
  spec.add_dependency "core", "~> 1.0"
29
29
  spec.add_dependency "dry-schema", "~> 1.13"
30
- spec.add_dependency "etcher", "~> 1.6"
31
- spec.add_dependency "infusible", "~> 3.5"
32
- spec.add_dependency "refinements", "~> 12.1"
33
- spec.add_dependency "runcom", "~> 11.0"
34
- spec.add_dependency "sod", "~> 0.8"
30
+ spec.add_dependency "etcher", "~> 2.1"
31
+ spec.add_dependency "infusible", "~> 3.8"
32
+ spec.add_dependency "refinements", "~> 12.7"
33
+ spec.add_dependency "runcom", "~> 11.5"
34
+ spec.add_dependency "sod", "~> 0.12"
35
35
  spec.add_dependency "spek", "~> 3.0"
36
36
  spec.add_dependency "zeitwerk", "~> 2.6"
37
37
 
data.tar.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- +��:��LІ�[')3�ŇW�-����h��T�2���7�V��#�>�-;p��+��ɟ�nS[`�3)Kw���2���U��%�O�2�� �|n��J0R����]R�)���h�pT!�������t���UԔ�6�%(P6�F�)=]
2
- ����rJh\��l�>��i�+��0���4:zc9=
1
+ r��]fW�G^�W����^u�Ӳ��@�t�|Ѩ���(0��\0�@Q7h����q�έ͝�C�֘(�F���~�v�E���b�ʾt{G���O���;�we�ȵ�#T����k��������`#�D�����rBEi�ԃC���e�<g<V�yv���FD��n�R�?�b}�%�t�!��} ��*��EP���f�ߣ��:�8eD
2
+ ���AK6~q���P�� �l�s�0��b�S�z5����f^4��2� $����)^�S"ˎ�x�%�aKxȈ�eKͱ�
3
+ TW��"�-�|�E���wR�Ӄ��b�UY���k㘆'�P�&����C4�x�o��R�Ԡ��wԛE�m�l�O���`꺝�ү�
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tocer
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.5.0
4
+ version: 18.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2024-05-31 00:00:00.000000000 Z
38
+ date: 2024-07-15 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -43,28 +43,28 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.15'
46
+ version: '0.21'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.15'
53
+ version: '0.21'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: containable
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0.0'
60
+ version: '0.2'
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.0'
67
+ version: '0.2'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: core
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -99,70 +99,70 @@ dependencies:
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '1.6'
102
+ version: '2.1'
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '1.6'
109
+ version: '2.1'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: infusible
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '3.5'
116
+ version: '3.8'
117
117
  type: :runtime
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '3.5'
123
+ version: '3.8'
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: refinements
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '12.1'
130
+ version: '12.7'
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '12.1'
137
+ version: '12.7'
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: runcom
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '11.0'
144
+ version: '11.5'
145
145
  type: :runtime
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '11.0'
151
+ version: '11.5'
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: sod
154
154
  requirement: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '0.8'
158
+ version: '0.12'
159
159
  type: :runtime
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '0.8'
165
+ version: '0.12'
166
166
  - !ruby/object:Gem::Dependency
167
167
  name: spek
168
168
  requirement: !ruby/object:Gem::Requirement
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []
254
- rubygems_version: 3.5.11
254
+ rubygems_version: 3.5.15
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: A command line interface for generating Markdown table of contents.
metadata.gz.sig CHANGED
Binary file