gitt 3.8.1 → 3.10.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 +0 -0
- data/gitt.gemspec +3 -3
- data/lib/gitt/commands/log.rb +2 -2
- data/lib/gitt/commands/tag.rb +2 -1
- data/lib/gitt/models/commit.rb +1 -18
- data/lib/gitt/models/tag.rb +3 -0
- data/lib/gitt/parsers/tag.rb +19 -5
- data/lib/gitt/sanitizers/container.rb +1 -1
- data/lib/gitt/sanitizers/paragraphs.rb +45 -1
- data/lib/gitt/trailable.rb +24 -0
- data.tar.gz.sig +0 -0
- metadata +8 -7
- 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: 12f315a5c9312ef9c1d0523e1bd20ceeb16bc3a3a116b07d42c0e9059216c788
|
4
|
+
data.tar.gz: 95c0533edb84a4e44e3199d64145e053afce604a19c9b490ea5a47c998039f8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2499f6201d6b0d41a7be329a82972b3c80b032788f0e0ed9c7360a13b126a86e86064bb137fc332ec68cf6078e6aae699d22fb3999aa3279f29d049488540202
|
7
|
+
data.tar.gz: 10c9d7735ff3d8b4e85dd1e4aa341b461cf8609a5971fb7bcc1c60b57dacb368d5b331c84ba6715be0083e7e928701ebf25d22965d0ebab53088aa1eb10f5335
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/gitt.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "gitt"
|
5
|
-
spec.version = "3.
|
5
|
+
spec.version = "3.10.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/gitt"
|
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = ">= 3.3", "<= 3.4"
|
26
26
|
spec.add_dependency "core", "~> 1.7"
|
27
27
|
spec.add_dependency "dry-monads", "~> 1.6"
|
28
|
-
spec.add_dependency "refinements", "~> 12.
|
29
|
-
spec.add_dependency "zeitwerk", "~> 2.
|
28
|
+
spec.add_dependency "refinements", "~> 12.9"
|
29
|
+
spec.add_dependency "zeitwerk", "~> 2.7"
|
30
30
|
|
31
31
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
32
32
|
spec.files = Dir["*.gemspec", "lib/**/*"]
|
data/lib/gitt/commands/log.rb
CHANGED
@@ -58,8 +58,8 @@ module Gitt
|
|
58
58
|
attr_reader :shell, :key_map, :parser
|
59
59
|
|
60
60
|
def pretty_format
|
61
|
-
key_map.reduce("") { |
|
62
|
-
.then { |
|
61
|
+
key_map.reduce(+"") { |format, (key, value)| format << "<#{key}>#{value}</#{key}>%n" }
|
62
|
+
.then { |format| %(--pretty=format:"#{format}") }
|
63
63
|
end
|
64
64
|
|
65
65
|
def build_records entries
|
data/lib/gitt/commands/tag.rb
CHANGED
@@ -23,6 +23,7 @@ module Gitt
|
|
23
23
|
sha: "%(objectname)",
|
24
24
|
signature: "%(contents:signature)",
|
25
25
|
subject: "%(subject)",
|
26
|
+
trailers: "%(trailers)",
|
26
27
|
version: "%(refname)"
|
27
28
|
}.freeze
|
28
29
|
|
@@ -88,7 +89,7 @@ module Gitt
|
|
88
89
|
attr_reader :shell, :key_map, :parser
|
89
90
|
|
90
91
|
def pretty_format
|
91
|
-
key_map.reduce("") { |
|
92
|
+
key_map.reduce(+"") { |format, (key, value)| format << "<#{key}>#{value}</#{key}>%n" }
|
92
93
|
.then { |format| %(--format="#{format}") }
|
93
94
|
end
|
94
95
|
|
data/lib/gitt/models/commit.rb
CHANGED
@@ -32,30 +32,13 @@ module Gitt
|
|
32
32
|
:trailers
|
33
33
|
) do
|
34
34
|
include Directable
|
35
|
+
include Trailable
|
35
36
|
include Dry::Monads[:result]
|
36
37
|
|
37
38
|
def initialize(**)
|
38
39
|
super
|
39
40
|
freeze
|
40
41
|
end
|
41
|
-
|
42
|
-
def find_trailer key
|
43
|
-
trailers.find { |trailer| trailer.key == key }
|
44
|
-
.then do |trailer|
|
45
|
-
return Success trailer if trailer
|
46
|
-
|
47
|
-
Failure "Unable to find trailer for key: #{key.inspect}."
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def find_trailers key
|
52
|
-
trailers.select { |trailer| trailer.key == key }
|
53
|
-
.then { |trailers| Success trailers }
|
54
|
-
end
|
55
|
-
|
56
|
-
def trailer_value_for(key) = find_trailer(key).fmap(&:value)
|
57
|
-
|
58
|
-
def trailer_values_for(key) = find_trailers(key).fmap { |trailers| trailers.map(&:value) }
|
59
42
|
end
|
60
43
|
end
|
61
44
|
end
|
data/lib/gitt/models/tag.rb
CHANGED
data/lib/gitt/parsers/tag.rb
CHANGED
@@ -16,13 +16,16 @@ module Gitt
|
|
16
16
|
@model = model
|
17
17
|
end
|
18
18
|
|
19
|
+
# :reek:TooManyStatements
|
19
20
|
def call content
|
20
21
|
attributes = attributer.call content
|
21
|
-
attributes.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
body, trailers = attributes.values_at :body, :trailers
|
23
|
+
sanitize attributes
|
24
|
+
|
25
|
+
attributes[:body] = (
|
26
|
+
trailers ? body.sub(/\n??#{Regexp.escape trailers}\n??/, "") : body
|
27
|
+
).to_s.chomp
|
28
|
+
|
26
29
|
model[**attributes]
|
27
30
|
end
|
28
31
|
|
@@ -30,10 +33,21 @@ module Gitt
|
|
30
33
|
|
31
34
|
attr_reader :attributer, :sanitizers, :model
|
32
35
|
|
36
|
+
def sanitize attributes
|
37
|
+
attributes.transform_with! author_email: email_sanitizer,
|
38
|
+
authored_at: date_sanitizer,
|
39
|
+
committed_at: date_sanitizer,
|
40
|
+
committer_email: email_sanitizer,
|
41
|
+
trailers: trailers_sanitizer,
|
42
|
+
version: version_serializer
|
43
|
+
end
|
44
|
+
|
33
45
|
def date_sanitizer = sanitizers.fetch :date
|
34
46
|
|
35
47
|
def email_sanitizer = sanitizers.fetch :email
|
36
48
|
|
49
|
+
def trailers_sanitizer = sanitizers.fetch :trailers
|
50
|
+
|
37
51
|
def version_serializer = sanitizers.fetch :version
|
38
52
|
end
|
39
53
|
end
|
@@ -1,9 +1,53 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "core"
|
4
|
+
require "refinements/array"
|
5
|
+
require "strscan"
|
4
6
|
|
5
7
|
module Gitt
|
6
8
|
module Sanitizers
|
7
|
-
|
9
|
+
# Detects and parses paragraphs (including code blocks).
|
10
|
+
class Paragraphs
|
11
|
+
using Refinements::Array
|
12
|
+
|
13
|
+
PATTERN = /
|
14
|
+
( # Condition start.
|
15
|
+
(?:\..*?\n)? # Optional ASCII Doc label.
|
16
|
+
(?:\[.*\]\n)? # Optional ASCII Doc directive.
|
17
|
+
[-_=+\.\*]{4} # ASCII Doc block start.
|
18
|
+
[\s\S]*? # Lazy block content of any character.
|
19
|
+
[-_=+\.\*]{4} # ASCII Doc block end.
|
20
|
+
| # Or.
|
21
|
+
``` # Markdown start.
|
22
|
+
[\s\S]*? # Lazy block content of any character.
|
23
|
+
``` # Markdown end.
|
24
|
+
) # Condition end.
|
25
|
+
/mx
|
26
|
+
|
27
|
+
def initialize pattern: PATTERN, client: StringScanner
|
28
|
+
@pattern = pattern
|
29
|
+
@client = client
|
30
|
+
end
|
31
|
+
|
32
|
+
def call(text) = scan(client.new(text.to_s))
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :pattern, :client
|
37
|
+
|
38
|
+
# :reek:FeatureEnvy
|
39
|
+
def scan scanner, collection = []
|
40
|
+
until scanner.eos?
|
41
|
+
match = scanner.scan_until pattern
|
42
|
+
|
43
|
+
break collection << scanner.string[scanner.rest].tap(&:strip!).split("\n\n") unless match
|
44
|
+
|
45
|
+
collection << scanner.pre_match.strip
|
46
|
+
collection << scanner.captures
|
47
|
+
end
|
48
|
+
|
49
|
+
collection.tap(&:flatten!).tap(&:compress!)
|
50
|
+
end
|
51
|
+
end
|
8
52
|
end
|
9
53
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitt
|
4
|
+
# Provides shared behavior for objects that have trailers.
|
5
|
+
module Trailable
|
6
|
+
def find_trailer key
|
7
|
+
trailers.find { |trailer| trailer.key == key }
|
8
|
+
.then do |trailer|
|
9
|
+
return Success trailer if trailer
|
10
|
+
|
11
|
+
Failure "Unable to find trailer for key: #{key.inspect}."
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def find_trailers key
|
16
|
+
trailers.select { |trailer| trailer.key == key }
|
17
|
+
.then { |trailers| Success trailers }
|
18
|
+
end
|
19
|
+
|
20
|
+
def trailer_value_for(key) = find_trailer(key).fmap(&:value)
|
21
|
+
|
22
|
+
def trailer_values_for(key) = find_trailers(key).fmap { |trailers| trailers.map(&:value) }
|
23
|
+
end
|
24
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.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-
|
38
|
+
date: 2024-10-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: core
|
@@ -71,28 +71,28 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '12.
|
74
|
+
version: '12.9'
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '12.
|
81
|
+
version: '12.9'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: zeitwerk
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '2.
|
88
|
+
version: '2.7'
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '2.
|
95
|
+
version: '2.7'
|
96
96
|
description:
|
97
97
|
email:
|
98
98
|
- brooke@alchemists.io
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- lib/gitt/sanitizers/trailers.rb
|
136
136
|
- lib/gitt/sanitizers/version.rb
|
137
137
|
- lib/gitt/shell.rb
|
138
|
+
- lib/gitt/trailable.rb
|
138
139
|
homepage: https://alchemists.io/projects/gitt
|
139
140
|
licenses:
|
140
141
|
- Hippocratic-2.1
|
@@ -164,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
165
|
- !ruby/object:Gem::Version
|
165
166
|
version: '0'
|
166
167
|
requirements: []
|
167
|
-
rubygems_version: 3.5.
|
168
|
+
rubygems_version: 3.5.21
|
168
169
|
signing_key:
|
169
170
|
specification_version: 4
|
170
171
|
summary: A monadic Object API for the Git CLI.
|
metadata.gz.sig
CHANGED
Binary file
|