circleci-bundle-update-pr 1.14.3 → 1.14.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 +2 -2
- data/lib/circleci/bundle/update/pr.rb +17 -4
- data/lib/circleci/bundle/update/pr/version.rb +1 -1
- data/spec/circleci/bundle/update/pr_spec.rb +25 -0
- 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: f0132033cd212b7a4de6428ae448cf78fc452f8766141e54eaeff0e85f583a32
|
4
|
+
data.tar.gz: 6265c70896a7a0e9e4aa474d0447a7b574ac6c9bcf901e055e843aa0fb2f0ad5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c4825bd2e230a48f8ae2b67a7210bd430a6294188df0bdbd5506aa47fdbd7b1060a6c009cb96d57e72c3d655169806ed7cdfa3b985fb14f08067beb831fd214
|
7
|
+
data.tar.gz: bb016368f762b942f75cb7080052683ec83e097e40e95914e3153af2d49261b5ddc9b8e3fef74ccc749ccf15de0d93fcfcbe8b7e91e77a02c1730c1c080e1f95
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
circleci-bundle-update-pr (1.14.
|
4
|
+
circleci-bundle-update-pr (1.14.4)
|
5
5
|
compare_linker (>= 1.4.0)
|
6
6
|
octokit
|
7
7
|
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
multipart-post (>= 1.2, < 3)
|
19
19
|
httpclient (2.8.3)
|
20
20
|
multipart-post (2.0.0)
|
21
|
-
octokit (4.
|
21
|
+
octokit (4.14.0)
|
22
22
|
sawyer (~> 0.8.0, >= 0.5.3)
|
23
23
|
public_suffix (3.0.3)
|
24
24
|
rake (12.3.2)
|
@@ -16,7 +16,12 @@ module Circleci
|
|
16
16
|
return
|
17
17
|
end
|
18
18
|
|
19
|
-
unless
|
19
|
+
unless target_branch?(running_branch: ENV['CIRCLE_BRANCH'], target_branches: git_branches)
|
20
|
+
puts "Skip because CIRCLE_BRANCH[#{ENV['CIRCLE_BRANCH']}] is not included in target branches[#{git_branches.join(',')}]."
|
21
|
+
return
|
22
|
+
end
|
23
|
+
|
24
|
+
unless need_to_commit?
|
20
25
|
puts 'No changes due to bundle update'
|
21
26
|
return
|
22
27
|
end
|
@@ -68,12 +73,20 @@ module Circleci
|
|
68
73
|
end
|
69
74
|
private_class_method :exists_bundle_update_pr?
|
70
75
|
|
76
|
+
# Is running branch included in target_branches?
|
77
|
+
#
|
78
|
+
# @param running_branch [String]
|
79
|
+
# @param target_branches [Array<String>]
|
80
|
+
# @return [Boolean]
|
81
|
+
def self.target_branch?(running_branch:, target_branches:)
|
82
|
+
target_branches.include?(running_branch)
|
83
|
+
end
|
84
|
+
private_class_method :target_branch?
|
85
|
+
|
71
86
|
# Does it need to commit due to bundle update?
|
72
87
|
#
|
73
|
-
# @param git_branches [Array<String>]
|
74
88
|
# @return [Boolean]
|
75
|
-
def self.need_to_commit?
|
76
|
-
return false unless git_branches.include?(ENV['CIRCLE_BRANCH'])
|
89
|
+
def self.need_to_commit?
|
77
90
|
unless system("bundle update && bundle update --ruby")
|
78
91
|
raise "Unable to execute `bundle update && bundle update --ruby`"
|
79
92
|
end
|
@@ -18,4 +18,29 @@ describe Circleci::Bundle::Update::Pr do
|
|
18
18
|
it { is_expected.to eq 'github.com' }
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
describe ".target_branch?" do
|
23
|
+
subject do
|
24
|
+
Circleci::Bundle::Update::Pr.send(
|
25
|
+
:target_branch?,
|
26
|
+
running_branch: running_branch,
|
27
|
+
target_branches: ["target"],
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
context "running_target is included in target branches" do
|
32
|
+
let(:running_branch) { 'target' }
|
33
|
+
it { is_expected.to be_truthy }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "ENV['CIRCLE_BRANCH'] is not included in target branches" do
|
37
|
+
let(:running_branch) { 'not_included' }
|
38
|
+
it { is_expected.to be_falsy }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "ENV['CIRCLE_BRANCH'] is nil" do
|
42
|
+
let(:running_branch) { nil }
|
43
|
+
it { is_expected.to be_falsy }
|
44
|
+
end
|
45
|
+
end
|
21
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circleci-bundle-update-pr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Masuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|