gitt 2.1.1 → 2.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: 3127915892090cd6023f6ff8ad9e3a221352fc4d9cfd3dd8ac4a82392ae7b22b
4
- data.tar.gz: 3c724f8d0e0befa772bfb549ccc99a1d61e42fa527a4305d05c8acd3181d9925
3
+ metadata.gz: 9d018179bb1dc92195b5e119f089d1f9d5795f00c7eac06ddc3a6806bc6958ae
4
+ data.tar.gz: 77049ca6ffc901a71e9f086039fce8ac533a4bb5c47e18e82a5d5cc28b58de74
5
5
  SHA512:
6
- metadata.gz: 74a64c4b46f502ecf9193c4b31fbefd301d2b92d2a94b074819a44ceb559717003ba15fb6ee1aaf3c39b03da2027d33ebed7309131556b0ba1ba8aa9c9b2d147
7
- data.tar.gz: 2afce970af961e6ecf28a8c8e88b71d5d2405f53f249d2f875cf73bd5d87ccdc55f6eadb4ad5e8f159a06f20c9764dad6d979110aad8e7d5d8a2548b1f55b704
6
+ metadata.gz: 2727cb42a39b9c8a9ca07cb6c4e73303ed39d5257d251b5aa06054c391ced4c02d08a08c64b643adae1e05bd6a9ec1a9e3595774426d83076864fd01d90fab22
7
+ data.tar.gz: 21d96e647cd32ca25b7d4d2ebbbffac4f7c086d8649344b43f72a556f23f3037afc9ccf706d4aff750120055c8f98c7ff72111a07f58e9bdba9abf76c28b994d
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -75,7 +75,7 @@ git.uncommitted # Parses a file and answers an unsaved commit message.
75
75
  === Commands
76
76
 
77
77
  Should you want to use individual commands instead of interacting with the `Repository` object, you
78
- can leverage any of the objects in the `Commands` namespace which -- at a minimum -- use the link:https://alchemists.io/articles/interactor_pattern[Command Pattern]. Here are the _select_ commands which are enhanced further:
78
+ can leverage any of the objects in the `Commands` namespace which -- at a minimum -- use the link:https://alchemists.io/articles/interactor_pattern[Command Pattern]. Here are the specific commands which are enhanced further:
79
79
 
80
80
  ==== link:https://git-scm.com/docs/git-branch[Branch]
81
81
 
@@ -85,9 +85,12 @@ Handles branches.
85
85
  ----
86
86
  branch = Gitt::Commands::Branch.new
87
87
 
88
- # Answers branch default (via Git `init.defaultBranch` configuration).
88
+ # Answers branch default (via Git `init.defaultBranch` configuration) of if blank.
89
89
  branch.default # Success "main"
90
90
 
91
+ # Answers branch default fallback if unset or error is detected.
92
+ branch.default "source" # Success "source"
93
+
91
94
  # Accepts any argument you'd send to `git branch`. Example:
92
95
  branch.call "--list" # Success " main\n"
93
96
 
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 = "2.1.1"
5
+ spec.version = "2.2.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/gitt"
@@ -1,17 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "dry/monads"
4
+
3
5
  module Gitt
4
6
  module Commands
5
7
  # A Git branch command wrapper.
6
8
  class Branch
9
+ include Dry::Monads[:result]
10
+
7
11
  def initialize shell: SHELL
8
12
  @shell = shell
9
13
  end
10
14
 
11
- def default
15
+ def default fallback = "main"
12
16
  shell.call("config", "init.defaultBranch")
13
17
  .fmap(&:chomp)
14
- .fmap { |name| name.empty? ? "main" : name }
18
+ .fmap { |name| name.empty? ? fallback : name }
19
+ .or(Success(fallback))
15
20
  end
16
21
 
17
22
  def call(*arguments) = shell.call "branch", *arguments
@@ -20,7 +20,7 @@ module Gitt
20
20
 
21
21
  def branch(...) = commands.fetch(__method__).call(...)
22
22
 
23
- def branch_default = commands.fetch(:branch).default
23
+ def branch_default(...) = commands.fetch(:branch).default(...)
24
24
 
25
25
  def branch_name = commands.fetch(:branch).name
26
26
 
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: 2.1.1
4
+ version: 2.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: 2023-11-16 00:00:00.000000000 Z
38
+ date: 2023-12-21 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: core
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubygems_version: 3.4.22
164
+ rubygems_version: 3.5.1
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: A monadic Object API for the Git CLI.
metadata.gz.sig CHANGED
Binary file