gitt 3.12.1 → 4.1.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +48 -25
- data/gitt.gemspec +4 -4
- data/lib/gitt/commands/branch.rb +4 -4
- data/lib/gitt/commands/config.rb +6 -5
- data/lib/gitt/commands/log.rb +3 -3
- data/lib/gitt/commands/tag.rb +21 -8
- data/lib/gitt/parsers/commit.rb +2 -2
- data/lib/gitt/repository.rb +7 -3
- data/lib/gitt/rspec/shared_contexts/git_repo.rb +1 -1
- data/lib/gitt/rspec/shared_contexts/git_tag.rb +22 -0
- data/lib/gitt/rspec/shared_contexts/temp_dir.rb +2 -4
- data/lib/gitt/sanitizers/container.rb +1 -1
- data/lib/gitt/sanitizers/{statistic.rb → statistics.rb} +8 -8
- data/lib/gitt/shell.rb +4 -2
- data.tar.gz.sig +0 -0
- metadata +10 -16
- 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: 8fbec0bde106e2f9fc5f6a0e24ae9eeeb074fb91302984a3fbc29eccde828499
         | 
| 4 | 
            +
              data.tar.gz: 56fb1a05bf0a206ad67ce3d6d908b5bb72dfc0d65a9ee90d7552ca8b258663bc
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 556cafdb7dfaf50dbc4b2238326e2e3cd7a5f7d145127c3775bca51752bc3afa04bbf13489396d7a3b1d8060e588423c402205b9eb4b7f2a38ff1f11f21df78d
         | 
| 7 | 
            +
              data.tar.gz: 49ab793068b0447402e43fac302cd881d4b120d18189fa51230fc0b1d90ac11fcafb3838f910a3882c14c98b463deac9f5c72d5a4834516e81f12ff385150d83
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/README.adoc
    CHANGED
    
    | @@ -23,7 +23,7 @@ toc::[] | |
| 23 23 |  | 
| 24 24 | 
             
            == Features
         | 
| 25 25 |  | 
| 26 | 
            -
            * Wraps  | 
| 26 | 
            +
            * Wraps native {git_link} commands with additional enhancements to improve your working experience.
         | 
| 27 27 | 
             
            * Answers link:https://dry-rb.org/gems/dry-monads[monads] you can link:https://alchemists.io/articles/ruby_function_composition[pipe] together for more complex workflows.
         | 
| 28 28 | 
             
            * Provides _optional_ {rspec_link} shared contexts that speed up the testing of your own Git related implementations.
         | 
| 29 29 |  | 
| @@ -49,30 +49,34 @@ At a high level, this project provides a centralized Object API via a single obj | |
| 49 49 | 
             
            ----
         | 
| 50 50 | 
             
            git = Gitt.new
         | 
| 51 51 |  | 
| 52 | 
            -
            git.branch | 
| 53 | 
            -
            git.branch_default | 
| 54 | 
            -
            git.branch_name | 
| 55 | 
            -
            git.call | 
| 56 | 
            -
            git.commits | 
| 57 | 
            -
            git.config | 
| 58 | 
            -
            git.exist? | 
| 59 | 
            -
            git.get | 
| 60 | 
            -
            git.inspect | 
| 61 | 
            -
            git.log | 
| 62 | 
            -
            git.origin? | 
| 63 | 
            -
            git.set | 
| 64 | 
            -
            git.tag | 
| 65 | 
            -
            git.tags | 
| 66 | 
            -
            git.tag? | 
| 67 | 
            -
            git.tag_create | 
| 68 | 
            -
            git. | 
| 69 | 
            -
            git. | 
| 70 | 
            -
            git. | 
| 71 | 
            -
            git. | 
| 72 | 
            -
            git. | 
| 73 | 
            -
            git. | 
| 74 | 
            -
            git. | 
| 75 | 
            -
             | 
| 52 | 
            +
            git.branch             # Equivalent to `git branch <arguments>`.
         | 
| 53 | 
            +
            git.branch_default     # Answers default branch.
         | 
| 54 | 
            +
            git.branch_name        # Answers current branch.
         | 
| 55 | 
            +
            git.call               # Allows you to run any Git command.
         | 
| 56 | 
            +
            git.commits            # Answers enhanced commit records.
         | 
| 57 | 
            +
            git.config             # Equivalent to `git config <arguments>`.
         | 
| 58 | 
            +
            git.exist?             # Answers if current directory is a Git repository or not.
         | 
| 59 | 
            +
            git.get                # Equivalent to `git config get`.
         | 
| 60 | 
            +
            git.inspect            # Allows you to inspect the current instance.
         | 
| 61 | 
            +
            git.log                # Equivalent to `git log <arguments>`.
         | 
| 62 | 
            +
            git.origin?            # Answers if repository has an origin or not.
         | 
| 63 | 
            +
            git.set                # Equivalent to `get config set`.
         | 
| 64 | 
            +
            git.tag                # Equivalent to `git tag <arguments>`.
         | 
| 65 | 
            +
            git.tags               # Answers enhanced tag records.
         | 
| 66 | 
            +
            git.tag?               # Answers if local or remote tag exists.
         | 
| 67 | 
            +
            git.tag_create         # Create a new tag.
         | 
| 68 | 
            +
            git.tag_delete_local   # Deletes local tag.
         | 
| 69 | 
            +
            git.tag_delete_remote  # Deletes remote tag.
         | 
| 70 | 
            +
            git.tag_last           # Answers last tag created.
         | 
| 71 | 
            +
            git.tag_local?         # Answers if local tag exists?
         | 
| 72 | 
            +
            git.tag_remote?        # Answers if remote tag exists?
         | 
| 73 | 
            +
            git.tag_show           # Answers information about a single tag.
         | 
| 74 | 
            +
            git.tagged?            # Answers if the repository has any tags.
         | 
| 75 | 
            +
            git.tags_push          # Pushes local tags to remote git.
         | 
| 76 | 
            +
            git.uncommitted        # Parses `COMMIT_EDITMSG` file and answers the unsaved commit message.
         | 
| 77 | 
            +
            ----
         | 
| 78 | 
            +
             | 
| 79 | 
            +
            💡 In general, the above (and individual commands below) support link:https://docs.ruby-lang.org/en/master/Process.html#method-c-spawn[Process#spawn] arguments where you can provide environment, command, arguments, and options (hash). Example: `git.tag({"GIT_COMMITTER_DATE" => "2025-01-01 20:00:00"}, "0.0.0", chdir: "path/to/repo")` This allows you to perform advanced operations where you might need to supply environment variables or options like changing directory (as shown in the example). Check the method signatures to learn more.
         | 
| 76 80 |  | 
| 77 81 | 
             
            === Commands
         | 
| 78 82 |  | 
| @@ -165,6 +169,12 @@ stdout, stderr, status = tag.call | |
| 165 169 | 
             
            # Creates a new tag.
         | 
| 166 170 | 
             
            tag.create "0.0.0", "Version 0.0.0"
         | 
| 167 171 |  | 
| 172 | 
            +
            # Deletes local tag.
         | 
| 173 | 
            +
            tag.delete_local "0.0.0"
         | 
| 174 | 
            +
             | 
| 175 | 
            +
            # Deletes remote tag.
         | 
| 176 | 
            +
            tag.delete_remote "0.0.0"
         | 
| 177 | 
            +
             | 
| 168 178 | 
             
            # Answers true or false base on whether local and remote tag exist.
         | 
| 169 179 | 
             
            tag.exist? "0.1.0"
         | 
| 170 180 |  | 
| @@ -331,6 +341,19 @@ describe Demo do | |
| 331 341 | 
             
            end
         | 
| 332 342 | 
             
            ----
         | 
| 333 343 |  | 
| 344 | 
            +
            ==== Git Tag
         | 
| 345 | 
            +
             | 
| 346 | 
            +
            Provides a default `git_tag` record of `Gitt::Models::Tag` with minimal information for testing purposes and can be used as follows:
         | 
| 347 | 
            +
             | 
| 348 | 
            +
            [source,ruby]
         | 
| 349 | 
            +
            ----
         | 
| 350 | 
            +
            require "gitt/rspec/shared_contexts/git_tag"
         | 
| 351 | 
            +
             | 
| 352 | 
            +
            describe Demo do
         | 
| 353 | 
            +
              include_context "with Git tag"
         | 
| 354 | 
            +
            end
         | 
| 355 | 
            +
            ----
         | 
| 356 | 
            +
             | 
| 334 357 | 
             
            ==== Git Repository
         | 
| 335 358 |  | 
| 336 359 | 
             
            Provides a simple Git repository with a single commit for testing purposes. This repository is set up and torn down _around_ each spec. The repository is built within your project's `tmp` directory and provides a `git_repo_dir` pathname you can interact with. Here's how to use it:
         | 
    
        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 = " | 
| 5 | 
            +
              spec.version = "4.1.0"
         | 
| 6 6 | 
             
              spec.authors = ["Brooke Kuhlmann"]
         | 
| 7 7 | 
             
              spec.email = ["brooke@alchemists.io"]
         | 
| 8 8 | 
             
              spec.homepage = "https://alchemists.io/projects/gitt"
         | 
| @@ -22,10 +22,10 @@ Gem::Specification.new do |spec| | |
| 22 22 | 
             
              spec.signing_key = Gem.default_key_path
         | 
| 23 23 | 
             
              spec.cert_chain = [Gem.default_cert_path]
         | 
| 24 24 |  | 
| 25 | 
            -
              spec.required_ruby_version = " | 
| 26 | 
            -
              spec.add_dependency "core", "~>  | 
| 25 | 
            +
              spec.required_ruby_version = "~> 3.4"
         | 
| 26 | 
            +
              spec.add_dependency "core", "~> 2.0"
         | 
| 27 27 | 
             
              spec.add_dependency "dry-monads", "~> 1.6"
         | 
| 28 | 
            -
              spec.add_dependency "refinements", "~>  | 
| 28 | 
            +
              spec.add_dependency "refinements", "~> 13.0"
         | 
| 29 29 | 
             
              spec.add_dependency "zeitwerk", "~> 2.7"
         | 
| 30 30 |  | 
| 31 31 | 
             
              spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
         | 
    
        data/lib/gitt/commands/branch.rb
    CHANGED
    
    | @@ -12,16 +12,16 @@ module Gitt | |
| 12 12 | 
             
                    @shell = shell
         | 
| 13 13 | 
             
                  end
         | 
| 14 14 |  | 
| 15 | 
            -
                  def default | 
| 16 | 
            -
                    shell.call("config", "init.defaultBranch")
         | 
| 15 | 
            +
                  def default(fallback = "main", *, **)
         | 
| 16 | 
            +
                    shell.call("config", "init.defaultBranch", *, **)
         | 
| 17 17 | 
             
                         .fmap(&:chomp)
         | 
| 18 18 | 
             
                         .fmap { |name| name.empty? ? fallback : name }
         | 
| 19 19 | 
             
                         .or(Success(fallback))
         | 
| 20 20 | 
             
                  end
         | 
| 21 21 |  | 
| 22 | 
            -
                  def call( | 
| 22 | 
            +
                  def call(*, **) = shell.call("branch", *, **)
         | 
| 23 23 |  | 
| 24 | 
            -
                  def name = shell.call("rev-parse", "--abbrev-ref", "HEAD").fmap(&:chomp)
         | 
| 24 | 
            +
                  def name(*, **) = shell.call("rev-parse", "--abbrev-ref", "HEAD", *, **).fmap(&:chomp)
         | 
| 25 25 |  | 
| 26 26 | 
             
                  private
         | 
| 27 27 |  | 
    
        data/lib/gitt/commands/config.rb
    CHANGED
    
    | @@ -13,16 +13,17 @@ module Gitt | |
| 13 13 | 
             
                    @shell = shell
         | 
| 14 14 | 
             
                  end
         | 
| 15 15 |  | 
| 16 | 
            -
                  def call( | 
| 16 | 
            +
                  def call(*, **) = shell.call("config", *, **)
         | 
| 17 17 |  | 
| 18 | 
            -
                  def get(key, fallback = Core::EMPTY_STRING,  | 
| 19 | 
            -
                    call( | 
| 20 | 
            -
             | 
| 18 | 
            +
                  def get(key, fallback = Core::EMPTY_STRING, *, **)
         | 
| 19 | 
            +
                    shell.call("config", "--get", key, *, **)
         | 
| 20 | 
            +
                         .fmap(&:chomp)
         | 
| 21 | 
            +
                         .or { |error| block_given? ? yield(error) : Success(fallback) }
         | 
| 21 22 | 
             
                  end
         | 
| 22 23 |  | 
| 23 24 | 
             
                  def origin? = !get("remote.origin.url").value_or(Core::EMPTY_STRING).empty?
         | 
| 24 25 |  | 
| 25 | 
            -
                  def set(key, value,  | 
| 26 | 
            +
                  def set(key, value, *, **) = shell.call("config", "--add", key, value, *, **).fmap { value }
         | 
| 26 27 |  | 
| 27 28 | 
             
                  private
         | 
| 28 29 |  | 
    
        data/lib/gitt/commands/log.rb
    CHANGED
    
    | @@ -35,11 +35,11 @@ module Gitt | |
| 35 35 | 
             
                    @parser = parser
         | 
| 36 36 | 
             
                  end
         | 
| 37 37 |  | 
| 38 | 
            -
                  def call( | 
| 38 | 
            +
                  def call(*, **) = shell.call("log", *, **)
         | 
| 39 39 |  | 
| 40 | 
            -
                  def index | 
| 40 | 
            +
                  def index(*arguments, **)
         | 
| 41 41 | 
             
                    arguments.prepend("--shortstat", pretty_format)
         | 
| 42 | 
            -
                             .then { |pretty_format| call(*pretty_format) }
         | 
| 42 | 
            +
                             .then { |pretty_format| call(*pretty_format, **) }
         | 
| 43 43 | 
             
                             .fmap { |content| String(content).scrub("?") }
         | 
| 44 44 | 
             
                             .fmap { |entries| build_records entries }
         | 
| 45 45 | 
             
                  end
         | 
    
        data/lib/gitt/commands/tag.rb
    CHANGED
    
    | @@ -33,7 +33,7 @@ module Gitt | |
| 33 33 | 
             
                    @parser = parser
         | 
| 34 34 | 
             
                  end
         | 
| 35 35 |  | 
| 36 | 
            -
                  def call( | 
| 36 | 
            +
                  def call(*, **) = shell.call("tag", *, **)
         | 
| 37 37 |  | 
| 38 38 | 
             
                  def create version, body = Core::EMPTY_STRING, *flags
         | 
| 39 39 | 
             
                    return Failure "Unable to create Git tag without version." unless version
         | 
| @@ -45,17 +45,30 @@ module Gitt | |
| 45 45 | 
             
                    end
         | 
| 46 46 | 
             
                  end
         | 
| 47 47 |  | 
| 48 | 
            +
                  def delete_local(version, *, **)
         | 
| 49 | 
            +
                    call("--delete", version, *, **).fmap { |text| text[/\d+\.\d+\.\d+/] }
         | 
| 50 | 
            +
                                                    .alt_map do |error|
         | 
| 51 | 
            +
                                                      error.delete_prefix("error: tag ").chomp
         | 
| 52 | 
            +
                                                    end
         | 
| 53 | 
            +
                  end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                  def delete_remote(version, *, **)
         | 
| 56 | 
            +
                    shell.call("push", "--delete", "origin", version, *, **)
         | 
| 57 | 
            +
                         .fmap { version }
         | 
| 58 | 
            +
                         .alt_map { |error| error.gsub("error: ", "").chomp }
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
             | 
| 48 61 | 
             
                  def exist?(version) = local?(version) || remote?(version)
         | 
| 49 62 |  | 
| 50 | 
            -
                  def index | 
| 63 | 
            +
                  def index(*arguments, **)
         | 
| 51 64 | 
             
                    arguments.prepend(pretty_format, "--list")
         | 
| 52 | 
            -
                             .then { |flags| call(*flags) }
         | 
| 65 | 
            +
                             .then { |flags| call(*flags, **) }
         | 
| 53 66 | 
             
                             .fmap { |content| String(content).scrub("?").split %("\n") }
         | 
| 54 67 | 
             
                             .fmap { |entries| build_records entries }
         | 
| 55 68 | 
             
                  end
         | 
| 56 69 |  | 
| 57 | 
            -
                  def last
         | 
| 58 | 
            -
                    shell.call("describe", "--abbrev=0", "--tags")
         | 
| 70 | 
            +
                  def last(*, **)
         | 
| 71 | 
            +
                    shell.call("describe", "--abbrev=0", "--tags", *, **)
         | 
| 59 72 | 
             
                         .fmap(&:strip)
         | 
| 60 73 | 
             
                         .or do |error|
         | 
| 61 74 | 
             
                           if error.match?(/no names found/i)
         | 
| @@ -70,7 +83,7 @@ module Gitt | |
| 70 83 | 
             
                    call("--list", version).value_or(Core::EMPTY_STRING).match?(/\A#{version}\Z/)
         | 
| 71 84 | 
             
                  end
         | 
| 72 85 |  | 
| 73 | 
            -
                  def push = shell.call | 
| 86 | 
            +
                  def push(*, **) = shell.call("push", "--tags", *, **)
         | 
| 74 87 |  | 
| 75 88 | 
             
                  def remote? version
         | 
| 76 89 | 
             
                    shell.call("ls-remote", "--tags", "origin", version)
         | 
| @@ -78,8 +91,8 @@ module Gitt | |
| 78 91 | 
             
                         .match?(%r(.+tags/#{version}\Z))
         | 
| 79 92 | 
             
                  end
         | 
| 80 93 |  | 
| 81 | 
            -
                  def show  | 
| 82 | 
            -
                    call(pretty_format, "--list", version).fmap { |content| parser.call content }
         | 
| 94 | 
            +
                  def show(version, *, **)
         | 
| 95 | 
            +
                    call(pretty_format, "--list", version, *, **).fmap { |content| parser.call content }
         | 
| 83 96 | 
             
                  end
         | 
| 84 97 |  | 
| 85 98 | 
             
                  def tagged? = !call.value_or(Core::EMPTY_STRING).empty?
         | 
    
        data/lib/gitt/parsers/commit.rb
    CHANGED
    
    | @@ -57,7 +57,7 @@ module Gitt | |
| 57 57 |  | 
| 58 58 | 
             
                  # :reek:FeatureEnvy
         | 
| 59 59 | 
             
                  def process_statistics attributes
         | 
| 60 | 
            -
                    attributes.merge!  | 
| 60 | 
            +
                    attributes.merge! statistics_sanitizer.call(attributes.delete(:statistics))
         | 
| 61 61 | 
             
                  end
         | 
| 62 62 |  | 
| 63 63 | 
             
                  def lines_sanitizer = sanitizers.fetch :lines
         | 
| @@ -66,7 +66,7 @@ module Gitt | |
| 66 66 |  | 
| 67 67 | 
             
                  def scissors_sanitizer = sanitizers.fetch :scissors
         | 
| 68 68 |  | 
| 69 | 
            -
                  def  | 
| 69 | 
            +
                  def statistics_sanitizer = sanitizers.fetch :statistics
         | 
| 70 70 |  | 
| 71 71 | 
             
                  def signature_sanitizer = sanitizers.fetch :signature
         | 
| 72 72 |  | 
    
        data/lib/gitt/repository.rb
    CHANGED
    
    | @@ -21,7 +21,7 @@ module Gitt | |
| 21 21 |  | 
| 22 22 | 
             
                def branch_default(...) = commands.fetch(:branch).default(...)
         | 
| 23 23 |  | 
| 24 | 
            -
                def branch_name = commands.fetch(:branch).name
         | 
| 24 | 
            +
                def branch_name(...) = commands.fetch(:branch).name(...)
         | 
| 25 25 |  | 
| 26 26 | 
             
                def call(...) = shell.call(...)
         | 
| 27 27 |  | 
| @@ -52,7 +52,11 @@ module Gitt | |
| 52 52 |  | 
| 53 53 | 
             
                def tag_create(...) = commands.fetch(:tag).create(...)
         | 
| 54 54 |  | 
| 55 | 
            -
                def  | 
| 55 | 
            +
                def tag_delete_local(...) = commands.fetch(:tag).delete_local(...)
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                def tag_delete_remote(...) = commands.fetch(:tag).delete_remote(...)
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                def tag_last(...) = commands.fetch(:tag).last(...)
         | 
| 56 60 |  | 
| 57 61 | 
             
                def tag_local?(...) = commands.fetch(:tag).local?(...)
         | 
| 58 62 |  | 
| @@ -62,7 +66,7 @@ module Gitt | |
| 62 66 |  | 
| 63 67 | 
             
                def tagged? = commands.fetch(:tag).tagged?
         | 
| 64 68 |  | 
| 65 | 
            -
                def tags_push = commands.fetch(:tag).push
         | 
| 69 | 
            +
                def tags_push(...) = commands.fetch(:tag).push(...)
         | 
| 66 70 |  | 
| 67 71 | 
             
                def uncommitted(...) = commands.fetch(:log).uncommitted(...)
         | 
| 68 72 |  | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            RSpec.shared_context "with Git tag" do
         | 
| 4 | 
            +
              let :git_tag do
         | 
| 5 | 
            +
                Gitt::Models::Tag[
         | 
| 6 | 
            +
                  author_email: "test@example.com",
         | 
| 7 | 
            +
                  author_name: "Test User",
         | 
| 8 | 
            +
                  authored_at: 1735714800,
         | 
| 9 | 
            +
                  authored_relative_at: "1 day ago",
         | 
| 10 | 
            +
                  body: "Generated by Milestoner.",
         | 
| 11 | 
            +
                  committed_at: 1735718461,
         | 
| 12 | 
            +
                  committed_relative_at: "1 hour ago",
         | 
| 13 | 
            +
                  committer_email: "test@example.com",
         | 
| 14 | 
            +
                  committer_name: "Test User",
         | 
| 15 | 
            +
                  sha: "180dec7d8ae8cbe3565a727c63c2111e49e0b737",
         | 
| 16 | 
            +
                  signature: "",
         | 
| 17 | 
            +
                  subject: "Version 0.0.0",
         | 
| 18 | 
            +
                  trailers: [],
         | 
| 19 | 
            +
                  version: "0.0.0"
         | 
| 20 | 
            +
                ]
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
            end
         | 
| @@ -1,13 +1,11 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            RSpec.shared_context "with temporary directory" do
         | 
| 4 | 
            -
              using Refinements::Pathname
         | 
| 5 | 
            -
             | 
| 6 4 | 
             
              let(:temp_dir) { Bundler.root.join "tmp", "rspec" }
         | 
| 7 5 |  | 
| 8 6 | 
             
              around do |example|
         | 
| 9 | 
            -
                temp_dir. | 
| 7 | 
            +
                temp_dir.mkpath
         | 
| 10 8 | 
             
                example.run
         | 
| 11 | 
            -
                temp_dir. | 
| 9 | 
            +
                temp_dir.rmtree
         | 
| 12 10 | 
             
              end
         | 
| 13 11 | 
             
            end
         | 
| @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
            module Gitt
         | 
| 4 4 | 
             
              module Sanitizers
         | 
| 5 5 | 
             
                # Converts raw text into a statistics hash.
         | 
| 6 | 
            -
                class  | 
| 6 | 
            +
                class Statistics
         | 
| 7 7 | 
             
                  EMPTY = {files_changed: 0, insertions: 0, deletions: 0}.freeze
         | 
| 8 8 |  | 
| 9 9 | 
             
                  PATTERN = /
         | 
| @@ -12,7 +12,7 @@ module Gitt | |
| 12 12 | 
             
                    (?<kind>file|insertion|deletion)  # Kind capture group.
         | 
| 13 13 | 
             
                  /x
         | 
| 14 14 |  | 
| 15 | 
            -
                  def self. | 
| 15 | 
            +
                  def self.update attributes, kind, total
         | 
| 16 16 | 
             
                    case kind
         | 
| 17 17 | 
             
                      when "file" then attributes[:files_changed] = total
         | 
| 18 18 | 
             
                      when "insertion" then attributes[:insertions] = total
         | 
| @@ -21,22 +21,22 @@ module Gitt | |
| 21 21 | 
             
                    end
         | 
| 22 22 | 
             
                  end
         | 
| 23 23 |  | 
| 24 | 
            -
                  def initialize  | 
| 25 | 
            -
                    @ | 
| 24 | 
            +
                  def initialize attributes = EMPTY, pattern: PATTERN
         | 
| 25 | 
            +
                    @attributes = attributes
         | 
| 26 26 | 
             
                    @pattern = pattern
         | 
| 27 27 | 
             
                  end
         | 
| 28 28 |  | 
| 29 29 | 
             
                  def call text
         | 
| 30 | 
            -
                    return  | 
| 30 | 
            +
                    return attributes unless text
         | 
| 31 31 |  | 
| 32 | 
            -
                    text.scan(pattern).each.with_object( | 
| 33 | 
            -
                      self.class. | 
| 32 | 
            +
                    text.scan(pattern).each.with_object(attributes.dup) do |(number, kind), aggregate|
         | 
| 33 | 
            +
                      self.class.update aggregate, kind, number.to_i
         | 
| 34 34 | 
             
                    end
         | 
| 35 35 | 
             
                  end
         | 
| 36 36 |  | 
| 37 37 | 
             
                  private
         | 
| 38 38 |  | 
| 39 | 
            -
                  attr_reader : | 
| 39 | 
            +
                  attr_reader :attributes, :pattern
         | 
| 40 40 | 
             
                end
         | 
| 41 41 | 
             
              end
         | 
| 42 42 | 
             
            end
         | 
    
        data/lib/gitt/shell.rb
    CHANGED
    
    | @@ -12,8 +12,10 @@ module Gitt | |
| 12 12 | 
             
                  @client = client
         | 
| 13 13 | 
             
                end
         | 
| 14 14 |  | 
| 15 | 
            -
                def call( | 
| 16 | 
            -
                   | 
| 15 | 
            +
                def call(*all, **)
         | 
| 16 | 
            +
                  environment, arguments = all.partition { it.is_a? Hash }
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  client.capture3(*environment, "git", *arguments, **).then do |stdout, stderr, status|
         | 
| 17 19 | 
             
                    status.success? ? Success(stdout) : Failure(stderr)
         | 
| 18 20 | 
             
                  end
         | 
| 19 21 | 
             
                end
         | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,11 +1,10 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gitt
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 4.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Brooke Kuhlmann
         | 
| 8 | 
            -
            autorequire:
         | 
| 9 8 | 
             
            bindir: bin
         | 
| 10 9 | 
             
            cert_chain:
         | 
| 11 10 | 
             
            - |
         | 
| @@ -35,7 +34,7 @@ cert_chain: | |
| 35 34 | 
             
              3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
         | 
| 36 35 | 
             
              gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
         | 
| 37 36 | 
             
              -----END CERTIFICATE-----
         | 
| 38 | 
            -
            date:  | 
| 37 | 
            +
            date: 2025-01-12 00:00:00.000000000 Z
         | 
| 39 38 | 
             
            dependencies:
         | 
| 40 39 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 41 40 | 
             
              name: core
         | 
| @@ -43,14 +42,14 @@ dependencies: | |
| 43 42 | 
             
                requirements:
         | 
| 44 43 | 
             
                - - "~>"
         | 
| 45 44 | 
             
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            -
                    version: ' | 
| 45 | 
            +
                    version: '2.0'
         | 
| 47 46 | 
             
              type: :runtime
         | 
| 48 47 | 
             
              prerelease: false
         | 
| 49 48 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 50 49 | 
             
                requirements:
         | 
| 51 50 | 
             
                - - "~>"
         | 
| 52 51 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            -
                    version: ' | 
| 52 | 
            +
                    version: '2.0'
         | 
| 54 53 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 55 54 | 
             
              name: dry-monads
         | 
| 56 55 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -71,14 +70,14 @@ dependencies: | |
| 71 70 | 
             
                requirements:
         | 
| 72 71 | 
             
                - - "~>"
         | 
| 73 72 | 
             
                  - !ruby/object:Gem::Version
         | 
| 74 | 
            -
                    version: ' | 
| 73 | 
            +
                    version: '13.0'
         | 
| 75 74 | 
             
              type: :runtime
         | 
| 76 75 | 
             
              prerelease: false
         | 
| 77 76 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 78 77 | 
             
                requirements:
         | 
| 79 78 | 
             
                - - "~>"
         | 
| 80 79 | 
             
                  - !ruby/object:Gem::Version
         | 
| 81 | 
            -
                    version: ' | 
| 80 | 
            +
                    version: '13.0'
         | 
| 82 81 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 83 82 | 
             
              name: zeitwerk
         | 
| 84 83 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -93,7 +92,6 @@ dependencies: | |
| 93 92 | 
             
                - - "~>"
         | 
| 94 93 | 
             
                  - !ruby/object:Gem::Version
         | 
| 95 94 | 
             
                    version: '2.7'
         | 
| 96 | 
            -
            description:
         | 
| 97 95 | 
             
            email:
         | 
| 98 96 | 
             
            - brooke@alchemists.io
         | 
| 99 97 | 
             
            executables: []
         | 
| @@ -123,6 +121,7 @@ files: | |
| 123 121 | 
             
            - lib/gitt/repository.rb
         | 
| 124 122 | 
             
            - lib/gitt/rspec/shared_contexts/git_commit.rb
         | 
| 125 123 | 
             
            - lib/gitt/rspec/shared_contexts/git_repo.rb
         | 
| 124 | 
            +
            - lib/gitt/rspec/shared_contexts/git_tag.rb
         | 
| 126 125 | 
             
            - lib/gitt/rspec/shared_contexts/temp_dir.rb
         | 
| 127 126 | 
             
            - lib/gitt/sanitizers/container.rb
         | 
| 128 127 | 
             
            - lib/gitt/sanitizers/date.rb
         | 
| @@ -131,7 +130,7 @@ files: | |
| 131 130 | 
             
            - lib/gitt/sanitizers/paragraphs.rb
         | 
| 132 131 | 
             
            - lib/gitt/sanitizers/scissors.rb
         | 
| 133 132 | 
             
            - lib/gitt/sanitizers/signature.rb
         | 
| 134 | 
            -
            - lib/gitt/sanitizers/ | 
| 133 | 
            +
            - lib/gitt/sanitizers/statistics.rb
         | 
| 135 134 | 
             
            - lib/gitt/sanitizers/trailers.rb
         | 
| 136 135 | 
             
            - lib/gitt/sanitizers/version.rb
         | 
| 137 136 | 
             
            - lib/gitt/shell.rb
         | 
| @@ -147,16 +146,12 @@ metadata: | |
| 147 146 | 
             
              label: Gitt
         | 
| 148 147 | 
             
              rubygems_mfa_required: 'true'
         | 
| 149 148 | 
             
              source_code_uri: https://github.com/bkuhlmann/gitt
         | 
| 150 | 
            -
            post_install_message:
         | 
| 151 149 | 
             
            rdoc_options: []
         | 
| 152 150 | 
             
            require_paths:
         | 
| 153 151 | 
             
            - lib
         | 
| 154 152 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 155 153 | 
             
              requirements:
         | 
| 156 | 
            -
              - - " | 
| 157 | 
            -
                - !ruby/object:Gem::Version
         | 
| 158 | 
            -
                  version: '3.3'
         | 
| 159 | 
            -
              - - "<="
         | 
| 154 | 
            +
              - - "~>"
         | 
| 160 155 | 
             
                - !ruby/object:Gem::Version
         | 
| 161 156 | 
             
                  version: '3.4'
         | 
| 162 157 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| @@ -165,8 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 165 160 | 
             
                - !ruby/object:Gem::Version
         | 
| 166 161 | 
             
                  version: '0'
         | 
| 167 162 | 
             
            requirements: []
         | 
| 168 | 
            -
            rubygems_version: 3. | 
| 169 | 
            -
            signing_key:
         | 
| 163 | 
            +
            rubygems_version: 3.6.2
         | 
| 170 164 | 
             
            specification_version: 4
         | 
| 171 165 | 
             
            summary: A monadic Object API for the Git CLI.
         | 
| 172 166 | 
             
            test_files: []
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |