gitt 3.1.1 → 3.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb7ec3501848841e8cf7107ae8ae9823b5e28aa04c5815ddf7a82357621a09ec
4
- data.tar.gz: 4d88f589085bcd04af260b5231d12dd7e9b0121a311ee3d8788a7320eac32d09
3
+ metadata.gz: 20dc8c5e5078ccaa451f83b7d4795c3e07e76176ba55a2da4e5f24814b64f611
4
+ data.tar.gz: 6dc1a7560a6fb5f608108eea640eb743147b7614d3bf3f8ff82e2f0723963373
5
5
  SHA512:
6
- metadata.gz: 8beec7a750f4072983d768ea4bf4c306841660227c58848f2b2f99c5e35a0429d2c9dc3e8d2f5cbde5acfe9bfce6c73349d8877b17d5caa4e02df7a8e2cf399a
7
- data.tar.gz: f058ef5e0878efc62b8125f91706d1f6bf75c66283b19b9ce4112183b74125fc18f7b3f658661993b4b0b88ffed108060e9579fb944cb6432c7e103dce61862c
6
+ metadata.gz: 060f9c502e3cab68218e3eb51c882bb12277709f27f1d9c1bce001f6b8330d2e2814ad2dc080c287cd75884868386ec96bf980ea4442b88eb5fa3c391a44a76b
7
+ data.tar.gz: 595164979089c252301be01406343faa142a46b3f1c39d45f609206719863d7282cc9454c2e585bf06a1f00ddbd2b26a8b0940a0be8e818fa89c1f188798b8ed
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.1.1"
5
+ spec.version = "3.2.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/gitt"
@@ -4,7 +4,7 @@ require "refinements/hash"
4
4
 
5
5
  module Gitt
6
6
  module Parsers
7
- # Parses raw commit information to produce a commit record.
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! body: scissors_sanitizer,
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
@@ -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: -> value { value.delete_prefix "refs/tags/" if value }
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(:date)
33
+ def date_sanitizer = sanitizers.fetch :date
34
34
 
35
- def email_sanitizer = sanitizers.fetch(:email)
35
+ def email_sanitizer = sanitizers.fetch :email
36
+
37
+ def version_serializer = sanitizers.fetch :version
36
38
  end
37
39
  end
38
40
  end
@@ -10,7 +10,8 @@ module Gitt
10
10
  scissors: Scissors,
11
11
  signature: Signature,
12
12
  statistic: Statistic.new,
13
- trailers: Trailers.new
13
+ trailers: Trailers.new,
14
+ version: Version
14
15
  }.freeze
15
16
  end
16
17
  end
@@ -4,6 +4,6 @@ require "core"
4
4
 
5
5
  module Gitt
6
6
  module Sanitizers
7
- Date = -> value { value.sub(/\s.+\Z/, Core::EMPTY_STRING) if value }
7
+ Date = -> text { text.sub(/\s.+\Z/, Core::EMPTY_STRING) if text }
8
8
  end
9
9
  end
@@ -4,6 +4,6 @@ require "core"
4
4
 
5
5
  module Gitt
6
6
  module Sanitizers
7
- Email = -> value { value.tr "<>", Core::EMPTY_STRING if value }
7
+ Email = -> text { text.tr "<>", Core::EMPTY_STRING if text }
8
8
  end
9
9
  end
@@ -4,6 +4,6 @@ require "core"
4
4
 
5
5
  module Gitt
6
6
  module Sanitizers
7
- Lines = -> value { value ? value.split("\n") : Core::EMPTY_ARRAY }
7
+ Lines = -> text { text ? text.split("\n") : Core::EMPTY_ARRAY }
8
8
  end
9
9
  end
@@ -4,6 +4,6 @@ require "core"
4
4
 
5
5
  module Gitt
6
6
  module Sanitizers
7
- Paragraphs = -> value { value ? value.split("\n\n").map(&:chomp) : Core::EMPTY_ARRAY }
7
+ Paragraphs = -> text { text ? text.split("\n\n").map(&:chomp) : Core::EMPTY_ARRAY }
8
8
  end
9
9
  end
@@ -4,6 +4,6 @@ require "core"
4
4
 
5
5
  module Gitt
6
6
  module Sanitizers
7
- Scissors = -> value { value.sub(/^#\s-.+\s>8\s-.+/m, Core::EMPTY_STRING) if value }
7
+ Scissors = -> text { text.sub(/^#\s-.+\s>8\s-.+/m, Core::EMPTY_STRING) if text }
8
8
  end
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Gitt
4
4
  module Sanitizers
5
- Signature = lambda do |value|
6
- case value
5
+ Signature = lambda do |text|
6
+ case text
7
7
  when "B" then "Bad"
8
8
  when "E" then "Error"
9
9
  when "G" then "Good"
@@ -8,10 +8,10 @@ module Gitt
8
8
  @parser = parser
9
9
  end
10
10
 
11
- def call value
12
- String(value).split("\n")
13
- .map { |text| parser.call text }
14
- .reject(&:empty?)
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
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "core"
4
+
5
+ module Gitt
6
+ module Sanitizers
7
+ Version = -> text { text.delete_prefix "refs/tags/" if text }
8
+ end
9
+ 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.1.1
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-02-18 00:00:00.000000000 Z
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