gitt 3.1.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb7ec3501848841e8cf7107ae8ae9823b5e28aa04c5815ddf7a82357621a09ec
4
- data.tar.gz: 4d88f589085bcd04af260b5231d12dd7e9b0121a311ee3d8788a7320eac32d09
3
+ metadata.gz: 5d4831c7aebb2ababde79c21e8a32d55a6d3db7da01bf16140c4a5b96477250c
4
+ data.tar.gz: 4ccab61c3639101d924b7beef4be9b4e7ddcbcda43a29d08fe5dd022bb3f426c
5
5
  SHA512:
6
- metadata.gz: 8beec7a750f4072983d768ea4bf4c306841660227c58848f2b2f99c5e35a0429d2c9dc3e8d2f5cbde5acfe9bfce6c73349d8877b17d5caa4e02df7a8e2cf399a
7
- data.tar.gz: f058ef5e0878efc62b8125f91706d1f6bf75c66283b19b9ce4112183b74125fc18f7b3f658661993b4b0b88ffed108060e9579fb944cb6432c7e103dce61862c
6
+ metadata.gz: 1da9361512f66cd9c597e3d53a1d33a926ec891eb65212c98eaa04f6bcb2581df4f65a47da15436d7e6f2f8ff32cfe0d2dd6acf5c7134e0ebe186ef42d1ed56f
7
+ data.tar.gz: dd84ed45b157da1e0ae49ff5cc89ebcda9d35bc444e0f94479439d26643fd49ce1b3b4d7118f50c487edb368cbccec57e740d1ba51d1e4b39e712013b2781926
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.3.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/gitt"
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = "~> 3.3"
26
26
  spec.add_dependency "core", "~> 1.0"
27
27
  spec.add_dependency "dry-monads", "~> 1.6"
28
- spec.add_dependency "refinements", "~> 12.0"
28
+ spec.add_dependency "refinements", "~> 12.1"
29
29
  spec.add_dependency "zeitwerk", "~> 2.6"
30
30
 
31
31
  spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
@@ -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.3.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-04-01 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: core
@@ -71,14 +71,14 @@ dependencies:
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '12.0'
74
+ version: '12.1'
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.0'
81
+ version: '12.1'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: zeitwerk
84
84
  requirement: !ruby/object:Gem::Requirement
@@ -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:
@@ -160,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
161
  - !ruby/object:Gem::Version
161
162
  version: '0'
162
163
  requirements: []
163
- rubygems_version: 3.5.6
164
+ rubygems_version: 3.5.7
164
165
  signing_key:
165
166
  specification_version: 4
166
167
  summary: A monadic Object API for the Git CLI.
metadata.gz.sig CHANGED
Binary file