circleci-bundle-update-pr 1.14.4 → 1.16.0
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/.circleci/config.yml +106 -29
- data/.rubocop.yml +28 -0
- data/.rubocop_todo.yml +8 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +22 -1
- data/Rakefile +2 -1
- data/bin/circleci-bundle-update-pr +3 -2
- data/circleci-bundle-update-pr.gemspec +16 -12
- data/lib/circleci/bundle/update/pr.rb +20 -17
- data/lib/circleci/bundle/update/pr/note.rb +2 -0
- data/lib/circleci/bundle/update/pr/version.rb +3 -1
- data/spec/circleci/bundle/update/pr/note_spec.rb +10 -8
- data/spec/circleci/bundle/update/pr_spec.rb +17 -8
- data/spec/spec_helper.rb +2 -0
- metadata +40 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8fbe8bbe94a5d748796b73ddf80bcfc9df4a1cd83478a31e056275a95e6f1f37
|
|
4
|
+
data.tar.gz: 1cbe85ff25928c0503a974f03ae11d7f0332e675d5f93b0434cc53dd63a863c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 64873c5e921eb91012104d263751f1c3ab12239d83595278d2c227e7a7abf07f04d3ca698a2fbee32f4ad301ad44c43b3fc64b18d0a1a15dbcf5bb31db9cb3f1
|
|
7
|
+
data.tar.gz: e90fa41fd9d91e056aad2f61abe0949c3b70e8d82dad95c8db73a0119009cfd508f7b8eb829a62692d2023a17ee6f961c18594af3ee8f0b0b03c6117e526f6c3
|
data/.circleci/config.yml
CHANGED
|
@@ -1,46 +1,120 @@
|
|
|
1
1
|
version: 2
|
|
2
|
+
|
|
3
|
+
references:
|
|
4
|
+
- &setup_requirements
|
|
5
|
+
name: Install System Dependencies
|
|
6
|
+
command: |
|
|
7
|
+
# See also https://circleci.com/docs/2.0/custom-images/#adding-required-and-custom-tools-or-files
|
|
8
|
+
apk add --update --no-cache --no-progress git openssh-client tar gzip ca-certificates \
|
|
9
|
+
build-base tzdata
|
|
10
|
+
- &set_timezone
|
|
11
|
+
name: Set timezone to Asia/Tokyo
|
|
12
|
+
command: cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
|
|
13
|
+
- &bundle_install
|
|
14
|
+
name: Install Ruby Dependencies
|
|
15
|
+
command: |
|
|
16
|
+
bundle check || bundle install --jobs=4 --retry=3
|
|
17
|
+
bundle clean
|
|
18
|
+
- &rubocop
|
|
19
|
+
name: Run RuboCop
|
|
20
|
+
command: rubocop
|
|
21
|
+
- &rspec
|
|
22
|
+
name: Run RSpec
|
|
23
|
+
command: rspec
|
|
24
|
+
|
|
2
25
|
jobs:
|
|
3
|
-
|
|
4
|
-
docker:
|
|
5
|
-
|
|
26
|
+
build_on_ruby2_3:
|
|
27
|
+
docker:
|
|
28
|
+
- image: ruby:2.3-alpine
|
|
6
29
|
working_directory: /work
|
|
7
30
|
steps:
|
|
8
|
-
- run:
|
|
9
|
-
|
|
10
|
-
command: |
|
|
11
|
-
# See also https://circleci.com/docs/2.0/custom-images/#adding-required-and-custom-tools-or-files
|
|
12
|
-
apk add --update --no-cache git openssh-client tar gzip ca-certificates \
|
|
13
|
-
tzdata
|
|
14
|
-
- run: &set_timezone
|
|
15
|
-
name: Set timezone to Asia/Tokyo
|
|
16
|
-
command: cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
|
|
31
|
+
- run: *setup_requirements
|
|
32
|
+
- run: *set_timezone
|
|
17
33
|
- checkout
|
|
18
|
-
- restore_cache:
|
|
34
|
+
- restore_cache:
|
|
19
35
|
name: Restore bundler cache
|
|
20
36
|
keys:
|
|
21
|
-
- gems-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
22
|
-
- gems-{{ .Environment.COMMON_CACHE_KEY }}-
|
|
23
|
-
- run:
|
|
24
|
-
|
|
25
|
-
command: |
|
|
26
|
-
bundle check || bundle install --jobs=4 --retry=3
|
|
27
|
-
bundle clean
|
|
28
|
-
- save_cache: &save_gems_cache
|
|
37
|
+
- gems-ruby2.3-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
38
|
+
- gems-ruby2.3-{{ .Environment.COMMON_CACHE_KEY }}-
|
|
39
|
+
- run: *bundle_install
|
|
40
|
+
- save_cache:
|
|
29
41
|
name: Save bundler cache
|
|
30
|
-
key: gems-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
42
|
+
key: gems-ruby2.3-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
31
43
|
paths:
|
|
32
44
|
- /usr/local/bundle
|
|
33
|
-
- run:
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
- run: *rubocop
|
|
46
|
+
- run: *rspec
|
|
47
|
+
build_on_ruby2_4:
|
|
48
|
+
docker:
|
|
49
|
+
- image: ruby:2.4-alpine
|
|
50
|
+
working_directory: /work
|
|
51
|
+
steps:
|
|
52
|
+
- run: *setup_requirements
|
|
53
|
+
- run: *set_timezone
|
|
54
|
+
- checkout
|
|
55
|
+
- restore_cache:
|
|
56
|
+
name: Restore bundler cache
|
|
57
|
+
keys:
|
|
58
|
+
- gems-ruby2.4-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
59
|
+
- gems-ruby2.4-{{ .Environment.COMMON_CACHE_KEY }}-
|
|
60
|
+
- run: *bundle_install
|
|
61
|
+
- save_cache:
|
|
62
|
+
name: Save bundler cache
|
|
63
|
+
key: gems-ruby2.4-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
64
|
+
paths:
|
|
65
|
+
- /usr/local/bundle
|
|
66
|
+
- run: *rubocop
|
|
67
|
+
- run: *rspec
|
|
68
|
+
build_on_ruby2_5:
|
|
69
|
+
docker:
|
|
70
|
+
- image: ruby:2.5-alpine
|
|
71
|
+
working_directory: /work
|
|
72
|
+
steps:
|
|
73
|
+
- run: *setup_requirements
|
|
74
|
+
- run: *set_timezone
|
|
75
|
+
- checkout
|
|
76
|
+
- restore_cache:
|
|
77
|
+
name: Restore bundler cache
|
|
78
|
+
keys:
|
|
79
|
+
- gems-ruby2.5-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
80
|
+
- gems-ruby2.5-{{ .Environment.COMMON_CACHE_KEY }}-
|
|
81
|
+
- run: *bundle_install
|
|
82
|
+
- save_cache:
|
|
83
|
+
name: Save bundler cache
|
|
84
|
+
key: gems-ruby2.5-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
85
|
+
paths:
|
|
86
|
+
- /usr/local/bundle
|
|
87
|
+
- run: *rubocop
|
|
88
|
+
- run: *rspec
|
|
89
|
+
build_on_ruby2_6:
|
|
90
|
+
docker: &docker_ruby2_6
|
|
91
|
+
- image: ruby:2.6-alpine
|
|
92
|
+
working_directory: /work
|
|
93
|
+
steps:
|
|
94
|
+
- run: *setup_requirements
|
|
95
|
+
- run: *set_timezone
|
|
96
|
+
- checkout
|
|
97
|
+
- restore_cache: &restore_cache_ruby2_6
|
|
98
|
+
name: Restore bundler cache
|
|
99
|
+
keys:
|
|
100
|
+
- gems-ruby2.6-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
101
|
+
- gems-ruby2.6-{{ .Environment.COMMON_CACHE_KEY }}-
|
|
102
|
+
- run: *bundle_install
|
|
103
|
+
- save_cache:
|
|
104
|
+
name: Save bundler cache
|
|
105
|
+
key: gems-ruby2.6-{{ .Environment.COMMON_CACHE_KEY }}-{{ checksum "Gemfile.lock" }}
|
|
106
|
+
paths:
|
|
107
|
+
- /usr/local/bundle
|
|
108
|
+
- run: *rubocop
|
|
109
|
+
- run: *rspec
|
|
36
110
|
continuous_bundle_update:
|
|
37
|
-
docker: *
|
|
111
|
+
docker: *docker_ruby2_6
|
|
38
112
|
working_directory: /work
|
|
39
113
|
steps:
|
|
40
114
|
- run: *setup_requirements
|
|
41
115
|
- run: *set_timezone
|
|
42
116
|
- checkout
|
|
43
|
-
- restore_cache: *
|
|
117
|
+
- restore_cache: *restore_cache_ruby2_6
|
|
44
118
|
- run:
|
|
45
119
|
name: Setup requirements for continuous bundle update
|
|
46
120
|
command: gem install -N circleci-bundle-update-pr
|
|
@@ -50,9 +124,12 @@ jobs:
|
|
|
50
124
|
|
|
51
125
|
workflows:
|
|
52
126
|
version: 2
|
|
53
|
-
|
|
127
|
+
ordinary:
|
|
54
128
|
jobs:
|
|
55
|
-
-
|
|
129
|
+
- build_on_ruby2_3
|
|
130
|
+
- build_on_ruby2_4
|
|
131
|
+
- build_on_ruby2_5
|
|
132
|
+
- build_on_ruby2_6
|
|
56
133
|
nightly:
|
|
57
134
|
triggers:
|
|
58
135
|
- schedule:
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
|
2
|
+
require: rubocop-rspec
|
|
3
|
+
|
|
4
|
+
AllCops:
|
|
5
|
+
DisplayCopNames: true
|
|
6
|
+
TargetRubyVersion: 2.3
|
|
7
|
+
|
|
8
|
+
Metrics:
|
|
9
|
+
Enabled: false
|
|
10
|
+
|
|
11
|
+
RSpec/DescribedClass:
|
|
12
|
+
Enabled: false
|
|
13
|
+
|
|
14
|
+
Style/BlockComments:
|
|
15
|
+
Exclude:
|
|
16
|
+
- 'spec/spec_helper.rb'
|
|
17
|
+
|
|
18
|
+
Style/Documentation:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
Style/DoubleNegation:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Style/GuardClause:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
Style/IfUnlessModifier:
|
|
28
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
circleci-bundle-update-pr (1.
|
|
4
|
+
circleci-bundle-update-pr (1.16.0)
|
|
5
5
|
compare_linker (>= 1.4.0)
|
|
6
6
|
octokit
|
|
7
7
|
|
|
@@ -10,6 +10,7 @@ GEM
|
|
|
10
10
|
specs:
|
|
11
11
|
addressable (2.5.2)
|
|
12
12
|
public_suffix (>= 2.0.2, < 4.0)
|
|
13
|
+
ast (2.4.0)
|
|
13
14
|
compare_linker (1.4.3)
|
|
14
15
|
httpclient
|
|
15
16
|
octokit
|
|
@@ -17,10 +18,16 @@ GEM
|
|
|
17
18
|
faraday (0.15.4)
|
|
18
19
|
multipart-post (>= 1.2, < 3)
|
|
19
20
|
httpclient (2.8.3)
|
|
21
|
+
jaro_winkler (1.5.2)
|
|
20
22
|
multipart-post (2.0.0)
|
|
21
23
|
octokit (4.14.0)
|
|
22
24
|
sawyer (~> 0.8.0, >= 0.5.3)
|
|
25
|
+
parallel (1.17.0)
|
|
26
|
+
parser (2.6.2.1)
|
|
27
|
+
ast (~> 2.4.0)
|
|
28
|
+
psych (3.1.0)
|
|
23
29
|
public_suffix (3.0.3)
|
|
30
|
+
rainbow (3.0.0)
|
|
24
31
|
rake (12.3.2)
|
|
25
32
|
rspec (3.8.0)
|
|
26
33
|
rspec-core (~> 3.8.0)
|
|
@@ -35,9 +42,21 @@ GEM
|
|
|
35
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
43
|
rspec-support (~> 3.8.0)
|
|
37
44
|
rspec-support (3.8.0)
|
|
45
|
+
rubocop (0.67.2)
|
|
46
|
+
jaro_winkler (~> 1.5.1)
|
|
47
|
+
parallel (~> 1.10)
|
|
48
|
+
parser (>= 2.5, != 2.5.1.1)
|
|
49
|
+
psych (>= 3.1.0)
|
|
50
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
51
|
+
ruby-progressbar (~> 1.7)
|
|
52
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
|
53
|
+
rubocop-rspec (1.32.0)
|
|
54
|
+
rubocop (>= 0.60.0)
|
|
55
|
+
ruby-progressbar (1.10.0)
|
|
38
56
|
sawyer (0.8.1)
|
|
39
57
|
addressable (>= 2.3.5, < 2.6)
|
|
40
58
|
faraday (~> 0.8, < 1.0)
|
|
59
|
+
unicode-display_width (1.5.0)
|
|
41
60
|
|
|
42
61
|
PLATFORMS
|
|
43
62
|
ruby
|
|
@@ -50,6 +69,8 @@ DEPENDENCIES
|
|
|
50
69
|
circleci-bundle-update-pr!
|
|
51
70
|
rake
|
|
52
71
|
rspec (~> 3.7)
|
|
72
|
+
rubocop
|
|
73
|
+
rubocop-rspec
|
|
53
74
|
|
|
54
75
|
BUNDLED WITH
|
|
55
76
|
1.17.2
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
|
|
3
|
-
require
|
|
4
|
+
require 'circleci/bundle/update/pr'
|
|
4
5
|
require 'optparse'
|
|
5
6
|
|
|
6
7
|
opt = OptionParser.new
|
|
@@ -14,7 +15,7 @@ opt.parse!(ARGV)
|
|
|
14
15
|
Circleci::Bundle::Update::Pr.create_if_needed(
|
|
15
16
|
git_username: ARGV.shift,
|
|
16
17
|
git_email: ARGV.shift,
|
|
17
|
-
git_branches: ARGV.empty? ? [
|
|
18
|
+
git_branches: ARGV.empty? ? ['master'] : ARGV,
|
|
18
19
|
assignees: options[:assignees],
|
|
19
20
|
reviewers: options[:reviewers],
|
|
20
21
|
labels: options[:labels],
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
5
|
require 'circleci/bundle/update/pr/version'
|
|
4
6
|
|
|
5
7
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name =
|
|
8
|
+
spec.name = 'circleci-bundle-update-pr'
|
|
7
9
|
spec.version = Circleci::Bundle::Update::Pr::VERSION
|
|
8
|
-
spec.authors = [
|
|
9
|
-
spec.email = [
|
|
10
|
-
spec.summary =
|
|
11
|
-
spec.description =
|
|
12
|
-
spec.homepage =
|
|
13
|
-
spec.license =
|
|
10
|
+
spec.authors = ['Takashi Masuda']
|
|
11
|
+
spec.email = ['masutaka.net@gmail.com']
|
|
12
|
+
spec.summary = 'Provide continues bundle update using CircleCI'
|
|
13
|
+
spec.description = 'Create GitHub PullRequest of bundle update in CircleCI'
|
|
14
|
+
spec.homepage = 'https://github.com/masutaka/circleci-bundle-update-pr'
|
|
15
|
+
spec.license = 'MIT'
|
|
14
16
|
|
|
15
17
|
spec.files = `git ls-files -z`.split("\x0")
|
|
16
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
17
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
18
|
-
spec.require_paths = [
|
|
20
|
+
spec.require_paths = ['lib']
|
|
19
21
|
|
|
22
|
+
spec.add_dependency 'compare_linker', '>= 1.4.0'
|
|
20
23
|
spec.add_dependency 'octokit'
|
|
21
|
-
spec.add_dependency 'compare_linker', ">= 1.4.0"
|
|
22
24
|
|
|
23
|
-
spec.add_development_dependency
|
|
24
|
-
spec.add_development_dependency
|
|
25
|
+
spec.add_development_dependency 'bundler'
|
|
26
|
+
spec.add_development_dependency 'rake'
|
|
25
27
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
|
28
|
+
spec.add_development_dependency 'rubocop'
|
|
29
|
+
spec.add_development_dependency 'rubocop-rspec'
|
|
26
30
|
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
1
|
+
require 'circleci/bundle/update/pr/version'
|
|
2
|
+
require 'octokit'
|
|
3
|
+
require 'compare_linker'
|
|
4
|
+
require 'circleci/bundle/update/pr/note'
|
|
5
5
|
|
|
6
6
|
module Circleci
|
|
7
7
|
module Bundle
|
|
8
8
|
module Update
|
|
9
9
|
module Pr
|
|
10
|
-
def self.create_if_needed(git_username: nil, git_email: nil, git_branches: [
|
|
10
|
+
def self.create_if_needed(git_username: nil, git_email: nil, git_branches: ['master'],
|
|
11
11
|
assignees: nil, reviewers: nil, labels: nil, allow_dup_pr: false)
|
|
12
12
|
raise_if_env_unvalid!
|
|
13
13
|
|
|
@@ -59,6 +59,7 @@ module Circleci
|
|
|
59
59
|
# @return [Boolean]
|
|
60
60
|
def self.skip?(allow_dup_pr)
|
|
61
61
|
return false if allow_dup_pr
|
|
62
|
+
|
|
62
63
|
exists_bundle_update_pr?
|
|
63
64
|
end
|
|
64
65
|
private_class_method :skip?
|
|
@@ -87,10 +88,11 @@ module Circleci
|
|
|
87
88
|
#
|
|
88
89
|
# @return [Boolean]
|
|
89
90
|
def self.need_to_commit?
|
|
90
|
-
unless system(
|
|
91
|
-
raise
|
|
91
|
+
unless system('bundle update && bundle update --ruby')
|
|
92
|
+
raise 'Unable to execute `bundle update && bundle update --ruby`'
|
|
92
93
|
end
|
|
93
|
-
|
|
94
|
+
|
|
95
|
+
`git status -sb 2> /dev/null`.include?('Gemfile.lock')
|
|
94
96
|
end
|
|
95
97
|
private_class_method :need_to_commit?
|
|
96
98
|
|
|
@@ -103,7 +105,7 @@ module Circleci
|
|
|
103
105
|
system("git remote add github-url-with-token #{remote}")
|
|
104
106
|
system("git config user.name '#{git_username}'")
|
|
105
107
|
system("git config user.email #{git_email}")
|
|
106
|
-
system(
|
|
108
|
+
system('git add Gemfile.lock')
|
|
107
109
|
system("git commit -m '$ bundle update && bundle update --ruby'")
|
|
108
110
|
system("git branch -M #{branch}")
|
|
109
111
|
system("git push -q github-url-with-token #{branch}")
|
|
@@ -127,25 +129,25 @@ module Circleci
|
|
|
127
129
|
private_class_method :add_labels
|
|
128
130
|
|
|
129
131
|
def self.update_pull_request_body(pr_number)
|
|
130
|
-
ENV[
|
|
132
|
+
ENV['OCTOKIT_ACCESS_TOKEN'] = ENV['GITHUB_ACCESS_TOKEN']
|
|
131
133
|
compare_linker = CompareLinker.new(repo_full_name, pr_number)
|
|
132
134
|
compare_linker.formatter = CompareLinker::Formatter::Markdown.new
|
|
133
135
|
|
|
134
|
-
body = <<-
|
|
136
|
+
body = <<-PR_BODY
|
|
135
137
|
**Updated RubyGems:**
|
|
136
138
|
|
|
137
139
|
#{compare_linker.make_compare_links.to_a.join("\n")}
|
|
138
140
|
|
|
139
141
|
Powered by [circleci-bundle-update-pr](https://rubygems.org/gems/circleci-bundle-update-pr)
|
|
140
|
-
|
|
142
|
+
PR_BODY
|
|
141
143
|
|
|
142
144
|
if Note.exist?
|
|
143
|
-
body << <<-
|
|
145
|
+
body << <<-PR_BODY
|
|
144
146
|
|
|
145
147
|
---
|
|
146
148
|
|
|
147
149
|
#{Note.read}
|
|
148
|
-
|
|
150
|
+
PR_BODY
|
|
149
151
|
end
|
|
150
152
|
|
|
151
153
|
client.update_pull_request(repo_full_name, pr_number, body: body)
|
|
@@ -167,7 +169,7 @@ Powered by [circleci-bundle-update-pr](https://rubygems.org/gems/circleci-bundle
|
|
|
167
169
|
Octokit::Client.new(access_token: ENV['ENTERPRISE_OCTOKIT_ACCESS_TOKEN'],
|
|
168
170
|
api_endpoint: ENV['ENTERPRISE_OCTOKIT_API_ENDPOINT'])
|
|
169
171
|
else
|
|
170
|
-
Octokit::Client.new(access_token: ENV[
|
|
172
|
+
Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN'])
|
|
171
173
|
end
|
|
172
174
|
end
|
|
173
175
|
private_class_method :client
|
|
@@ -192,9 +194,10 @@ Powered by [circleci-bundle-update-pr](https://rubygems.org/gems/circleci-bundle
|
|
|
192
194
|
|
|
193
195
|
def self.github_host
|
|
194
196
|
# A format like https://github.com/masutaka/circleci-bundle-update-pr.git
|
|
195
|
-
return
|
|
197
|
+
return Regexp.last_match(1) if ENV['CIRCLE_REPOSITORY_URL'] =~ %r{https://(.+?)/}
|
|
196
198
|
# A format like git@github.com:masutaka/compare_linker.git
|
|
197
|
-
return
|
|
199
|
+
return Regexp.last_match(1) if ENV['CIRCLE_REPOSITORY_URL'] =~ /([^@]+?):/
|
|
200
|
+
|
|
198
201
|
'github.com'
|
|
199
202
|
end
|
|
200
203
|
private_class_method :github_host
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'tmpdir'
|
|
2
4
|
|
|
3
5
|
describe Circleci::Bundle::Update::Pr::Note do
|
|
@@ -17,7 +19,7 @@ describe Circleci::Bundle::Update::Pr::Note do
|
|
|
17
19
|
describe '.exist?' do
|
|
18
20
|
subject { Circleci::Bundle::Update::Pr::Note.exist? }
|
|
19
21
|
|
|
20
|
-
context '
|
|
22
|
+
context 'with only .circleci/BUNDLE_UPDATE_NOTE.md' do
|
|
21
23
|
before do
|
|
22
24
|
FileUtils.touch('.circleci/BUNDLE_UPDATE_NOTE.md')
|
|
23
25
|
end
|
|
@@ -25,7 +27,7 @@ describe Circleci::Bundle::Update::Pr::Note do
|
|
|
25
27
|
it { is_expected.to be_truthy }
|
|
26
28
|
end
|
|
27
29
|
|
|
28
|
-
context '
|
|
30
|
+
context 'with only CIRCLECI_BUNDLE_UPDATE_NOTE.md' do
|
|
29
31
|
before do
|
|
30
32
|
FileUtils.touch('CIRCLECI_BUNDLE_UPDATE_NOTE.md')
|
|
31
33
|
end
|
|
@@ -33,7 +35,7 @@ describe Circleci::Bundle::Update::Pr::Note do
|
|
|
33
35
|
it { is_expected.to be_truthy }
|
|
34
36
|
end
|
|
35
37
|
|
|
36
|
-
context '
|
|
38
|
+
context 'with .circleci/BUNDLE_UPDATE_NOTE.md and CIRCLECI_BUNDLE_UPDATE_NOTE.md' do
|
|
37
39
|
before do
|
|
38
40
|
FileUtils.touch('.circleci/BUNDLE_UPDATE_NOTE.md')
|
|
39
41
|
FileUtils.touch('CIRCLECI_BUNDLE_UPDATE_NOTE.md')
|
|
@@ -42,7 +44,7 @@ describe Circleci::Bundle::Update::Pr::Note do
|
|
|
42
44
|
it { is_expected.to be_truthy }
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
context '
|
|
47
|
+
context 'with nothing' do
|
|
46
48
|
it { is_expected.to be_falsy }
|
|
47
49
|
end
|
|
48
50
|
end
|
|
@@ -50,7 +52,7 @@ describe Circleci::Bundle::Update::Pr::Note do
|
|
|
50
52
|
describe '.read' do
|
|
51
53
|
subject { Circleci::Bundle::Update::Pr::Note.read }
|
|
52
54
|
|
|
53
|
-
context '
|
|
55
|
+
context 'with .circleci/BUNDLE_UPDATE_NOTE.md' do
|
|
54
56
|
before do
|
|
55
57
|
File.open('.circleci/BUNDLE_UPDATE_NOTE.md', 'w') { |f| f.write('I am .circleci/BUNDLE_UPDATE_NOTE.md') }
|
|
56
58
|
end
|
|
@@ -58,7 +60,7 @@ describe Circleci::Bundle::Update::Pr::Note do
|
|
|
58
60
|
it { is_expected.to eq 'I am .circleci/BUNDLE_UPDATE_NOTE.md' }
|
|
59
61
|
end
|
|
60
62
|
|
|
61
|
-
context '
|
|
63
|
+
context 'with CIRCLECI_BUNDLE_UPDATE_NOTE.md' do
|
|
62
64
|
before do
|
|
63
65
|
File.open('CIRCLECI_BUNDLE_UPDATE_NOTE.md', 'w') { |f| f.write('I am CIRCLECI_BUNDLE_UPDATE_NOTE.md') }
|
|
64
66
|
end
|
|
@@ -66,7 +68,7 @@ describe Circleci::Bundle::Update::Pr::Note do
|
|
|
66
68
|
it { is_expected.to eq 'I am CIRCLECI_BUNDLE_UPDATE_NOTE.md' }
|
|
67
69
|
end
|
|
68
70
|
|
|
69
|
-
context '
|
|
71
|
+
context 'with .circleci/BUNDLE_UPDATE_NOTE.md and CIRCLECI_BUNDLE_UPDATE_NOTE.md' do
|
|
70
72
|
before do
|
|
71
73
|
File.open('.circleci/BUNDLE_UPDATE_NOTE.md', 'w') { |f| f.write('I am .circleci/BUNDLE_UPDATE_NOTE.md') }
|
|
72
74
|
File.open('CIRCLECI_BUNDLE_UPDATE_NOTE.md', 'w') { |f| f.write('I am CIRCLECI_BUNDLE_UPDATE_NOTE.md') }
|
|
@@ -75,7 +77,7 @@ describe Circleci::Bundle::Update::Pr::Note do
|
|
|
75
77
|
it { is_expected.to eq 'I am .circleci/BUNDLE_UPDATE_NOTE.md' }
|
|
76
78
|
end
|
|
77
79
|
|
|
78
|
-
context '
|
|
80
|
+
context 'with nothing' do
|
|
79
81
|
it { is_expected.to be_nil }
|
|
80
82
|
end
|
|
81
83
|
end
|
|
@@ -1,45 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
describe Circleci::Bundle::Update::Pr do
|
|
2
4
|
describe '.github_host' do
|
|
3
5
|
subject { Circleci::Bundle::Update::Pr.send(:github_host) }
|
|
6
|
+
|
|
4
7
|
after { ENV['CIRCLE_REPOSITORY_URL'] = nil }
|
|
5
8
|
|
|
6
|
-
context '
|
|
9
|
+
context "when ENV['CIRCLE_REPOSITORY_URL'] is git@github.com:masutaka/compare_linker.git" do
|
|
7
10
|
before { ENV['CIRCLE_REPOSITORY_URL'] = 'git@github.com:masutaka/compare_linker.git' }
|
|
11
|
+
|
|
8
12
|
it { is_expected.to eq 'github.com' }
|
|
9
13
|
end
|
|
10
14
|
|
|
11
|
-
context '
|
|
15
|
+
context "when ENV['CIRCLE_REPOSITORY_URL'] is https://github.com/masutaka/circleci-bundle-update-pr.git" do
|
|
12
16
|
before { ENV['CIRCLE_REPOSITORY_URL'] = 'https://github.com/masutaka/circleci-bundle-update-pr.git' }
|
|
17
|
+
|
|
13
18
|
it { is_expected.to eq 'github.com' }
|
|
14
19
|
end
|
|
15
20
|
|
|
16
|
-
context '
|
|
21
|
+
context "with ENV['CIRCLE_REPOSITORY_URL'] is nil" do
|
|
17
22
|
before { ENV['CIRCLE_REPOSITORY_URL'] = nil }
|
|
23
|
+
|
|
18
24
|
it { is_expected.to eq 'github.com' }
|
|
19
25
|
end
|
|
20
26
|
end
|
|
21
27
|
|
|
22
|
-
describe
|
|
28
|
+
describe '.target_branch?' do
|
|
23
29
|
subject do
|
|
24
30
|
Circleci::Bundle::Update::Pr.send(
|
|
25
31
|
:target_branch?,
|
|
26
32
|
running_branch: running_branch,
|
|
27
|
-
target_branches: [
|
|
33
|
+
target_branches: ['target']
|
|
28
34
|
)
|
|
29
35
|
end
|
|
30
36
|
|
|
31
|
-
context
|
|
37
|
+
context 'when running_target is included in target branches' do
|
|
32
38
|
let(:running_branch) { 'target' }
|
|
39
|
+
|
|
33
40
|
it { is_expected.to be_truthy }
|
|
34
41
|
end
|
|
35
42
|
|
|
36
|
-
context "ENV['CIRCLE_BRANCH'] is not included in target branches" do
|
|
43
|
+
context "when ENV['CIRCLE_BRANCH'] is not included in target branches" do
|
|
37
44
|
let(:running_branch) { 'not_included' }
|
|
45
|
+
|
|
38
46
|
it { is_expected.to be_falsy }
|
|
39
47
|
end
|
|
40
48
|
|
|
41
|
-
context "ENV['CIRCLE_BRANCH'] is nil" do
|
|
49
|
+
context "when ENV['CIRCLE_BRANCH'] is nil" do
|
|
42
50
|
let(:running_branch) { nil }
|
|
51
|
+
|
|
43
52
|
it { is_expected.to be_falsy }
|
|
44
53
|
end
|
|
45
54
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: circleci-bundle-update-pr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.16.0
|
|
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-04-
|
|
11
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: compare_linker
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 1.4.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 1.4.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: octokit
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: '0'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: '0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: bundler
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,7 +80,35 @@ dependencies:
|
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '3.7'
|
|
83
|
-
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rubocop
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rubocop-rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
description: Create GitHub PullRequest of bundle update in CircleCI
|
|
84
112
|
email:
|
|
85
113
|
- masutaka.net@gmail.com
|
|
86
114
|
executables:
|
|
@@ -91,6 +119,8 @@ files:
|
|
|
91
119
|
- ".circleci/config.yml"
|
|
92
120
|
- ".gitignore"
|
|
93
121
|
- ".rspec"
|
|
122
|
+
- ".rubocop.yml"
|
|
123
|
+
- ".rubocop_todo.yml"
|
|
94
124
|
- Gemfile
|
|
95
125
|
- Gemfile.lock
|
|
96
126
|
- LICENSE.txt
|
|
@@ -126,7 +156,7 @@ requirements: []
|
|
|
126
156
|
rubygems_version: 3.0.3
|
|
127
157
|
signing_key:
|
|
128
158
|
specification_version: 4
|
|
129
|
-
summary:
|
|
159
|
+
summary: Provide continues bundle update using CircleCI
|
|
130
160
|
test_files:
|
|
131
161
|
- spec/circleci/bundle/update/pr/note_spec.rb
|
|
132
162
|
- spec/circleci/bundle/update/pr_spec.rb
|