gitt 3.1.0 → 3.2.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 +1 -1
- data/lib/gitt/parsers/commit.rb +8 -7
- data/lib/gitt/parsers/tag.rb +5 -3
- data/lib/gitt/parsers/trailer.rb +13 -9
- data/lib/gitt/sanitizers/container.rb +2 -1
- data/lib/gitt/sanitizers/date.rb +1 -1
- data/lib/gitt/sanitizers/email.rb +1 -1
- data/lib/gitt/sanitizers/lines.rb +1 -1
- data/lib/gitt/sanitizers/paragraphs.rb +1 -1
- data/lib/gitt/sanitizers/scissors.rb +1 -1
- data/lib/gitt/sanitizers/signature.rb +2 -2
- data/lib/gitt/sanitizers/trailers.rb +4 -4
- data/lib/gitt/sanitizers/version.rb +9 -0
- data.tar.gz.sig +0 -0
- metadata +3 -2
- 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: 20dc8c5e5078ccaa451f83b7d4795c3e07e76176ba55a2da4e5f24814b64f611
|
4
|
+
data.tar.gz: 6dc1a7560a6fb5f608108eea640eb743147b7614d3bf3f8ff82e2f0723963373
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 060f9c502e3cab68218e3eb51c882bb12277709f27f1d9c1bce001f6b8330d2e2814ad2dc080c287cd75884868386ec96bf980ea4442b88eb5fa3c391a44a76b
|
7
|
+
data.tar.gz: 595164979089c252301be01406343faa142a46b3f1c39d45f609206719863d7282cc9454c2e585bf06a1f00ddbd2b26a8b0940a0be8e818fa89c1f188798b8ed
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/gitt.gemspec
CHANGED
data/lib/gitt/parsers/commit.rb
CHANGED
@@ -4,7 +4,7 @@ require "refinements/hash"
|
|
4
4
|
|
5
5
|
module Gitt
|
6
6
|
module Parsers
|
7
|
-
# Parses raw commit
|
7
|
+
# Parses raw commit to produce a commit record.
|
8
8
|
class Commit
|
9
9
|
using Refinements::Hash
|
10
10
|
|
@@ -16,14 +16,11 @@ module Gitt
|
|
16
16
|
@model = model
|
17
17
|
end
|
18
18
|
|
19
|
-
# rubocop:todo Layout/LineLength
|
20
19
|
def call content
|
21
20
|
attributer.call(content)
|
22
21
|
.then { |attributes| process attributes }
|
23
|
-
.then { |attributes| attributes.merge! statistic_sanitizer.call(attributes.delete(:statistics)) }
|
24
22
|
.then { |attributes| model[**attributes] }
|
25
23
|
end
|
26
|
-
# rubocop:enable Layout/LineLength
|
27
24
|
|
28
25
|
private
|
29
26
|
|
@@ -32,10 +29,9 @@ module Gitt
|
|
32
29
|
# :reek:TooManyStatements
|
33
30
|
def process attributes
|
34
31
|
body, trailers = attributes.values_at :body, :trailers
|
32
|
+
body = scissors_sanitizer.call body
|
35
33
|
|
36
|
-
attributes.transform_with!
|
37
|
-
signature: signature_sanitizer,
|
38
|
-
trailers: trailers_sanitizer
|
34
|
+
attributes.transform_with! signature: signature_sanitizer, trailers: trailers_sanitizer
|
39
35
|
|
40
36
|
attributes[:body] =
|
41
37
|
(trailers ? body.sub(/\n??#{Regexp.escape trailers}\n??/, "") : body).chomp
|
@@ -59,6 +55,11 @@ module Gitt
|
|
59
55
|
attributes[:lines] = lines_sanitizer.call attributes[:raw]
|
60
56
|
end
|
61
57
|
|
58
|
+
# :reek:FeatureEnvy
|
59
|
+
def process_statistics attributes
|
60
|
+
attributes.merge! statistic_sanitizer.call(attributes.delete(:statistics))
|
61
|
+
end
|
62
|
+
|
62
63
|
def lines_sanitizer = sanitizers.fetch :lines
|
63
64
|
|
64
65
|
def paragraphs_sanitizer = sanitizers.fetch :paragraphs
|
data/lib/gitt/parsers/tag.rb
CHANGED
@@ -22,7 +22,7 @@ module Gitt
|
|
22
22
|
authored_at: date_sanitizer,
|
23
23
|
committed_at: date_sanitizer,
|
24
24
|
committer_email: email_sanitizer,
|
25
|
-
version:
|
25
|
+
version: version_serializer
|
26
26
|
model[**attributes]
|
27
27
|
end
|
28
28
|
|
@@ -30,9 +30,11 @@ module Gitt
|
|
30
30
|
|
31
31
|
attr_reader :attributer, :sanitizers, :model
|
32
32
|
|
33
|
-
def date_sanitizer = sanitizers.fetch
|
33
|
+
def date_sanitizer = sanitizers.fetch :date
|
34
34
|
|
35
|
-
def email_sanitizer = sanitizers.fetch
|
35
|
+
def email_sanitizer = sanitizers.fetch :email
|
36
|
+
|
37
|
+
def version_serializer = sanitizers.fetch :version
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
data/lib/gitt/parsers/trailer.rb
CHANGED
@@ -5,23 +5,27 @@ module Gitt
|
|
5
5
|
# Parses raw trailer data to produce a trailer record.
|
6
6
|
class Trailer
|
7
7
|
PATTERN = /
|
8
|
-
|
9
|
-
(?<
|
10
|
-
(?<
|
11
|
-
(?<
|
12
|
-
|
8
|
+
\A # Start of line.
|
9
|
+
(?<key>.+) # Key.
|
10
|
+
(?<delimiter>:) # Colon delimiter.
|
11
|
+
(?<space>\s?) # Space (optional).
|
12
|
+
(?<value>.*?) # Value.
|
13
|
+
\Z # End of line.
|
13
14
|
/x
|
14
15
|
|
15
|
-
|
16
|
+
EMPTY = Models::Trailer[key: nil, value: nil]
|
17
|
+
|
18
|
+
def initialize pattern: PATTERN, model: Models::Trailer, empty: EMPTY
|
16
19
|
@pattern = pattern
|
17
20
|
@model = model
|
18
|
-
@empty =
|
21
|
+
@empty = empty
|
19
22
|
end
|
20
23
|
|
21
24
|
def call content
|
25
|
+
return empty if content.start_with? "#"
|
26
|
+
|
22
27
|
content.match(pattern)
|
23
|
-
.then { |data| data ? data.named_captures(symbolize_names: true) : empty }
|
24
|
-
.then { |attributes| model[**attributes] }
|
28
|
+
.then { |data| data ? model[**data.named_captures(symbolize_names: true)] : empty }
|
25
29
|
end
|
26
30
|
|
27
31
|
private
|
data/lib/gitt/sanitizers/date.rb
CHANGED
@@ -8,10 +8,10 @@ module Gitt
|
|
8
8
|
@parser = parser
|
9
9
|
end
|
10
10
|
|
11
|
-
def call
|
12
|
-
String(
|
13
|
-
|
14
|
-
|
11
|
+
def call text
|
12
|
+
String(text).split("\n")
|
13
|
+
.map { |line| parser.call line }
|
14
|
+
.reject(&:empty?)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
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.2.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-03-03 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: core
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/gitt/sanitizers/signature.rb
|
134
134
|
- lib/gitt/sanitizers/statistic.rb
|
135
135
|
- lib/gitt/sanitizers/trailers.rb
|
136
|
+
- lib/gitt/sanitizers/version.rb
|
136
137
|
- lib/gitt/shell.rb
|
137
138
|
homepage: https://alchemists.io/projects/gitt
|
138
139
|
licenses:
|
metadata.gz.sig
CHANGED
Binary file
|