tocer 13.0.2 → 13.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -3
- data/exe/tocer +0 -1
- data/lib/tocer/cli/actions/config.rb +10 -6
- data/lib/tocer/cli/actions/insert.rb +8 -3
- data/lib/tocer/cli/parser.rb +3 -3
- data/lib/tocer/cli/parsers/core.rb +8 -4
- data/lib/tocer/cli/shell.rb +8 -3
- data/lib/tocer/configuration/loader.rb +1 -1
- data/lib/tocer/container.rb +40 -0
- data/lib/tocer/transformers/finder.rb +1 -1
- data/lib/tocer/writer.rb +2 -2
- data/tocer.gemspec +37 -0
- data.tar.gz.sig +0 -0
- metadata +36 -6
- metadata.gz.sig +2 -1
- data/lib/tocer/identity.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4f9a0ee9b693d4deefef11c3796836eb6a8b005cd05fceefdb94de06136383c
|
4
|
+
data.tar.gz: 73b94f1b13302644bac07a2eeb9fe31af2f7d4e8684ba991f6dc6d7246911541
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bde200579f6defddd5c7e95a1b2f513e787faf308c7afdcd21f1e5aa84025cd81a4448487e40e8bf66373901094ceee7c3edef6fce0d2c00034c638d6ee2e24
|
7
|
+
data.tar.gz: 1ac27f2f664c353fb48386407fd4a0370f50d5a9b412a0bcb3c7b969d348c6c2d57fec15cce93dac568da57a3b7111bb1e015a18c3dc4f4d9139206af5f11f74
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
�
|
3
|
-
|
1
|
+
q�Q��z�F瞲��$���~G�=5��qź�م��"<�
|
2
|
+
q�ۏ�A$�g�q�`��Cx�u�>N��0��;n�('�R��L*��f{>"����D��w�XR?�w�ݥ�W�f�7��}�hEW����T&&�P|P��*:���x���Ģg�وn�}p�`���m�7�x]f�9<,jup��B�g��؝')
|
3
|
+
��Z�b�JG]�����V�o�:&�f��K����$�6^���:�8L+\�I����8��ؕ3lӞ�ȦA(��57���>�q^�j�*��DgֲE-]�
|
data/exe/tocer
CHANGED
@@ -5,26 +5,30 @@ module Tocer
|
|
5
5
|
module Actions
|
6
6
|
# Handles the config action.
|
7
7
|
class Config
|
8
|
-
def initialize client: Configuration::Loader::CLIENT,
|
8
|
+
def initialize client: Configuration::Loader::CLIENT, container: Container
|
9
9
|
@client = client
|
10
|
-
@
|
10
|
+
@container = container
|
11
11
|
end
|
12
12
|
|
13
|
-
def call
|
14
|
-
case
|
13
|
+
def call selection
|
14
|
+
case selection
|
15
15
|
when :edit then edit
|
16
16
|
when :view then view
|
17
|
-
else
|
17
|
+
else logger.error { "Invalid configuration selection: #{selection}." }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
attr_reader :client, :
|
23
|
+
attr_reader :client, :container
|
24
24
|
|
25
25
|
def edit = kernel.system("$EDITOR #{client.current}")
|
26
26
|
|
27
27
|
def view = kernel.system("cat #{client.current}")
|
28
|
+
|
29
|
+
def kernel = container[__method__]
|
30
|
+
|
31
|
+
def logger = container[__method__]
|
28
32
|
end
|
29
33
|
end
|
30
34
|
end
|
@@ -5,15 +5,20 @@ module Tocer
|
|
5
5
|
module Actions
|
6
6
|
# Handles the insert action.
|
7
7
|
class Insert
|
8
|
-
def initialize runner: Runner.new
|
8
|
+
def initialize runner: Runner.new, container: Container
|
9
9
|
@runner = runner
|
10
|
+
@container = container
|
10
11
|
end
|
11
12
|
|
12
|
-
def call
|
13
|
+
def call configuration
|
14
|
+
runner.call(configuration) { |path| logger.info { " #{path}" } }
|
15
|
+
end
|
13
16
|
|
14
17
|
private
|
15
18
|
|
16
|
-
attr_reader :runner
|
19
|
+
attr_reader :runner, :container
|
20
|
+
|
21
|
+
def logger = container[__method__]
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
data/lib/tocer/cli/parser.rb
CHANGED
@@ -9,10 +9,10 @@ module Tocer
|
|
9
9
|
CLIENT = OptionParser.new nil, 40, " "
|
10
10
|
SECTIONS = [Parsers::Core, Parsers::Flag].freeze # Order is important.
|
11
11
|
|
12
|
-
def initialize
|
13
|
-
@configuration = configuration.dup
|
12
|
+
def initialize sections: SECTIONS, client: CLIENT, container: Container
|
14
13
|
@sections = sections
|
15
14
|
@client = client
|
15
|
+
@configuration = container[:configuration].dup
|
16
16
|
end
|
17
17
|
|
18
18
|
def call arguments = []
|
@@ -25,7 +25,7 @@ module Tocer
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
attr_reader :
|
28
|
+
attr_reader :sections, :client, :configuration
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "tocer/identity"
|
4
3
|
require "refinements/structs"
|
5
4
|
|
6
5
|
module Tocer
|
@@ -12,13 +11,16 @@ module Tocer
|
|
12
11
|
|
13
12
|
def self.call(...) = new(...).call
|
14
13
|
|
15
|
-
def initialize configuration = Configuration::Loader.call,
|
14
|
+
def initialize configuration = Configuration::Loader.call,
|
15
|
+
client: Parser::CLIENT,
|
16
|
+
container: Container
|
16
17
|
@configuration = configuration
|
17
18
|
@client = client
|
19
|
+
@container = container
|
18
20
|
end
|
19
21
|
|
20
22
|
def call arguments = []
|
21
|
-
client.banner = "
|
23
|
+
client.banner = "Tocer - #{specification.summary}"
|
22
24
|
client.separator "\nUSAGE:\n"
|
23
25
|
collate
|
24
26
|
client.parse arguments
|
@@ -27,7 +29,7 @@ module Tocer
|
|
27
29
|
|
28
30
|
private
|
29
31
|
|
30
|
-
attr_reader :configuration, :client
|
32
|
+
attr_reader :configuration, :client, :container
|
31
33
|
|
32
34
|
def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
|
33
35
|
|
@@ -65,6 +67,8 @@ module Tocer
|
|
65
67
|
configuration.merge! action_help: true
|
66
68
|
end
|
67
69
|
end
|
70
|
+
|
71
|
+
def specification = container[__method__]
|
68
72
|
end
|
69
73
|
end
|
70
74
|
end
|
data/lib/tocer/cli/shell.rb
CHANGED
@@ -6,9 +6,10 @@ module Tocer
|
|
6
6
|
class Shell
|
7
7
|
ACTIONS = {config: Actions::Config.new, insert: Actions::Insert.new}.freeze
|
8
8
|
|
9
|
-
def initialize parser: Parser.new, actions: ACTIONS
|
9
|
+
def initialize parser: Parser.new, actions: ACTIONS, container: Container
|
10
10
|
@parser = parser
|
11
11
|
@actions = actions
|
12
|
+
@container = container
|
12
13
|
end
|
13
14
|
|
14
15
|
def call arguments = []
|
@@ -19,13 +20,13 @@ module Tocer
|
|
19
20
|
|
20
21
|
private
|
21
22
|
|
22
|
-
attr_reader :parser, :actions
|
23
|
+
attr_reader :parser, :actions, :container
|
23
24
|
|
24
25
|
def perform configuration
|
25
26
|
case configuration
|
26
27
|
in action_config: Symbol => action then process_config action
|
27
28
|
in action_insert: true then process_insert configuration
|
28
|
-
in action_version: true then
|
29
|
+
in action_version: true then logger.info { "Tocer #{specification.version}" }
|
29
30
|
else usage
|
30
31
|
end
|
31
32
|
end
|
@@ -35,6 +36,10 @@ module Tocer
|
|
35
36
|
def process_insert(configuration) = actions.fetch(:insert).call(configuration)
|
36
37
|
|
37
38
|
def usage = puts(parser.to_s)
|
39
|
+
|
40
|
+
def specification = container[__method__]
|
41
|
+
|
42
|
+
def logger = container[__method__]
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
@@ -12,7 +12,7 @@ module Tocer
|
|
12
12
|
using Refinements::Structs
|
13
13
|
|
14
14
|
DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
|
15
|
-
CLIENT = Runcom::Config.new "
|
15
|
+
CLIENT = Runcom::Config.new "tocer/configuration.yml", defaults: DEFAULTS
|
16
16
|
|
17
17
|
def self.call = new.call
|
18
18
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry-container"
|
4
|
+
require "logger"
|
5
|
+
require "pastel"
|
6
|
+
|
7
|
+
module Tocer
|
8
|
+
# Provides a global gem container for injection into other objects.
|
9
|
+
module Container
|
10
|
+
extend Dry::Container::Mixin
|
11
|
+
|
12
|
+
SPEC_PATH = "#{__dir__}/../../tocer.gemspec".freeze
|
13
|
+
|
14
|
+
register(:configuration) { Configuration::Loader.call }
|
15
|
+
register(:specification) { Gem::Specification.load SPEC_PATH }
|
16
|
+
register(:colorizer) { Pastel.new enabled: $stdout.tty? }
|
17
|
+
register(:kernel) { Kernel }
|
18
|
+
|
19
|
+
register :log_colors do
|
20
|
+
{
|
21
|
+
"DEBUG" => self[:colorizer].white.detach,
|
22
|
+
"INFO" => self[:colorizer].green.detach,
|
23
|
+
"WARN" => self[:colorizer].yellow.detach,
|
24
|
+
"ERROR" => self[:colorizer].red.detach,
|
25
|
+
"FATAL" => self[:colorizer].white.bold.on_red.detach,
|
26
|
+
"ANY" => self[:colorizer].white.bold.detach
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
register :logger do
|
31
|
+
Logger.new $stdout,
|
32
|
+
level: Logger.const_get(ENV.fetch("LOG_LEVEL", "INFO")),
|
33
|
+
formatter: (
|
34
|
+
lambda do |severity, _at, _name, message|
|
35
|
+
self[:log_colors][severity].call "#{message}\n"
|
36
|
+
end
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/tocer/writer.rb
CHANGED
@@ -48,10 +48,10 @@ module Tocer
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def new_lines lines, label, finish_index
|
51
|
-
if builder.unbuildable?
|
51
|
+
if builder.unbuildable? lines
|
52
52
|
builder.comments
|
53
53
|
else
|
54
|
-
content
|
54
|
+
content lines[finish_index, lines.length], label
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
data/tocer.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "tocer"
|
5
|
+
spec.version = "13.1.0"
|
6
|
+
spec.platform = Gem::Platform::RUBY
|
7
|
+
spec.authors = ["Brooke Kuhlmann"]
|
8
|
+
spec.email = ["brooke@alchemists.io"]
|
9
|
+
spec.homepage = "https://www.alchemists.io/projects/tocer"
|
10
|
+
spec.summary = "A command line interface for generating table of contents for Markdown files."
|
11
|
+
spec.license = "Hippocratic-3.0"
|
12
|
+
|
13
|
+
spec.metadata = {
|
14
|
+
"bug_tracker_uri" => "https://github.com/bkuhlmann/tocer/issues",
|
15
|
+
"changelog_uri" => "https://www.alchemists.io/projects/tocer/versions",
|
16
|
+
"documentation_uri" => "https://www.alchemists.io/projects/tocer",
|
17
|
+
"label" => "Tocer",
|
18
|
+
"rubygems_mfa_required" => "true",
|
19
|
+
"source_code_uri" => "https://github.com/bkuhlmann/tocer"
|
20
|
+
}
|
21
|
+
|
22
|
+
spec.signing_key = Gem.default_key_path
|
23
|
+
spec.cert_chain = [Gem.default_cert_path]
|
24
|
+
|
25
|
+
spec.required_ruby_version = "~> 3.1"
|
26
|
+
spec.add_dependency "dry-container", "~> 0.9"
|
27
|
+
spec.add_dependency "pastel", "~> 0.8"
|
28
|
+
spec.add_dependency "refinements", "~> 9.1"
|
29
|
+
spec.add_dependency "runcom", "~> 8.0"
|
30
|
+
spec.add_dependency "zeitwerk", "~> 2.5"
|
31
|
+
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables << "tocer"
|
34
|
+
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
35
|
+
spec.files = Dir["*.gemspec", "lib/**/*"]
|
36
|
+
spec.require_paths = ["lib"]
|
37
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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: 13.0
|
4
|
+
version: 13.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,22 +28,50 @@ cert_chain:
|
|
28
28
|
lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
|
29
29
|
W2A=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2022-01-
|
31
|
+
date: 2022-01-23 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: dry-container
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.9'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.9'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: pastel
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.8'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.8'
|
33
61
|
- !ruby/object:Gem::Dependency
|
34
62
|
name: refinements
|
35
63
|
requirement: !ruby/object:Gem::Requirement
|
36
64
|
requirements:
|
37
65
|
- - "~>"
|
38
66
|
- !ruby/object:Gem::Version
|
39
|
-
version: '9.
|
67
|
+
version: '9.1'
|
40
68
|
type: :runtime
|
41
69
|
prerelease: false
|
42
70
|
version_requirements: !ruby/object:Gem::Requirement
|
43
71
|
requirements:
|
44
72
|
- - "~>"
|
45
73
|
- !ruby/object:Gem::Version
|
46
|
-
version: '9.
|
74
|
+
version: '9.1'
|
47
75
|
- !ruby/object:Gem::Dependency
|
48
76
|
name: runcom
|
49
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,8 +124,8 @@ files:
|
|
96
124
|
- lib/tocer/configuration/content.rb
|
97
125
|
- lib/tocer/configuration/defaults.yml
|
98
126
|
- lib/tocer/configuration/loader.rb
|
127
|
+
- lib/tocer/container.rb
|
99
128
|
- lib/tocer/elements/comment_block.rb
|
100
|
-
- lib/tocer/identity.rb
|
101
129
|
- lib/tocer/parsers/header.rb
|
102
130
|
- lib/tocer/rake/setup.rb
|
103
131
|
- lib/tocer/rake/tasks.rb
|
@@ -106,6 +134,7 @@ files:
|
|
106
134
|
- lib/tocer/transformers/link.rb
|
107
135
|
- lib/tocer/transformers/text.rb
|
108
136
|
- lib/tocer/writer.rb
|
137
|
+
- tocer.gemspec
|
109
138
|
homepage: https://www.alchemists.io/projects/tocer
|
110
139
|
licenses:
|
111
140
|
- Hippocratic-3.0
|
@@ -113,6 +142,7 @@ metadata:
|
|
113
142
|
bug_tracker_uri: https://github.com/bkuhlmann/tocer/issues
|
114
143
|
changelog_uri: https://www.alchemists.io/projects/tocer/versions
|
115
144
|
documentation_uri: https://www.alchemists.io/projects/tocer
|
145
|
+
label: Tocer
|
116
146
|
rubygems_mfa_required: 'true'
|
117
147
|
source_code_uri: https://github.com/bkuhlmann/tocer
|
118
148
|
post_install_message:
|
@@ -130,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
160
|
- !ruby/object:Gem::Version
|
131
161
|
version: '0'
|
132
162
|
requirements: []
|
133
|
-
rubygems_version: 3.3.
|
163
|
+
rubygems_version: 3.3.5
|
134
164
|
signing_key:
|
135
165
|
specification_version: 4
|
136
166
|
summary: A command line interface for generating table of contents for Markdown files.
|
metadata.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
ÿ��IM��������Q#j�8.}��2��²�Tן`��_�؞�f
|
2
|
+
JFQq�y��@(��!��g[�~�)s���Hnz5E�<��0�s*<#{�3HE��VB���e_5��o��O������1a'�Oٳ����d���P��d�["Xk ��,cDc���{,dˀ��)�k��2!7"���)�u��!�ħ��C*R�a��<L-���v�F�w �͜2�$6�z�����)�%Z0Ĵ@�U��
|
data/lib/tocer/identity.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Tocer
|
4
|
-
# Gem identity information.
|
5
|
-
module Identity
|
6
|
-
NAME = "tocer"
|
7
|
-
LABEL = "Tocer"
|
8
|
-
VERSION = "13.0.2"
|
9
|
-
VERSION_LABEL = "#{LABEL} #{VERSION}".freeze
|
10
|
-
SUMMARY = "A command line interface for generating table of contents for Markdown files."
|
11
|
-
end
|
12
|
-
end
|