tocer 13.3.1 → 14.0.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/tocer/cli/actions/config.rb +5 -7
- data/lib/tocer/cli/actions/container.rb +21 -0
- data/lib/tocer/cli/actions/import.rb +11 -0
- data/lib/tocer/cli/actions/insert.rb +5 -5
- data/lib/tocer/cli/parser.rb +9 -6
- data/lib/tocer/cli/parsers/core.rb +6 -6
- data/lib/tocer/cli/parsers/flag.rb +1 -1
- data/lib/tocer/cli/shell.rb +7 -18
- data/lib/tocer/container.rb +2 -24
- data/lib/tocer/import.rb +7 -0
- data/lib/tocer/rake/tasks.rb +1 -1
- data/lib/tocer/runner.rb +1 -1
- data/tocer.gemspec +3 -2
- data.tar.gz.sig +2 -3
- metadata +36 -19
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a05e970caa35154a934935ce68369317a72ed69d890f7a758468238afea8fbe
|
4
|
+
data.tar.gz: e63a6534b56cd58aaf31e1a965d54da9c8b73aa6b05c947d41ae20aca3b5f8be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca1c6345458fa55f6e302f7aeb045bace784df2fab16f080a2b44996ca09a8ebec24760b7b33f909996321d79cb424d6cfc609c531823eb652bd32fc8c27258
|
7
|
+
data.tar.gz: 27c7f6fa2adf1842dccd1f3be7af036bc22e6a3b15d3e9cc39f701640cfd33658eb5fbda79d1dccd38071ab0d58458ee885d57fbcf93f8fcc29d1495ac21f1b7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -5,9 +5,11 @@ module Tocer
|
|
5
5
|
module Actions
|
6
6
|
# Handles the config action.
|
7
7
|
class Config
|
8
|
-
|
8
|
+
include Tocer::Import[:kernel, :logger]
|
9
|
+
|
10
|
+
def initialize client: Configuration::Loader::CLIENT, **dependencies
|
11
|
+
super(**dependencies)
|
9
12
|
@client = client
|
10
|
-
@container = container
|
11
13
|
end
|
12
14
|
|
13
15
|
def call selection
|
@@ -20,15 +22,11 @@ module Tocer
|
|
20
22
|
|
21
23
|
private
|
22
24
|
|
23
|
-
attr_reader :client
|
25
|
+
attr_reader :client
|
24
26
|
|
25
27
|
def edit = kernel.system("$EDITOR #{client.current}")
|
26
28
|
|
27
29
|
def view = kernel.system("cat #{client.current}")
|
28
|
-
|
29
|
-
def kernel = container[__method__]
|
30
|
-
|
31
|
-
def logger = container[__method__]
|
32
30
|
end
|
33
31
|
end
|
34
32
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/container"
|
4
|
+
|
5
|
+
module Tocer
|
6
|
+
module CLI
|
7
|
+
module Actions
|
8
|
+
# Provides a single container with application and action specific dependencies.
|
9
|
+
module Container
|
10
|
+
extend Dry::Container::Mixin
|
11
|
+
|
12
|
+
config.registry = ->(container, key, value, _options) { container[key.to_s] = value }
|
13
|
+
|
14
|
+
merge Tocer::Container
|
15
|
+
|
16
|
+
register(:config) { Config.new }
|
17
|
+
register(:insert) { Insert.new }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -5,9 +5,11 @@ module Tocer
|
|
5
5
|
module Actions
|
6
6
|
# Handles the insert action.
|
7
7
|
class Insert
|
8
|
-
|
8
|
+
include Tocer::Import[:logger]
|
9
|
+
|
10
|
+
def initialize runner: Runner.new, **dependencies
|
11
|
+
super(**dependencies)
|
9
12
|
@runner = runner
|
10
|
-
@container = container
|
11
13
|
end
|
12
14
|
|
13
15
|
def call configuration
|
@@ -16,9 +18,7 @@ module Tocer
|
|
16
18
|
|
17
19
|
private
|
18
20
|
|
19
|
-
attr_reader :runner
|
20
|
-
|
21
|
-
def logger = container[__method__]
|
21
|
+
attr_reader :runner
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/tocer/cli/parser.rb
CHANGED
@@ -6,26 +6,29 @@ module Tocer
|
|
6
6
|
module CLI
|
7
7
|
# Assembles and parses all Command Line Interface (CLI) options.
|
8
8
|
class Parser
|
9
|
+
include Import[:configuration]
|
10
|
+
|
9
11
|
CLIENT = OptionParser.new nil, 40, " "
|
10
|
-
SECTIONS = [Parsers::Core, Parsers::Flag].freeze # Order
|
12
|
+
SECTIONS = [Parsers::Core, Parsers::Flag].freeze # Order matters.
|
11
13
|
|
12
|
-
def initialize sections: SECTIONS, client: CLIENT,
|
14
|
+
def initialize sections: SECTIONS, client: CLIENT, **dependencies
|
15
|
+
super(**dependencies)
|
13
16
|
@sections = sections
|
14
17
|
@client = client
|
15
|
-
@
|
18
|
+
@configuration_duplicate = configuration.dup
|
16
19
|
end
|
17
20
|
|
18
21
|
def call arguments = []
|
19
|
-
sections.each { |parser| parser.call
|
22
|
+
sections.each { |parser| parser.call configuration_duplicate, client: }
|
20
23
|
client.parse arguments
|
21
|
-
|
24
|
+
configuration_duplicate.freeze
|
22
25
|
end
|
23
26
|
|
24
27
|
def to_s = client.to_s
|
25
28
|
|
26
29
|
private
|
27
30
|
|
28
|
-
attr_reader :sections, :client, :
|
31
|
+
attr_reader :sections, :client, :configuration_duplicate
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
@@ -7,16 +7,18 @@ module Tocer
|
|
7
7
|
module Parsers
|
8
8
|
# Handles parsing of Command Line Interface (CLI) core options.
|
9
9
|
class Core
|
10
|
+
include Import[:specification]
|
11
|
+
|
10
12
|
using Refinements::Structs
|
11
13
|
|
12
14
|
def self.call(...) = new(...).call
|
13
15
|
|
14
|
-
def initialize configuration =
|
16
|
+
def initialize configuration = Container[:configuration],
|
15
17
|
client: Parser::CLIENT,
|
16
|
-
|
18
|
+
**dependencies
|
19
|
+
super(**dependencies)
|
17
20
|
@configuration = configuration
|
18
21
|
@client = client
|
19
|
-
@container = container
|
20
22
|
end
|
21
23
|
|
22
24
|
def call arguments = []
|
@@ -29,7 +31,7 @@ module Tocer
|
|
29
31
|
|
30
32
|
private
|
31
33
|
|
32
|
-
attr_reader :configuration, :client
|
34
|
+
attr_reader :configuration, :client
|
33
35
|
|
34
36
|
def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
|
35
37
|
|
@@ -67,8 +69,6 @@ module Tocer
|
|
67
69
|
configuration.merge! action_help: true
|
68
70
|
end
|
69
71
|
end
|
70
|
-
|
71
|
-
def specification = container[__method__]
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -11,7 +11,7 @@ module Tocer
|
|
11
11
|
|
12
12
|
def self.call(...) = new(...).call
|
13
13
|
|
14
|
-
def initialize configuration =
|
14
|
+
def initialize configuration = Container[:configuration], client: Parser::CLIENT
|
15
15
|
@configuration = configuration
|
16
16
|
@client = client
|
17
17
|
end
|
data/lib/tocer/cli/shell.rb
CHANGED
@@ -4,12 +4,11 @@ module Tocer
|
|
4
4
|
module CLI
|
5
5
|
# The main Command Line Interface (CLI) object.
|
6
6
|
class Shell
|
7
|
-
|
7
|
+
include Actions::Import[:config, :insert, :specification, :logger]
|
8
8
|
|
9
|
-
def initialize parser: Parser.new,
|
9
|
+
def initialize parser: Parser.new, **dependencies
|
10
|
+
super(**dependencies)
|
10
11
|
@parser = parser
|
11
|
-
@actions = actions
|
12
|
-
@container = container
|
13
12
|
end
|
14
13
|
|
15
14
|
def call arguments = []
|
@@ -20,26 +19,16 @@ module Tocer
|
|
20
19
|
|
21
20
|
private
|
22
21
|
|
23
|
-
attr_reader :parser
|
22
|
+
attr_reader :parser
|
24
23
|
|
25
24
|
def perform configuration
|
26
25
|
case configuration
|
27
|
-
in action_config: Symbol => action then
|
28
|
-
in action_insert: true then
|
26
|
+
in action_config: Symbol => action then config.call action
|
27
|
+
in action_insert: true then insert.call configuration
|
29
28
|
in action_version: true then logger.info { specification.labeled_version }
|
30
|
-
else
|
29
|
+
else logger.any { parser.to_s }
|
31
30
|
end
|
32
31
|
end
|
33
|
-
|
34
|
-
def process_config(action) = actions.fetch(:config).call(action)
|
35
|
-
|
36
|
-
def process_insert(configuration) = actions.fetch(:insert).call(configuration)
|
37
|
-
|
38
|
-
def usage = puts(parser.to_s)
|
39
|
-
|
40
|
-
def specification = container[__method__]
|
41
|
-
|
42
|
-
def logger = container[__method__]
|
43
32
|
end
|
44
33
|
end
|
45
34
|
end
|
data/lib/tocer/container.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "cogger"
|
3
4
|
require "dry-container"
|
4
|
-
require "logger"
|
5
|
-
require "pastel"
|
6
5
|
require "spek"
|
7
6
|
|
8
7
|
module Tocer
|
@@ -12,28 +11,7 @@ module Tocer
|
|
12
11
|
|
13
12
|
register(:configuration) { Configuration::Loader.call }
|
14
13
|
register(:specification) { Spek::Loader.call "#{__dir__}/../../tocer.gemspec" }
|
15
|
-
register(:colorizer) { Pastel.new enabled: $stdout.tty? }
|
16
14
|
register(:kernel) { Kernel }
|
17
|
-
|
18
|
-
register :log_colors do
|
19
|
-
{
|
20
|
-
"DEBUG" => self[:colorizer].white.detach,
|
21
|
-
"INFO" => self[:colorizer].green.detach,
|
22
|
-
"WARN" => self[:colorizer].yellow.detach,
|
23
|
-
"ERROR" => self[:colorizer].red.detach,
|
24
|
-
"FATAL" => self[:colorizer].white.bold.on_red.detach,
|
25
|
-
"ANY" => self[:colorizer].white.bold.detach
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
register :logger do
|
30
|
-
Logger.new $stdout,
|
31
|
-
level: Logger.const_get(ENV.fetch("LOG_LEVEL", "INFO")),
|
32
|
-
formatter: (
|
33
|
-
lambda do |severity, _at, _name, message|
|
34
|
-
self[:log_colors][severity].call "#{message}\n"
|
35
|
-
end
|
36
|
-
)
|
37
|
-
end
|
15
|
+
register(:logger) { Cogger::Client.new }
|
38
16
|
end
|
39
17
|
end
|
data/lib/tocer/import.rb
ADDED
data/lib/tocer/rake/tasks.rb
CHANGED
@@ -13,7 +13,7 @@ module Tocer
|
|
13
13
|
|
14
14
|
def self.setup = new.install
|
15
15
|
|
16
|
-
def initialize configuration =
|
16
|
+
def initialize configuration = Container[:configuration], runner: Runner.new
|
17
17
|
@configuration = configuration
|
18
18
|
@runner = runner
|
19
19
|
end
|
data/lib/tocer/runner.rb
CHANGED
@@ -11,7 +11,7 @@ module Tocer
|
|
11
11
|
@writer = writer
|
12
12
|
end
|
13
13
|
|
14
|
-
def call configuration =
|
14
|
+
def call configuration = Container[:configuration]
|
15
15
|
Pathname(configuration.root_dir).files(%({#{configuration.includes.join ","}}))
|
16
16
|
.each do |path|
|
17
17
|
yield path if block_given?
|
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 = "
|
5
|
+
spec.version = "14.0.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://www.alchemists.io/projects/tocer"
|
@@ -22,8 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.cert_chain = [Gem.default_cert_path]
|
23
23
|
|
24
24
|
spec.required_ruby_version = "~> 3.1"
|
25
|
+
spec.add_dependency "auto_injector", "~> 0.4"
|
26
|
+
spec.add_dependency "cogger", "~> 0.0"
|
25
27
|
spec.add_dependency "dry-container", "~> 0.9"
|
26
|
-
spec.add_dependency "pastel", "~> 0.8"
|
27
28
|
spec.add_dependency "refinements", "~> 9.2"
|
28
29
|
spec.add_dependency "runcom", "~> 8.2"
|
29
30
|
spec.add_dependency "spek", "~> 0.2"
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
g���&�;Vg
|
1
|
+
�5v��`~SGe���sOFGm�Pr�GCt
|
2
|
+
��X`�=��:LWP�g��0`Ҳå�7�̜��ܯ^A +�|����=V{���%D�������y�/�|�s�$��Ơ�gYծ.'�Hd�}���85��e����:�[6��;ۇ���
|
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:
|
4
|
+
version: 14.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,9 +10,9 @@ bindir: exe
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIC/
|
14
|
-
|
15
|
-
|
13
|
+
MIIC/jCCAeagAwIBAgIBBTANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMjAzMTkxNzI0MzJaFw0yMzAzMTkx
|
15
|
+
NzI0MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
@@ -20,44 +20,58 @@ cert_chain:
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
-
2CdikiiE3fJhP/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAJbbNyWzFjqUNVPPCUCo
|
24
|
+
IMrhDa9xf1xkORXNYYbmXgoxRy/KyNbUr+jgEEoWJAm9GXlcqxxWAUI6pK/i4/Qi
|
25
|
+
X6rPFEFmeObDOHNvuqy8Hd6AYsu+kP94U/KJhe9wnWGMmGoNKJNU3EkW3jM/osSl
|
26
|
+
+JRxiH5t4WtnDiVyoYl5nYC02rYdjJkG6VMxDymXTqn7u6HhYgZkGujq1UPar8x2
|
27
|
+
hNIWJblDKKSu7hA2d6+kUthuYo13o1sg1Da/AEDg0hoZSUvhqDEF5Hy232qb3pDt
|
28
|
+
CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
|
29
|
+
RFE=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2022-
|
31
|
+
date: 2022-04-09 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: auto_injector
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.4'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.4'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: cogger
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.0'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
60
|
+
version: '0.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: dry-container
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.9'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.9'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: refinements
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,6 +144,8 @@ files:
|
|
130
144
|
- lib/tocer.rb
|
131
145
|
- lib/tocer/builder.rb
|
132
146
|
- lib/tocer/cli/actions/config.rb
|
147
|
+
- lib/tocer/cli/actions/container.rb
|
148
|
+
- lib/tocer/cli/actions/import.rb
|
133
149
|
- lib/tocer/cli/actions/insert.rb
|
134
150
|
- lib/tocer/cli/parser.rb
|
135
151
|
- lib/tocer/cli/parsers/core.rb
|
@@ -140,6 +156,7 @@ files:
|
|
140
156
|
- lib/tocer/configuration/loader.rb
|
141
157
|
- lib/tocer/container.rb
|
142
158
|
- lib/tocer/elements/comment_block.rb
|
159
|
+
- lib/tocer/import.rb
|
143
160
|
- lib/tocer/parsers/header.rb
|
144
161
|
- lib/tocer/rake/setup.rb
|
145
162
|
- lib/tocer/rake/tasks.rb
|
@@ -174,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
191
|
- !ruby/object:Gem::Version
|
175
192
|
version: '0'
|
176
193
|
requirements: []
|
177
|
-
rubygems_version: 3.3.
|
194
|
+
rubygems_version: 3.3.11
|
178
195
|
signing_key:
|
179
196
|
specification_version: 4
|
180
197
|
summary: A command line interface for generating table of contents for Markdown files.
|
metadata.gz.sig
CHANGED
Binary file
|