gempilot 0.3.4 → 0.3.5

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: 2a9a46b6f3c9121afd8b129b511f2d05107bd97009d3274f840b80779aba3187
4
- data.tar.gz: e41500827ee11aa83827feb8c43fb36a115383a7cd6a52619f49d6487d05f9ce
3
+ metadata.gz: ab55a4c336ff8612280f38c41b6c4471e9f7791ae9fd40998af6608c016f5031
4
+ data.tar.gz: 1d29b54f07c0c66a0a6781a394d29d0cb73c14ceba5c3cf8278601e5e1db4df9
5
5
  SHA512:
6
- metadata.gz: '059d2fd4b08bf84d5f8bec7f2d13907362b73bc51222c56641292423a2df753c45f6b279d7e1abb0586a453d2979243b7d964d0e4cbf908a768f714f3bf6cbae'
7
- data.tar.gz: febb87bfccb1ae993e298848a4cc7b8b4a084479ead1850799bc9dfa1496d886fddeba6d49ff62ddbe171efcd74c7d8f3d561bfc6151856048ad81bc430b824f
6
+ metadata.gz: 22f56e4d465bd05cfb95f4286599ae1c8242c56a63855aefad5878b74eb277dae5f0a497f11a43ccc2e4539cb9e4b18345907fe991ca8a4b93657fb9265138d7
7
+ data.tar.gz: 7edb37e82f9f3595bfe6d2002684c8dec2a40dbd7b7cd04440dad519a2e68d521793831fd717786cb53f6466385eb264e2196e4f8c67500feb3ac08bb2eb28d3
@@ -5,7 +5,9 @@ module Gempilot
5
5
  ## Backs the +release:source_control_push+ task. Idempotent: pushing an
6
6
  ## already-pushed branch or tag is a no-op, so re-running a release never
7
7
  ## fails on an existing tag (unlike bundler's +already_tagged?+ guard, which
8
- ## skips the push entirely once the tag exists locally).
8
+ ## skips the push entirely once the tag exists locally). From a detached
9
+ ## HEAD, such as a CI checkout of the tag, there is no branch to push, so
10
+ ## only the tag goes to +origin+.
9
11
  class Origin
10
12
  include StrictShell
11
13
 
@@ -16,21 +18,21 @@ module Gempilot
16
18
  end
17
19
 
18
20
  def push
19
- sh "git", "push", remote, "refs/heads/#{branch}"
21
+ sh "git", "push", remote, "refs/heads/#{branch}" if branch
20
22
  sh "git", "push", remote, "refs/tags/#{tag}"
21
23
  end
22
24
 
23
25
  private
24
26
 
25
27
  def branch
26
- @branch ||= resolve_branch
27
- end
28
+ return @branch if defined?(@branch)
28
29
 
29
- def resolve_branch
30
- name = capture("git", "rev-parse", "--abbrev-ref", "HEAD")
31
- raise "Cannot push from a detached HEAD; check out a branch first" if name == "HEAD"
30
+ @branch = attached_branch
31
+ end
32
32
 
33
- name
33
+ def attached_branch
34
+ out, status = Open3.capture2("git", "symbolic-ref", "--quiet", "--short", "HEAD")
35
+ out.strip if status.success?
34
36
  end
35
37
 
36
38
  def remote
@@ -38,15 +40,10 @@ module Gempilot
38
40
  end
39
41
 
40
42
  def configured_remote
43
+ return unless branch
44
+
41
45
  out, status = Open3.capture2("git", "config", "--get", "branch.#{branch}.remote")
42
46
  out.strip if status.success?
43
47
  end
44
-
45
- def capture(*args)
46
- out, status = Open3.capture2(*args)
47
- raise "Command #{args.join(" ").inspect} failed (exit #{status.exitstatus})" unless status.success?
48
-
49
- out.strip
50
- end
51
48
  end
52
49
  end
@@ -1,3 +1,3 @@
1
1
  module Gempilot
2
- VERSION = "0.3.4".freeze
2
+ VERSION = "0.3.5".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gempilot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Gillis
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubygems_version: 4.0.22
168
+ rubygems_version: 4.0.20
169
169
  specification_version: 4
170
170
  summary: A toolkit for creating, managing, and releasing your own rubygems
171
171
  test_files: []