gitt 1.0.0 → 1.1.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: '0299e137ff3816d95cdc4a92ccc4af9a47bacb19756e49ce4c3ad046d7dfe701'
4
- data.tar.gz: 39829d79861e88f5e6d7af24f34202d518dbbc8faffe212503e340766a891342
3
+ metadata.gz: 89432cb99090adf3338c1f9226c01a018afaaa08df54d4d84929bb20f6b0ea1d
4
+ data.tar.gz: 93d61f586d6d5df881c55b47a814b21fd5ca63ade7c182a8269bf5dd9f975d2d
5
5
  SHA512:
6
- metadata.gz: 932f1cd9202c325642f1e829ec7a7baffe5d3d1d364db1f7c3e807f0f4081998dbe0f0e9413d97d87241646595ed838cb72738164c89391be439ad83f1b647d2
7
- data.tar.gz: f00e865926dbc62c1776fb6ecdbf62e31037b20259964c7c27985642d6693da1f7c16d0457be1ff605d7c51e2c0db3699b9c44626e95b1b334736a4370ffe9ff
6
+ metadata.gz: 9c40e0cc1712b995d90aaeff4302a08d13ba02e7e297f61ec522e648e31b2f26b68f03e5cd9fede300553d5ab22cf2c0d3319b26bf55071b253647410a9aeee9
7
+ data.tar.gz: abc1e6a2f5b6b88740807e180c9675897b24b21e9469d9ef49441b66944d359c9f28be0c476f3393901620715564464088ad8e66cfd7bfe3b1cf19b2f07c19bd
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 = "1.0.0"
5
+ spec.version = "1.1.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://www.alchemists.io/projects/gitt"
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.cert_chain = [Gem.default_cert_path]
24
24
 
25
25
  spec.required_ruby_version = "~> 3.2"
26
+ spec.add_dependency "core", "~> 0.1"
26
27
  spec.add_dependency "dry-monads", "~> 1.6"
27
28
  spec.add_dependency "refinements", "~> 10.0"
28
29
  spec.add_dependency "zeitwerk", "~> 2.6"
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "core"
3
4
  require "dry/monads"
4
5
 
5
6
  module Gitt
@@ -14,14 +15,14 @@ module Gitt
14
15
 
15
16
  def call(*arguments) = shell.call "config", *arguments
16
17
 
17
- def get key, fallback = "", *arguments
18
+ def get key, fallback = Core::EMPTY_STRING, *arguments
18
19
  call(*arguments, "--get", key).fmap(&:chomp)
19
20
  .or do |error|
20
21
  block_given? ? yield(error) : Success(fallback)
21
22
  end
22
23
  end
23
24
 
24
- def origin? = !get("remote.origin.url").value_or(EMPTY_STRING).empty?
25
+ def origin? = !get("remote.origin.url").value_or(Core::EMPTY_STRING).empty?
25
26
 
26
27
  def set(key, value, *arguments) = call(*arguments, "--add", key, value).fmap { value }
27
28
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "core"
3
4
  require "dry/monads"
4
5
  require "tempfile"
5
6
 
@@ -32,7 +33,7 @@ module Gitt
32
33
 
33
34
  def call(*arguments) = shell.call "tag", *arguments
34
35
 
35
- def create version, body = EMPTY_STRING, *flags
36
+ def create version, body = Core::EMPTY_STRING, *flags
36
37
  return Failure "Unable to create Git tag without version." unless version
37
38
  return Failure "Tag exists: #{version}." if exist? version
38
39
 
@@ -57,13 +58,15 @@ module Gitt
57
58
  .or { |error| Failure error.delete_prefix("fatal: ").chomp }
58
59
  end
59
60
 
60
- def local?(version) = call("--list", version).value_or(EMPTY_STRING).match?(/\A#{version}\Z/)
61
+ def local? version
62
+ call("--list", version).value_or(Core::EMPTY_STRING).match?(/\A#{version}\Z/)
63
+ end
61
64
 
62
65
  def push = shell.call "push", "--tags"
63
66
 
64
67
  def remote? version
65
68
  shell.call("ls-remote", "--tags", "origin", version)
66
- .value_or(EMPTY_STRING)
69
+ .value_or(Core::EMPTY_STRING)
67
70
  .match?(%r(.+tags/#{version}\Z))
68
71
  end
69
72
 
@@ -71,7 +74,7 @@ module Gitt
71
74
  call(pretty_format, "--list", version).fmap { |content| parser.call content }
72
75
  end
73
76
 
74
- def tagged? = !call.value_or(EMPTY_STRING).empty?
77
+ def tagged? = !call.value_or(Core::EMPTY_STRING).empty?
75
78
 
76
79
  private
77
80
 
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "core"
4
+
3
5
  module Gitt
4
6
  module Parsers
5
7
  # Extracts attributes from XML formatted content.
6
8
  class Attributer
7
9
  def self.with(...) = new(...)
8
10
 
9
- def initialize keys = []
11
+ def initialize keys = Core::EMPTY_ARRAY
10
12
  @keys = keys
11
13
  end
12
14
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "core"
4
+
3
5
  module Gitt
4
6
  # Primary object/wrapper for processing all Git related commands.
5
7
  # :reek:TooManyMethods
@@ -28,7 +30,7 @@ module Gitt
28
30
 
29
31
  def config(...) = commands.fetch(__method__).call(...)
30
32
 
31
- def exist? = shell.call("rev-parse", "--git-dir").value_or(EMPTY_STRING).chomp == ".git"
33
+ def exist? = shell.call("rev-parse", "--git-dir").value_or(Core::EMPTY_STRING).chomp == ".git"
32
34
 
33
35
  def get(...) = commands.fetch(:config).get(...)
34
36
 
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "core"
4
+
3
5
  module Gitt
4
6
  module Sanitizers
5
- Lines = -> value { value ? value.split("\n") : EMPTY_ARRAY }
7
+ Lines = -> value { value ? value.split("\n") : Core::EMPTY_ARRAY }
6
8
  end
7
9
  end
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "core"
4
+
3
5
  module Gitt
4
6
  module Sanitizers
5
- Paragraphs = -> value { value ? value.split("\n\n").map(&:chomp) : EMPTY_ARRAY }
7
+ Paragraphs = -> value { value ? value.split("\n\n").map(&:chomp) : Core::EMPTY_ARRAY }
6
8
  end
7
9
  end
data/lib/gitt.rb CHANGED
@@ -10,7 +10,5 @@ end
10
10
 
11
11
  # Main namespace.
12
12
  module Gitt
13
- EMPTY_STRING = ""
14
- EMPTY_ARRAY = [].freeze
15
13
  SHELL = Shell.new.freeze
16
14
  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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,8 +28,22 @@ cert_chain:
28
28
  CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
29
29
  RFE=
30
30
  -----END CERTIFICATE-----
31
- date: 2022-12-25 00:00:00.000000000 Z
31
+ date: 2023-01-07 00:00:00.000000000 Z
32
32
  dependencies:
33
+ - !ruby/object:Gem::Dependency
34
+ name: core
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.1'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.1'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: dry-monads
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  requirements: []
140
- rubygems_version: 3.4.1
154
+ rubygems_version: 3.4.2
141
155
  signing_key:
142
156
  specification_version: 4
143
157
  summary: Provides a monadic Object API wrapper around the Git CLI.
metadata.gz.sig CHANGED
Binary file