gitt 3.8.0 → 3.8.1

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: 72a1ef8d6a3caccc88017da2ee4a6f639c9851c8dc6c9ee2ef8510fe83130718
4
- data.tar.gz: 418b7d5e9ac48472cc9112ec031ab7d10e6ca04e0e1503dbe42b65c9a9c50d6f
3
+ metadata.gz: 011f24d793d2565425982cb6eeb0d8efc3a9f954590bf86750495c6b97792873
4
+ data.tar.gz: ee9f64d17e334f1aa6827c085fb1059b453209f4b5397e7ac400e598de18960e
5
5
  SHA512:
6
- metadata.gz: 4637a417134c91608e031acc5d10cb4594b3db50253a2b5fdd059ee505dd67f43f34e685f0df656f8fd524449053adebb38e19e882ec1349cc667e2cdf323f53
7
- data.tar.gz: a2f821d2cf5757e6c373855c5695452890589e701def37dde9b892958b8f5708c85e4f232bd4ad30f888c9eb4810e0d31307cb193ca7b9c6d08a9866c9c02797
6
+ metadata.gz: efe9288bf28a4eac998226055f15bf1ddedeae39dbf4e95c77a6da23faedcd9a3c3b88d8a29db5d7cde1f60273e1bce6c6c2e0d0734964d14e520790b8463d0f
7
+ data.tar.gz: '089f62916bc44d0634f408a111163bda264a13ad236ce8156484c096e5d595deae0b2c14466885d084647a3ac23d50a8005546e8f75b1d2847fd4b7239d2dcb5'
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.8.0"
5
+ spec.version = "3.8.1"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/gitt"
@@ -70,15 +70,16 @@ module Gitt
70
70
 
71
71
  # :reek:UtilityFunction
72
72
  def wrap_statistics entries
73
- entries.gsub!(/\d+\sfile.+\d+\s(insertion|deletion).+\n/) do |match|
74
- "<statistics>#{match}</statistics><break/>"
73
+ entries.gsub!(/\n"\n\s\d+\sfile.+\d+\s(insertion|deletion).+\n/) do |match|
74
+ match.delete_prefix!("\n\"\n").strip!
75
+ "\n<statistics>#{match}</statistics>\n<break/>"
75
76
  end
76
77
  end
77
78
 
78
79
  # :reek:UtilityFunction
79
80
  def add_empty_statistics entries
80
81
  entries.gsub! %(</trailers>\n"\n"<author_email>),
81
- "</trailers>\n<statistics></statistics>\n<author_email>"
82
+ "</trailers>\n<statistics></statistics><break/>\n<author_email>"
82
83
  end
83
84
  end
84
85
  end
@@ -18,7 +18,7 @@ module Gitt
18
18
 
19
19
  def call content
20
20
  attributer.call(content)
21
- .then { |attributes| process attributes }
21
+ .then { |attributes| mutate attributes }
22
22
  .then { |attributes| model[**attributes] }
23
23
  end
24
24
 
@@ -27,7 +27,7 @@ module Gitt
27
27
  attr_reader :attributer, :sanitizers, :model
28
28
 
29
29
  # :reek:TooManyStatements
30
- def process attributes
30
+ def mutate attributes
31
31
  body, trailers = attributes.values_at :body, :trailers
32
32
  body = scissors_sanitizer.call body
33
33
 
@@ -4,7 +4,6 @@ require "core"
4
4
 
5
5
  module Gitt
6
6
  # Primary object/wrapper for processing all Git related commands.
7
- # :reek:TooManyMethods
8
7
  class Repository
9
8
  COMMANDS = {
10
9
  branch: Commands::Branch,
@@ -34,6 +33,11 @@ module Gitt
34
33
 
35
34
  def get(...) = commands.fetch(:config).get(...)
36
35
 
36
+ def inspect
37
+ "#<#{self.class}:#{object_id} @shell=#{shell.inspect} " \
38
+ "@commands=#{commands.values.map(&:class).inspect}>"
39
+ end
40
+
37
41
  def log(...) = commands.fetch(__method__).call(...)
38
42
 
39
43
  def origin? = commands.fetch(:config).origin?
@@ -12,24 +12,25 @@ module Gitt
12
12
  (?<kind>file|insertion|deletion) # Kind capture group.
13
13
  /x
14
14
 
15
+ def self.update_stats attributes, kind, total
16
+ case kind
17
+ when "file" then attributes[:files_changed] = total
18
+ when "insertion" then attributes[:insertions] = total
19
+ when "deletion" then attributes[:deletions] = total
20
+ else fail StandardError, "Invalid kind: #{kind.inspect}."
21
+ end
22
+ end
23
+
15
24
  def initialize empty: EMPTY, pattern: PATTERN
16
25
  @empty = empty
17
26
  @pattern = pattern
18
27
  end
19
28
 
20
- # :reek:TooManyStatements
21
29
  def call text
22
30
  return empty unless text
23
31
 
24
- text.scan(pattern).each.with_object(empty.dup) do |(number, kind), stats|
25
- total = number.to_i
26
-
27
- case kind
28
- when "file" then stats[:files_changed] = total
29
- when "insertion" then stats[:insertions] = total
30
- when "deletion" then stats[:deletions] = total
31
- # :nocov:
32
- end
32
+ text.scan(pattern).each.with_object(empty.dup) do |(number, kind), aggregate|
33
+ self.class.update_stats aggregate, kind, number.to_i
33
34
  end
34
35
  end
35
36
 
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.8.0
4
+ version: 3.8.1
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-09-01 00:00:00.000000000 Z
38
+ date: 2024-09-04 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: core
metadata.gz.sig CHANGED
Binary file