fa-harness-tools 1.0.3 → 1.0.4
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
- data/Gemfile.lock +1 -1
- data/lib/fa-harness-tools/github_client.rb +19 -2
- data/lib/fa-harness-tools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3cee0250f6a943fb938d11c0e118f53d26ea03be5edb7e8f8fc7fb0f73e154e
|
4
|
+
data.tar.gz: 030ab9dac48945eac8366a8cfcbafecc4bbbeebc5dc16254f97bfa3cfdb26368
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f00171760572605f0282595bc852bf20181768464dd9811051cb71a6658daa9692bdb77c46dbb180eca6c982b17736cf0f4c24e89cf6fba60fcddd379d81a08
|
7
|
+
data.tar.gz: 863db5b6b4230a1d2fedd00ab20f05d830fb682bc9b4947f1e4bdd69429dfa90ba637fac2afabd6cd7c8c7b71271e6a53346593325e46a0c7c6377453c86e7bd
|
data/Gemfile.lock
CHANGED
@@ -22,9 +22,12 @@ module FaHarnessTools
|
|
22
22
|
#
|
23
23
|
# @return [Array[Hash]] Array of tag data hash, or [] if none
|
24
24
|
def all_deploy_tags(prefix:, environment:)
|
25
|
+
@octokit.auto_paginate = true
|
25
26
|
@octokit.tags(owner_repo).find_all do |tag|
|
26
27
|
tag[:name].start_with?("#{prefix}-#{environment}-")
|
27
28
|
end
|
29
|
+
ensure
|
30
|
+
@octokit.auto_paginate = false
|
28
31
|
end
|
29
32
|
|
30
33
|
# Return the last (when sorted) tag starting "harness-deploy-ENV-"
|
@@ -55,14 +58,14 @@ module FaHarnessTools
|
|
55
58
|
#
|
56
59
|
# @return [Bool] True is <ancestor> is ancestor of <commit>
|
57
60
|
def is_ancestor_of?(ancestor, commit)
|
58
|
-
|
61
|
+
!!find_commit(commit) { |c| c[:sha] == ancestor }
|
59
62
|
end
|
60
63
|
|
61
64
|
# Checks if <commit> is on branch <branch>
|
62
65
|
#
|
63
66
|
# @return [Bool] True is <commit> is on <branch>
|
64
67
|
def branch_contains?(branch, commit)
|
65
|
-
|
68
|
+
!!find_commit(branch) { |c| c[:sha] == commit }
|
66
69
|
end
|
67
70
|
|
68
71
|
# Creates a Git tag
|
@@ -73,5 +76,19 @@ module FaHarnessTools
|
|
73
76
|
@octokit.create_ref(owner_repo, "tags/#{tag}", commit_sha)
|
74
77
|
@octokit.create_tag(owner_repo, tag, message, commit_sha, *args)
|
75
78
|
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
# Paginate over commits from a given sha/branch, and exit early if the
|
83
|
+
# supplied block matches
|
84
|
+
def find_commit(sha_or_branch, &block)
|
85
|
+
result = @octokit.commits(owner_repo, sha_or_branch).find(&block)
|
86
|
+
response = @octokit.last_response
|
87
|
+
until result || !response.rels[:next]
|
88
|
+
response = response.rels[:next].get
|
89
|
+
result = response.data.find(&block)
|
90
|
+
end
|
91
|
+
result
|
92
|
+
end
|
76
93
|
end
|
77
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fa-harness-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FreeAgent
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|