gitt 2.1.0 → 2.2.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: 1729ed43e401f1737bedfef748942fed9da303db2a7cbff35c42b9857df03130
4
- data.tar.gz: 98f33e6bcb7c6285a87980bb926a4bf13ae2ef182518a92a55526288bf61738c
3
+ metadata.gz: 9d018179bb1dc92195b5e119f089d1f9d5795f00c7eac06ddc3a6806bc6958ae
4
+ data.tar.gz: 77049ca6ffc901a71e9f086039fce8ac533a4bb5c47e18e82a5d5cc28b58de74
5
5
  SHA512:
6
- metadata.gz: 3e34ce6cc45e4c66330ecd8313a98716cf1d9489c6ae3e9e3180078ec08316b4cb14b0c9800151fdb677cf077eb713229f3803959870a58aeb23d7f165ee0908
7
- data.tar.gz: c0b3bf7564479b4b308c86b78bd8403dc205199f93d259227ccd322ce06e16943394e69e376133ba2a11fa5b13ddb454aaa4e5702ce2d8020cbfe4a52e2d67f2
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.0"
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"
@@ -22,7 +22,7 @@ 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 = "~> 3.2"
25
+ spec.required_ruby_version = [">= 3.2", "<= 3.3"]
26
26
  spec.add_dependency "core", "~> 0.1"
27
27
  spec.add_dependency "dry-monads", "~> 1.6"
28
28
  spec.add_dependency "refinements", "~> 11.0"
@@ -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/lib/gitt.rb CHANGED
@@ -4,6 +4,7 @@ require "zeitwerk"
4
4
 
5
5
  Zeitwerk::Loader.new.then do |loader|
6
6
  loader.inflector.inflect "container" => "CONTAINER"
7
+ loader.ignore "#{__dir__}/gitt/rspec/shared_contexts"
7
8
  loader.tag = File.basename __FILE__, ".rb"
8
9
  loader.push_dir __dir__
9
10
  loader.setup
@@ -13,5 +14,7 @@ end
13
14
  module Gitt
14
15
  SHELL = Shell.new.freeze
15
16
 
16
- def self.loader(registry = Zeitwerk::Registry) = registry.loader_for __FILE__
17
+ def self.loader registry = Zeitwerk::Registry
18
+ @loader ||= registry.loaders.find { |loader| loader.tag == File.basename(__FILE__, ".rb") }
19
+ end
17
20
  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: 2.1.0
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-10-01 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
@@ -149,16 +149,19 @@ require_paths:
149
149
  - lib
150
150
  required_ruby_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - "~>"
152
+ - - ">="
153
153
  - !ruby/object:Gem::Version
154
154
  version: '3.2'
155
+ - - "<="
156
+ - !ruby/object:Gem::Version
157
+ version: '3.3'
155
158
  required_rubygems_version: !ruby/object:Gem::Requirement
156
159
  requirements:
157
160
  - - ">="
158
161
  - !ruby/object:Gem::Version
159
162
  version: '0'
160
163
  requirements: []
161
- rubygems_version: 3.4.20
164
+ rubygems_version: 3.5.1
162
165
  signing_key:
163
166
  specification_version: 4
164
167
  summary: A monadic Object API for the Git CLI.
metadata.gz.sig CHANGED
Binary file