pr_comet 0.2.0 → 0.5.1
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 +137 -108
- data/.dependabot/config.yml +18 -0
- data/.gem_comet.yml +15 -0
- data/.rubocop.yml +1 -1
- data/.rubocop_challenge.yml +3 -0
- data/.rubocop_todo.yml +13 -1
- data/CHANGELOG.md +118 -0
- data/Gemfile.lock +65 -53
- data/README.md +72 -4
- data/bin/release +7 -5
- data/lib/pr_comet.rb +48 -25
- data/lib/pr_comet/command_line.rb +4 -2
- data/lib/pr_comet/git/command.rb +2 -1
- data/lib/pr_comet/github/client.rb +0 -6
- data/lib/pr_comet/rspec.rb +8 -0
- data/lib/pr_comet/rspec/stub.rb +13 -0
- data/lib/pr_comet/version.rb +1 -1
- data/pr_comet.gemspec +3 -3
- data/renovate.json +5 -0
- metadata +18 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1de5a702a941ad3f61b8a3b87f765da115e1feadd39210b45f80e3809d5e123f
|
|
4
|
+
data.tar.gz: 50a81dd0413e6a0d22e992a6f4d757a7180678e54221f1004590a1821f12e345
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81d78d0f2aaabbc1a28374d42591b2e6e413ed18dbf62a5989b206e81b5651534ba8c5115c42dfc2c8731f6fa2865a5857bc4dc50e6f8e5e7e0ead19c5a49a5e
|
|
7
|
+
data.tar.gz: 4a9951f3871295496a7f956d4452d1d5120ee198d00c076f7272f9a271a8f30531c9b49d6c4d95edce5d26d1d80b0c18d2b281cd55c3e8cfefc423a8cb8863e3
|
data/.circleci/config.yml
CHANGED
|
@@ -2,136 +2,88 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
|
4
4
|
#
|
|
5
|
-
version: 2
|
|
5
|
+
version: 2.1
|
|
6
|
+
|
|
7
|
+
orbs:
|
|
8
|
+
ruby-orbs: sue445/ruby-orbs@1.6.1
|
|
9
|
+
code-climate: rvla/code-climate@0.0.2
|
|
6
10
|
|
|
7
11
|
references:
|
|
8
|
-
- &
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
|
|
14
|
-
chmod +x ./tmp/cc-test-reporter
|
|
15
|
-
- &restore_bundle_install_cache
|
|
16
|
-
restore_cache:
|
|
17
|
-
keys:
|
|
18
|
-
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
|
19
|
-
- v1-dependencies-
|
|
20
|
-
- &bundle_install
|
|
21
|
-
run:
|
|
22
|
-
name: Bundle Install
|
|
23
|
-
command: |
|
|
24
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
|
25
|
-
- &save_bundle_install_cache
|
|
26
|
-
save_cache:
|
|
27
|
-
paths:
|
|
28
|
-
- ./vendor/bundle
|
|
29
|
-
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
|
30
|
-
- &run_rspec
|
|
31
|
-
run:
|
|
32
|
-
name: Run Rspec
|
|
33
|
-
command: |
|
|
34
|
-
mkdir /tmp/test-results
|
|
35
|
-
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
|
36
|
-
./tmp/cc-test-reporter before-build
|
|
37
|
-
bundle exec rspec --format documentation \
|
|
38
|
-
--color \
|
|
39
|
-
--format RspecJunitFormatter \
|
|
40
|
-
--out /tmp/test-results/rspec.xml \
|
|
41
|
-
$TEST_FILES
|
|
42
|
-
./tmp/cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?
|
|
12
|
+
- &ruby_version
|
|
13
|
+
ruby_version:
|
|
14
|
+
type: enum
|
|
15
|
+
enum: ['2.5', '2.6', '2.7', '3.0', 'latest']
|
|
16
|
+
default: '3.0'
|
|
43
17
|
|
|
44
|
-
|
|
18
|
+
executors:
|
|
19
|
+
default:
|
|
20
|
+
parameters:
|
|
21
|
+
<<: *ruby_version
|
|
22
|
+
docker:
|
|
23
|
+
- image: circleci/ruby:<< parameters.ruby_version >>
|
|
45
24
|
working_directory: ~/repo
|
|
25
|
+
|
|
26
|
+
commands:
|
|
27
|
+
run_rspec:
|
|
28
|
+
description: Run RSpec
|
|
46
29
|
steps:
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
30
|
+
- code-climate/install
|
|
31
|
+
- run:
|
|
32
|
+
name: Execute RSpec
|
|
33
|
+
command: |
|
|
34
|
+
mkdir /tmp/test-results
|
|
35
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
|
36
|
+
cc-test-reporter before-build
|
|
37
|
+
bundle exec rspec --format documentation \
|
|
38
|
+
--color \
|
|
39
|
+
--format RspecJunitFormatter \
|
|
40
|
+
--out /tmp/test-results/rspec.xml \
|
|
41
|
+
$TEST_FILES
|
|
42
|
+
- code-climate/format-coverage:
|
|
43
|
+
input-type: simplecov
|
|
44
|
+
prefix: $(readlink -f .)
|
|
45
|
+
coverage-file: coverage/coverage.json
|
|
46
|
+
output: coverage/codeclimate.$CIRCLE_BUILD_NUM.json
|
|
47
|
+
- persist_to_workspace:
|
|
48
|
+
root: coverage
|
|
49
|
+
paths:
|
|
50
|
+
- codeclimate.*.json
|
|
53
51
|
- store_test_results:
|
|
54
52
|
path: /tmp/test-results
|
|
55
53
|
- store_artifacts:
|
|
56
54
|
path: /tmp/test-results
|
|
57
55
|
destination: test-results
|
|
58
|
-
|
|
59
|
-
name: Rake Build
|
|
60
|
-
command: |
|
|
61
|
-
bundle exec rake build
|
|
62
|
-
|
|
63
|
-
- &rubocop
|
|
64
|
-
working_directory: ~/repo
|
|
56
|
+
rubocop:
|
|
65
57
|
steps:
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- &yardoc
|
|
73
|
-
working_directory: ~/repo
|
|
58
|
+
- run:
|
|
59
|
+
name: Run RuboCop
|
|
60
|
+
command: bundle exec rubocop
|
|
61
|
+
yardoc:
|
|
62
|
+
description: 'Generate YARDoc'
|
|
74
63
|
steps:
|
|
75
|
-
-
|
|
76
|
-
- *restore_bundle_install_cache
|
|
77
|
-
- *bundle_install
|
|
78
|
-
- *save_bundle_install_cache
|
|
79
|
-
- run: bundle exec yardoc -o ./yardoc
|
|
64
|
+
- run: bundle exec yardoc -o ./yardoc
|
|
80
65
|
- store_artifacts:
|
|
81
66
|
path: ./yardoc
|
|
82
67
|
destination: yardoc
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<<: *build
|
|
89
|
-
build_on_ruby_2.5:
|
|
90
|
-
docker:
|
|
91
|
-
- image: circleci/ruby:2.5-node-browsers
|
|
92
|
-
<<: *build
|
|
93
|
-
build_on_ruby_2.6:
|
|
94
|
-
docker:
|
|
95
|
-
- image: circleci/ruby:2.6-node-browsers
|
|
96
|
-
<<: *build
|
|
97
|
-
build_on_ruby_latest:
|
|
98
|
-
docker:
|
|
99
|
-
- image: circleci/ruby:latest-node-browsers-legacy
|
|
100
|
-
<<: *build
|
|
101
|
-
rubocop:
|
|
102
|
-
docker:
|
|
103
|
-
- image: circleci/ruby:2.4-node-browsers
|
|
104
|
-
<<: *rubocop
|
|
105
|
-
yardoc:
|
|
106
|
-
docker:
|
|
107
|
-
- image: circleci/ruby:2.4-node-browsers
|
|
108
|
-
<<: *yardoc
|
|
109
|
-
|
|
68
|
+
rake_build:
|
|
69
|
+
steps:
|
|
70
|
+
- run:
|
|
71
|
+
name: Rake Build
|
|
72
|
+
command: bundle exec rake build
|
|
110
73
|
rubocop_challenge:
|
|
111
|
-
docker:
|
|
112
|
-
- image: circleci/ruby:2.4-node-browsers
|
|
113
|
-
working_directory: ~/repo
|
|
114
74
|
steps:
|
|
115
|
-
- checkout
|
|
116
75
|
- run:
|
|
117
76
|
name: Rubocop Challenge
|
|
118
77
|
command: |
|
|
119
78
|
gem install rubocop_challenger --pre
|
|
120
79
|
rubocop_challenger go --email=ryz310@gmail.com --name=ryz310
|
|
121
|
-
|
|
122
80
|
release:
|
|
123
|
-
|
|
124
|
-
- image: circleci/ruby:2.4-node-browsers
|
|
125
|
-
working_directory: ~/repo
|
|
81
|
+
description: Release to RubyGems.org
|
|
126
82
|
steps:
|
|
127
|
-
- checkout
|
|
128
|
-
- *restore_bundle_install_cache
|
|
129
|
-
- *bundle_install
|
|
130
|
-
- *save_bundle_install_cache
|
|
131
83
|
- run:
|
|
132
84
|
name: Create Rubygems Credentials
|
|
133
85
|
command: |
|
|
134
|
-
mkdir ~/.gem
|
|
86
|
+
mkdir ~/.gem || true
|
|
135
87
|
echo -e "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}" > ~/.gem/credentials
|
|
136
88
|
chmod 0600 ~/.gem/credentials
|
|
137
89
|
- run:
|
|
@@ -139,24 +91,101 @@ jobs:
|
|
|
139
91
|
command: |
|
|
140
92
|
git push --set-upstream origin ${CIRCLE_BRANCH}
|
|
141
93
|
bundle exec rake release --trace
|
|
94
|
+
setup:
|
|
95
|
+
description: Setup for Job Working
|
|
96
|
+
parameters:
|
|
97
|
+
<<: *ruby_version
|
|
98
|
+
steps:
|
|
99
|
+
- checkout
|
|
100
|
+
- run:
|
|
101
|
+
name: Install bundler v2.x for ruby 2.5 & 2.6
|
|
102
|
+
command: gem install bundler
|
|
103
|
+
- ruby-orbs/bundle-install:
|
|
104
|
+
cache_key_prefix: v1-dependencies-<< parameters.ruby_version >>
|
|
105
|
+
test_and_build:
|
|
106
|
+
description: Build the RubyGem
|
|
107
|
+
steps:
|
|
108
|
+
- run_rspec
|
|
109
|
+
- rake_build
|
|
110
|
+
|
|
111
|
+
jobs:
|
|
112
|
+
build:
|
|
113
|
+
parameters:
|
|
114
|
+
<<: *ruby_version
|
|
115
|
+
executor:
|
|
116
|
+
name: default
|
|
117
|
+
ruby_version: << parameters.ruby_version >>
|
|
118
|
+
steps:
|
|
119
|
+
- setup:
|
|
120
|
+
ruby_version: << parameters.ruby_version >>
|
|
121
|
+
- test_and_build
|
|
122
|
+
upload-coverage:
|
|
123
|
+
executor: default
|
|
124
|
+
steps:
|
|
125
|
+
- attach_workspace:
|
|
126
|
+
at: ~/repo
|
|
127
|
+
- code-climate/install
|
|
128
|
+
- code-climate/sum-coverage:
|
|
129
|
+
input: codeclimate.*.json
|
|
130
|
+
parts: 5
|
|
131
|
+
- code-climate/upload-coverage
|
|
132
|
+
rubocop:
|
|
133
|
+
executor: default
|
|
134
|
+
steps:
|
|
135
|
+
- setup
|
|
136
|
+
- rubocop
|
|
137
|
+
yardoc:
|
|
138
|
+
executor: default
|
|
139
|
+
steps:
|
|
140
|
+
- setup
|
|
141
|
+
- yardoc
|
|
142
|
+
rubocop_challenge:
|
|
143
|
+
executor: default
|
|
144
|
+
steps:
|
|
145
|
+
- checkout
|
|
146
|
+
- rubocop_challenge
|
|
147
|
+
release:
|
|
148
|
+
executor: default
|
|
149
|
+
steps:
|
|
150
|
+
- setup
|
|
151
|
+
- release
|
|
142
152
|
|
|
143
153
|
workflows:
|
|
144
154
|
version: 2
|
|
145
155
|
|
|
146
156
|
commit:
|
|
147
157
|
jobs:
|
|
148
|
-
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
-
|
|
158
|
+
- build:
|
|
159
|
+
name: build_on_ruby_2.5
|
|
160
|
+
ruby_version: '2.5'
|
|
161
|
+
- build:
|
|
162
|
+
name: build_on_ruby_2.6
|
|
163
|
+
ruby_version: '2.6'
|
|
164
|
+
- build:
|
|
165
|
+
name: build_on_ruby_2.7
|
|
166
|
+
ruby_version: '2.7'
|
|
167
|
+
- build:
|
|
168
|
+
name: build_on_ruby_3.0
|
|
169
|
+
ruby_version: '3.0'
|
|
170
|
+
- build:
|
|
171
|
+
name: build_on_ruby_latest
|
|
172
|
+
ruby_version: 'latest'
|
|
152
173
|
- rubocop
|
|
153
174
|
- yardoc
|
|
175
|
+
- upload-coverage:
|
|
176
|
+
requires:
|
|
177
|
+
- build_on_ruby_2.5
|
|
178
|
+
- build_on_ruby_2.6
|
|
179
|
+
- build_on_ruby_2.7
|
|
180
|
+
- build_on_ruby_3.0
|
|
181
|
+
- build_on_ruby_latest
|
|
154
182
|
- release:
|
|
155
183
|
context: RubyGems API Key
|
|
156
184
|
requires:
|
|
157
|
-
- build_on_ruby_2.4
|
|
158
185
|
- build_on_ruby_2.5
|
|
159
186
|
- build_on_ruby_2.6
|
|
187
|
+
- build_on_ruby_2.7
|
|
188
|
+
- build_on_ruby_3.0
|
|
160
189
|
- build_on_ruby_latest
|
|
161
190
|
- rubocop
|
|
162
191
|
filters:
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
version: 1
|
|
2
|
+
update_configs:
|
|
3
|
+
- package_manager: "ruby:bundler"
|
|
4
|
+
directory: "/"
|
|
5
|
+
update_schedule: "live"
|
|
6
|
+
default_reviewers:
|
|
7
|
+
- "ryz310"
|
|
8
|
+
default_assignees:
|
|
9
|
+
- "ryz310"
|
|
10
|
+
default_labels:
|
|
11
|
+
- "dependabot"
|
|
12
|
+
automerged_updates:
|
|
13
|
+
- match:
|
|
14
|
+
dependency_type: "development"
|
|
15
|
+
update_type: "all"
|
|
16
|
+
- match:
|
|
17
|
+
dependency_type: "production"
|
|
18
|
+
update_type: "semver:patch"
|
data/.gem_comet.yml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# [Usage]
|
|
2
|
+
#
|
|
3
|
+
# $ gem install gem_comet
|
|
4
|
+
# $ gem_comet init
|
|
5
|
+
# $ gem_comet release {version number, like as "1.2.3"}
|
|
6
|
+
# $ gem_comet changelog
|
|
7
|
+
# $ gem_comet versions
|
|
8
|
+
|
|
9
|
+
version: 1.1
|
|
10
|
+
|
|
11
|
+
release:
|
|
12
|
+
base_branch: master
|
|
13
|
+
release_branch: production
|
|
14
|
+
version_file_path: lib/pr_comet/version.rb
|
|
15
|
+
changelog_file_path: CHANGELOG.md
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2021-01-11 09:02:52 UTC using RuboCop version 1.8.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
10
|
+
# Configuration parameters: Include.
|
|
11
|
+
# Include: **/*.gemspec
|
|
12
|
+
Gemspec/RequiredRubyVersion:
|
|
13
|
+
Exclude:
|
|
14
|
+
- 'pr_comet.gemspec'
|
|
15
|
+
|
|
16
|
+
# Offense count: 15
|
|
17
|
+
# Configuration parameters: AllowSubject.
|
|
18
|
+
RSpec/MultipleMemoizedHelpers:
|
|
19
|
+
Max: 9
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Change log
|
|
2
|
+
|
|
3
|
+
## v0.5.1 (Jan 11, 2021)
|
|
4
|
+
|
|
5
|
+
### Bugfix
|
|
6
|
+
|
|
7
|
+
* [#220](https://github.com/ryz310/pr_comet/pull/220) Fix verbose option ([@ryz310](https://github.com/ryz310))
|
|
8
|
+
|
|
9
|
+
### Dependabot
|
|
10
|
+
|
|
11
|
+
* [#199](https://github.com/ryz310/pr_comet/pull/199) Update bundler requirement from ~> 1.16 to ~> 2.2 ([@ryz310](https://github.com/ryz310))
|
|
12
|
+
* [#219](https://github.com/ryz310/pr_comet/pull/219) ryz310/dependabot/bundler/rubocop-1.8.1 ([@ryz310](https://github.com/ryz310))
|
|
13
|
+
|
|
14
|
+
## v0.5.0 (Jan 11, 2021)
|
|
15
|
+
|
|
16
|
+
### Feature
|
|
17
|
+
|
|
18
|
+
* [#216](https://github.com/ryz310/pr_comet/pull/216) Add verbose option ([@ryz310](https://github.com/ryz310))
|
|
19
|
+
|
|
20
|
+
### Dependabot
|
|
21
|
+
|
|
22
|
+
* [#215](https://github.com/ryz310/pr_comet/pull/215) Update simplecov requirement from = 0.17.1 to = 0.21.2 ([@ryz310](https://github.com/ryz310))
|
|
23
|
+
* [#214](https://github.com/ryz310/pr_comet/pull/214) ryz310/dependabot/bundler/rubocop-1.8.0 ([@ryz310](https://github.com/ryz310))
|
|
24
|
+
|
|
25
|
+
## v0.4.0 (Jan 04, 2021)
|
|
26
|
+
|
|
27
|
+
### Feature
|
|
28
|
+
|
|
29
|
+
* [#210](https://github.com/ryz310/pr_comet/pull/210) Support ruby 3.0 ([@ryz310](https://github.com/ryz310))
|
|
30
|
+
|
|
31
|
+
### Breaking Change
|
|
32
|
+
|
|
33
|
+
* [#176](https://github.com/ryz310/pr_comet/pull/176) End of support for Ruby 2.4 ([@ryz310](https://github.com/ryz310))
|
|
34
|
+
|
|
35
|
+
### Rubocop Challenge
|
|
36
|
+
|
|
37
|
+
* [#127](https://github.com/ryz310/pr_comet/pull/127) Style/IfUnlessModifier-20200523233029 ([@ryz310](https://github.com/ryz310))
|
|
38
|
+
* [#129](https://github.com/ryz310/pr_comet/pull/129) Performance/StartWith-20200525233033 ([@ryz310](https://github.com/ryz310))
|
|
39
|
+
* [#204](https://github.com/ryz310/pr_comet/pull/204) Re-generate .rubocop_todo.yml with RuboCop v1.7.0 ([@ryz310](https://github.com/ryz310))
|
|
40
|
+
|
|
41
|
+
### Dependabot
|
|
42
|
+
|
|
43
|
+
* [#110](https://github.com/ryz310/pr_comet/pull/110) ryz310/dependabot/bundler/pry-byebug-3.9.0 ([@ryz310](https://github.com/ryz310))
|
|
44
|
+
* [#174](https://github.com/ryz310/pr_comet/pull/174) ryz310/dependabot/bundler/rspec-3.10.0 ([@ryz310](https://github.com/ryz310))
|
|
45
|
+
* [#198](https://github.com/ryz310/pr_comet/pull/198) ryz310/dependabot/bundler/rubocop-1.6.1 ([@ryz310](https://github.com/ryz310))
|
|
46
|
+
* [#201](https://github.com/ryz310/pr_comet/pull/201) ryz310/dependabot/bundler/rubocop-rspec-2.1.0 ([@ryz310](https://github.com/ryz310))
|
|
47
|
+
* [#202](https://github.com/ryz310/pr_comet/pull/202) ryz310/dependabot/bundler/rake-13.0.2 ([@ryz310](https://github.com/ryz310))
|
|
48
|
+
* [#205](https://github.com/ryz310/pr_comet/pull/205) ryz310/dependabot/bundler/yard-0.9.26 ([@ryz310](https://github.com/ryz310))
|
|
49
|
+
* [#206](https://github.com/ryz310/pr_comet/pull/206) ryz310/dependabot/bundler/octokit-4.20.0 ([@ryz310](https://github.com/ryz310))
|
|
50
|
+
* [#209](https://github.com/ryz310/pr_comet/pull/209) ryz310/dependabot/bundler/rubocop-performance-1.9.2 ([@ryz310](https://github.com/ryz310))
|
|
51
|
+
|
|
52
|
+
### Misc
|
|
53
|
+
|
|
54
|
+
* [#91](https://github.com/ryz310/pr_comet/pull/91) Update ruby-orbs orb to v1.6.0 ([@ryz310](https://github.com/ryz310))
|
|
55
|
+
* [#111](https://github.com/ryz310/pr_comet/pull/111) Edit dependabot configuration ([@ryz310](https://github.com/ryz310))
|
|
56
|
+
|
|
57
|
+
## v0.3.1 (Nov 02, 2019)
|
|
58
|
+
|
|
59
|
+
### Feature
|
|
60
|
+
|
|
61
|
+
* [#60](https://github.com/ryz310/pr_comet/pull/60) Stub pr comet ([@ryz310](https://github.com/ryz310))
|
|
62
|
+
|
|
63
|
+
### Rubocop Challenge
|
|
64
|
+
|
|
65
|
+
* [#37](https://github.com/ryz310/pr_comet/pull/37) Re-generate .rubocop_todo.yml with RuboCop v0.73.0 ([@ryz310](https://github.com/ryz310))
|
|
66
|
+
* [#38](https://github.com/ryz310/pr_comet/pull/38) Performance/RegexpMatch-20190729233036 ([@ryz310](https://github.com/ryz310))
|
|
67
|
+
* [#39](https://github.com/ryz310/pr_comet/pull/39) Re-generate .rubocop_todo.yml with RuboCop v0.74.0 ([@ryz310](https://github.com/ryz310))
|
|
68
|
+
* [#45](https://github.com/ryz310/pr_comet/pull/45) Re-generate .rubocop_todo.yml with RuboCop v0.75.0 ([@ryz310](https://github.com/ryz310))
|
|
69
|
+
* [#50](https://github.com/ryz310/pr_comet/pull/50) Re-generate .rubocop_todo.yml with RuboCop v0.75.1 ([@ryz310](https://github.com/ryz310))
|
|
70
|
+
* [#55](https://github.com/ryz310/pr_comet/pull/55) Re-generate .rubocop_todo.yml with RuboCop v0.76.0 ([@ryz310](https://github.com/ryz310))
|
|
71
|
+
|
|
72
|
+
### Misc
|
|
73
|
+
|
|
74
|
+
* [#44](https://github.com/ryz310/pr_comet/pull/44) Bump rubocop-rspec from 1.34.1 to 1.36.0 ([@ryz310](https://github.com/ryz310))
|
|
75
|
+
* [#40](https://github.com/ryz310/pr_comet/pull/40) ryz310/dependabot/bundler/simplecov-0.17.1 ([@ryz310](https://github.com/ryz310))
|
|
76
|
+
* [#43](https://github.com/ryz310/pr_comet/pull/43) ryz310/dependabot/bundler/rake-tw-13.0 ([@ryz310](https://github.com/ryz310))
|
|
77
|
+
* [#48](https://github.com/ryz310/pr_comet/pull/48) ryz310/dependabot/bundler/rspec-3.9.0 ([@ryz310](https://github.com/ryz310))
|
|
78
|
+
* [#47](https://github.com/ryz310/pr_comet/pull/47) ryz310/dependabot/bundler/rubocop-performance-1.5.0 ([@ryz310](https://github.com/ryz310))
|
|
79
|
+
* [#53](https://github.com/ryz310/pr_comet/pull/53) Configure Renovate ([@ryz310](https://github.com/ryz310))
|
|
80
|
+
* [#56](https://github.com/ryz310/pr_comet/pull/56) Update ruby-orbs orb to v1.4.4 ([@ryz310](https://github.com/ryz310))
|
|
81
|
+
* [#61](https://github.com/ryz310/pr_comet/pull/61) Install gem_comet :comet: ([@ryz310](https://github.com/ryz310))
|
|
82
|
+
|
|
83
|
+
## v0.3.0 (Jul 12, 2019)
|
|
84
|
+
|
|
85
|
+
### Feature
|
|
86
|
+
|
|
87
|
+
* [#34](https://github.com/ryz310/pr_comet/pull/34) Support blank PR creation ([@ryz310](https://github.com/ryz310))
|
|
88
|
+
|
|
89
|
+
## v0.2.1 (Jul 12, 2019)
|
|
90
|
+
|
|
91
|
+
### Misc
|
|
92
|
+
|
|
93
|
+
* [#28](https://github.com/ryz310/pr_comet/pull/28) Re-generate .rubocop_todo.yml with RuboCop v0.72.0 ([@ryz310](https://github.com/ryz310))
|
|
94
|
+
* [#29](https://github.com/ryz310/pr_comet/pull/29) Migrate cirecle ci config to v2.1 ([@ryz310](https://github.com/ryz310))
|
|
95
|
+
* [#30](https://github.com/ryz310/pr_comet/pull/30) Improvement of the test coverage ([@ryz310](https://github.com/ryz310))
|
|
96
|
+
|
|
97
|
+
## v0.2.0 (Jun 09, 2019)
|
|
98
|
+
|
|
99
|
+
### Feature
|
|
100
|
+
|
|
101
|
+
* [#16](https://github.com/ryz310/pr_comet/pull/16) Use rainbow gem ([@ryz310](https://github.com/ryz310))
|
|
102
|
+
* [#18](https://github.com/ryz310/pr_comet/pull/18) Support GitHub project ([@ryz310](https://github.com/ryz310))
|
|
103
|
+
|
|
104
|
+
### Misc
|
|
105
|
+
|
|
106
|
+
* [#5](https://github.com/ryz310/pr_comet/pull/5) Re-generate .rubocop_todo.yml with RuboCop v0.68.0 ([@ryz310](https://github.com/ryz310))
|
|
107
|
+
* [#12](https://github.com/ryz310/pr_comet/pull/12) Re-generate .rubocop_todo.yml with RuboCop v0.68.1 ([@ryz310](https://github.com/ryz310))
|
|
108
|
+
* [#13](https://github.com/ryz310/pr_comet/pull/13) Re-generate .rubocop_todo.yml with RuboCop v0.69.0 ([@ryz310](https://github.com/ryz310))
|
|
109
|
+
* [#15](https://github.com/ryz310/pr_comet/pull/15) Re-generate .rubocop_todo.yml with RuboCop v0.70.0 ([@ryz310](https://github.com/ryz310))
|
|
110
|
+
* [#17](https://github.com/ryz310/pr_comet/pull/17) Re-generate .rubocop_todo.yml with RuboCop v0.71.0 ([@ryz310](https://github.com/ryz310))
|
|
111
|
+
|
|
112
|
+
## v0.1.1 (Apr 08, 2019)
|
|
113
|
+
|
|
114
|
+
Fix bugs.
|
|
115
|
+
|
|
116
|
+
## v0.1.0 (Apr 08, 2019)
|
|
117
|
+
|
|
118
|
+
Initial release! :rocket:
|
data/Gemfile.lock
CHANGED
|
@@ -1,93 +1,105 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
pr_comet (0.
|
|
4
|
+
pr_comet (0.5.1)
|
|
5
5
|
octokit
|
|
6
6
|
rainbow
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
addressable (2.
|
|
12
|
-
public_suffix (>= 2.0.2, <
|
|
13
|
-
ast (2.4.
|
|
14
|
-
byebug (11.
|
|
15
|
-
coderay (1.1.
|
|
16
|
-
diff-lcs (1.
|
|
17
|
-
docile (1.3.
|
|
18
|
-
faraday (
|
|
11
|
+
addressable (2.7.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
13
|
+
ast (2.4.1)
|
|
14
|
+
byebug (11.1.3)
|
|
15
|
+
coderay (1.1.3)
|
|
16
|
+
diff-lcs (1.4.4)
|
|
17
|
+
docile (1.3.4)
|
|
18
|
+
faraday (1.3.0)
|
|
19
|
+
faraday-net_http (~> 1.0)
|
|
19
20
|
multipart-post (>= 1.2, < 3)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
method_source (0.
|
|
21
|
+
ruby2_keywords
|
|
22
|
+
faraday-net_http (1.0.0)
|
|
23
|
+
method_source (1.0.0)
|
|
23
24
|
multipart-post (2.1.1)
|
|
24
|
-
octokit (4.
|
|
25
|
+
octokit (4.20.0)
|
|
26
|
+
faraday (>= 0.9)
|
|
25
27
|
sawyer (~> 0.8.0, >= 0.5.3)
|
|
26
|
-
parallel (1.
|
|
27
|
-
parser (
|
|
28
|
-
ast (~> 2.4.
|
|
29
|
-
pry (0.
|
|
30
|
-
coderay (~> 1.1
|
|
31
|
-
method_source (~>
|
|
32
|
-
pry-byebug (3.
|
|
28
|
+
parallel (1.20.1)
|
|
29
|
+
parser (3.0.0.0)
|
|
30
|
+
ast (~> 2.4.1)
|
|
31
|
+
pry (0.13.1)
|
|
32
|
+
coderay (~> 1.1)
|
|
33
|
+
method_source (~> 1.0)
|
|
34
|
+
pry-byebug (3.9.0)
|
|
33
35
|
byebug (~> 11.0)
|
|
34
|
-
pry (~> 0.
|
|
35
|
-
public_suffix (
|
|
36
|
+
pry (~> 0.13.0)
|
|
37
|
+
public_suffix (4.0.6)
|
|
36
38
|
rainbow (3.0.0)
|
|
37
|
-
rake (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
rspec-
|
|
42
|
-
|
|
43
|
-
rspec-
|
|
44
|
-
rspec-
|
|
39
|
+
rake (13.0.3)
|
|
40
|
+
regexp_parser (2.0.3)
|
|
41
|
+
rexml (3.2.4)
|
|
42
|
+
rspec (3.10.0)
|
|
43
|
+
rspec-core (~> 3.10.0)
|
|
44
|
+
rspec-expectations (~> 3.10.0)
|
|
45
|
+
rspec-mocks (~> 3.10.0)
|
|
46
|
+
rspec-core (3.10.1)
|
|
47
|
+
rspec-support (~> 3.10.0)
|
|
48
|
+
rspec-expectations (3.10.1)
|
|
45
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
46
|
-
rspec-support (~> 3.
|
|
47
|
-
rspec-mocks (3.
|
|
50
|
+
rspec-support (~> 3.10.0)
|
|
51
|
+
rspec-mocks (3.10.1)
|
|
48
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
49
|
-
rspec-support (~> 3.
|
|
50
|
-
rspec-support (3.
|
|
53
|
+
rspec-support (~> 3.10.0)
|
|
54
|
+
rspec-support (3.10.1)
|
|
51
55
|
rspec_junit_formatter (0.4.1)
|
|
52
56
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
53
|
-
rubocop (
|
|
54
|
-
jaro_winkler (~> 1.5.1)
|
|
57
|
+
rubocop (1.8.1)
|
|
55
58
|
parallel (~> 1.10)
|
|
56
|
-
parser (>=
|
|
59
|
+
parser (>= 3.0.0.0)
|
|
57
60
|
rainbow (>= 2.2.2, < 4.0)
|
|
61
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
62
|
+
rexml
|
|
63
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
58
64
|
ruby-progressbar (~> 1.7)
|
|
59
|
-
unicode-display_width (>= 1.4.0, <
|
|
60
|
-
rubocop-
|
|
61
|
-
|
|
62
|
-
rubocop-
|
|
63
|
-
rubocop (>= 0.
|
|
64
|
-
|
|
65
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
66
|
+
rubocop-ast (1.4.0)
|
|
67
|
+
parser (>= 2.7.1.5)
|
|
68
|
+
rubocop-performance (1.9.2)
|
|
69
|
+
rubocop (>= 0.90.0, < 2.0)
|
|
70
|
+
rubocop-ast (>= 0.4.0)
|
|
71
|
+
rubocop-rspec (2.1.0)
|
|
72
|
+
rubocop (~> 1.0)
|
|
73
|
+
rubocop-ast (>= 1.1.0)
|
|
74
|
+
ruby-progressbar (1.11.0)
|
|
75
|
+
ruby2_keywords (0.0.2)
|
|
65
76
|
sawyer (0.8.2)
|
|
66
77
|
addressable (>= 2.3.5)
|
|
67
78
|
faraday (> 0.8, < 2.0)
|
|
68
|
-
simplecov (0.
|
|
79
|
+
simplecov (0.21.2)
|
|
69
80
|
docile (~> 1.1)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
simplecov-html (0.
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
simplecov-html (~> 0.11)
|
|
82
|
+
simplecov_json_formatter (~> 0.1)
|
|
83
|
+
simplecov-html (0.12.3)
|
|
84
|
+
simplecov_json_formatter (0.1.2)
|
|
85
|
+
unicode-display_width (2.0.0)
|
|
86
|
+
yard (0.9.26)
|
|
75
87
|
|
|
76
88
|
PLATFORMS
|
|
77
89
|
ruby
|
|
78
90
|
|
|
79
91
|
DEPENDENCIES
|
|
80
|
-
bundler (~>
|
|
92
|
+
bundler (~> 2.2)
|
|
81
93
|
pr_comet!
|
|
82
94
|
pry-byebug
|
|
83
|
-
rake (~>
|
|
95
|
+
rake (~> 13.0)
|
|
84
96
|
rspec
|
|
85
97
|
rspec_junit_formatter
|
|
86
98
|
rubocop
|
|
87
99
|
rubocop-performance
|
|
88
100
|
rubocop-rspec
|
|
89
|
-
simplecov
|
|
101
|
+
simplecov (= 0.21.2)
|
|
90
102
|
yard
|
|
91
103
|
|
|
92
104
|
BUNDLED WITH
|
|
93
|
-
|
|
105
|
+
2.2.4
|
data/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://circleci.com/gh/ryz310/pr_comet) [](https://badge.fury.io/rb/pr_comet) [](https://codeclimate.com/github/ryz310/pr_comet/maintainability) [](https://codeclimate.com/github/ryz310/pr_comet/test_coverage)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
TODO: Delete this and the text above, and describe your gem
|
|
5
|
+
A helper library that makes it easy to create pull requests.
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
10
8
|
|
|
@@ -24,7 +22,77 @@ Or install it yourself as:
|
|
|
24
22
|
|
|
25
23
|
## Usage
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
```ruby
|
|
26
|
+
# Initialize.
|
|
27
|
+
pr_comet = PrComet.new(base: 'master', branch: '{branch name}')
|
|
28
|
+
|
|
29
|
+
# Modify arbitrary files and commit into the block.
|
|
30
|
+
pr_comet.commit '{commit message}' do
|
|
31
|
+
file = File.read('path/to/file')
|
|
32
|
+
file.sub!('hoge', 'fuga')
|
|
33
|
+
File.write('path/to/file', file)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# You can also change files outer the block.
|
|
37
|
+
`bundle update`
|
|
38
|
+
pr_comet.commit '$ bundle update'
|
|
39
|
+
|
|
40
|
+
# Create a new pull request.
|
|
41
|
+
pr_comet.create!(
|
|
42
|
+
title: 'New pull request',
|
|
43
|
+
body: '{New pull request body}',
|
|
44
|
+
labels: ['label 1', 'label 2'] # optional
|
|
45
|
+
)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Rspec
|
|
49
|
+
|
|
50
|
+
### Testing
|
|
51
|
+
|
|
52
|
+
You can stub `PrComet` class for testing.
|
|
53
|
+
Add the following code to `spec/spec_helper`:
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
require 'pr_comet/rspec'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then you can use `#stub_pr_comet!`.
|
|
60
|
+
It makes `PrComet` class to stubbing and `PrComet.new` will return stubbed `PrComet` instance.
|
|
61
|
+
The stubbed `PrComet#commit` does not execute `$ git commit`, but it executes given block code.
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
def create_pr
|
|
65
|
+
pr_comet = PrComet.new(base: 'master', branch: 'any-branch') # stubbed.
|
|
66
|
+
pr_comet.commit 'Hello world.' do # stubbed.
|
|
67
|
+
File.write('path/to/file.txt', 'Hello world.') # not stubbed.
|
|
68
|
+
end
|
|
69
|
+
pr_comet.create!(title: 'New pull request') # stubbed.
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
stub_pr_comet!
|
|
73
|
+
allow(File).to receive(:write)
|
|
74
|
+
create_pr
|
|
75
|
+
expect(File).to have_received(:write).with('path/to/file.txt', 'Hello world.')
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If you want to test about `PrComet`, you can use `#stub_pr_comet!` return value.
|
|
79
|
+
It returns any instance of `PrComet`.
|
|
80
|
+
|
|
81
|
+
```ruby
|
|
82
|
+
def create_pr
|
|
83
|
+
pr_comet = PrComet.new(base: 'master', branch: 'any-branch')
|
|
84
|
+
pr_comet.commit 'commit message' do
|
|
85
|
+
# ...
|
|
86
|
+
end
|
|
87
|
+
pr_comet.create!(title: 'New pull request')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
pr_comet = stub_pr_comet!
|
|
91
|
+
create_pr
|
|
92
|
+
expect(PrComet).to have_received(:new).with(base: 'master', branch: 'any-branch')
|
|
93
|
+
expect(pr_comet).to have_received(:commit).with('commit message')
|
|
94
|
+
expect(pr_comet).to have_received(:create!).with(title: 'New pull request')
|
|
95
|
+
```
|
|
28
96
|
|
|
29
97
|
## Development
|
|
30
98
|
|
data/bin/release
CHANGED
|
@@ -8,14 +8,15 @@ require 'pr_comet'
|
|
|
8
8
|
|
|
9
9
|
VERSION_FORMAT = /\A\d+\.\d+\.\d+(\.(pre|beta|rc)\d?)?\z/.freeze
|
|
10
10
|
version = ARGV[0]
|
|
11
|
-
|
|
11
|
+
update_pr = PrComet.new(base: 'master', branch: "update/v#{version}")
|
|
12
|
+
release_pr = PrComet.new(base: 'production', branch: 'master')
|
|
12
13
|
|
|
13
14
|
# Verifying
|
|
14
15
|
abort 'usage: bin/release VERSION' if version.nil?
|
|
15
|
-
abort 'A version must be like a `1.2.3`' unless version
|
|
16
|
+
abort 'A version must be like a `1.2.3`' unless VERSION_FORMAT.match?(version)
|
|
16
17
|
|
|
17
18
|
# Modify a version file
|
|
18
|
-
|
|
19
|
+
update_pr.commit ':comet: Update version' do
|
|
19
20
|
File.write('lib/pr_comet/version.rb', <<~VERSION)
|
|
20
21
|
# frozen_string_literal: true
|
|
21
22
|
|
|
@@ -26,9 +27,10 @@ pr_comet.commit ':comet: Update version' do
|
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
# Bundle Update
|
|
29
|
-
|
|
30
|
+
update_pr.commit ':comet: Run $ bundle update' do
|
|
30
31
|
`bundle update`
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
# Create a pull request
|
|
34
|
-
|
|
35
|
+
update_pr.create!(title: "Update v#{version}", body: '')
|
|
36
|
+
release_pr.create!(title: "Release v#{version}", body: '', validate: false)
|
data/lib/pr_comet.rb
CHANGED
|
@@ -13,16 +13,16 @@ require 'pr_comet/github/client'
|
|
|
13
13
|
class PrComet
|
|
14
14
|
# @note You have to set ENV['GITHUB_ACCESS_TOKEN']
|
|
15
15
|
# @param base [String] The branch you want your changes pulled into
|
|
16
|
-
# @param branch [String] The branch where your changes are going to
|
|
17
|
-
# implement.
|
|
16
|
+
# @param branch [String] The branch where your changes are going to implement.
|
|
18
17
|
# @param user_name [String] The username to use for committer and author
|
|
19
18
|
# @param user_email [String] The email to use for committer and author
|
|
20
|
-
|
|
19
|
+
# @param verbose [Boolean] Displays executing commands
|
|
20
|
+
def initialize(base:, branch:, user_name: nil, user_email: nil, verbose: false)
|
|
21
21
|
raise "You have to set ENV['GITHUB_ACCESS_TOKEN']" if access_token.nil?
|
|
22
22
|
|
|
23
23
|
@base_branch = base
|
|
24
24
|
@topic_branch = branch
|
|
25
|
-
@git = Git::Command.new(user_name: user_name, user_email: user_email)
|
|
25
|
+
@git = Git::Command.new(user_name: user_name, user_email: user_email, verbose: verbose)
|
|
26
26
|
@github = Github::Client.new(access_token, git.remote_url('origin'))
|
|
27
27
|
@initial_sha1 = git.current_sha1
|
|
28
28
|
end
|
|
@@ -42,44 +42,67 @@ class PrComet
|
|
|
42
42
|
result
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
# Create a pull request
|
|
46
|
-
#
|
|
45
|
+
# Create a pull request. You should call #commit before calling this method.
|
|
46
|
+
# If you want to create a blank PR, you can do it with `validate: false`
|
|
47
|
+
# option.
|
|
47
48
|
#
|
|
48
|
-
# @param
|
|
49
|
-
#
|
|
50
|
-
# @
|
|
49
|
+
# @param options [Hash]
|
|
50
|
+
# Options for the PR creation.
|
|
51
|
+
# @option title [String]
|
|
52
|
+
# The title for the pull request
|
|
53
|
+
# @option body [String]
|
|
54
|
+
# The body for the pull request
|
|
55
|
+
# @option labels [Array<String>]
|
|
51
56
|
# List of labels. It is a optional parameter. You can add labels to the
|
|
52
57
|
# created PR.
|
|
53
|
-
# @
|
|
58
|
+
# @option project_column_name [String]
|
|
54
59
|
# A project column name. It is a optional parameter. You can add the created
|
|
55
60
|
# PR to the GitHub project.
|
|
56
|
-
# @
|
|
61
|
+
# @option project_id [Integer]
|
|
57
62
|
# A target project ID. It is a optional parameter. If does not supplied,
|
|
58
63
|
# this method will find a project which associated the repository.
|
|
59
|
-
# When the repository
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
# When the repository is associated with multiple projects, you should
|
|
65
|
+
# supply this.
|
|
66
|
+
# @option validate [Boolean]
|
|
67
|
+
# Verifies the branch has commits and checkout to the topic branch. If you
|
|
68
|
+
# want to create a blank PR, set "false" to this option. default: true.
|
|
69
|
+
# @return [Boolean]
|
|
70
|
+
# Return true if it is successed.
|
|
71
|
+
# rubocop:disable Metrics/AbcSize
|
|
72
|
+
def create!(**options)
|
|
73
|
+
options[:validate] = true if options[:validate].nil?
|
|
74
|
+
return false if options[:validate] && !git_condition_valid?
|
|
64
75
|
|
|
65
76
|
git.push(github_token_url, topic_branch)
|
|
66
|
-
pr_number = github.create_pull_request(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
unless project_column_name.nil?
|
|
71
|
-
github.add_to_project(
|
|
72
|
-
pr_number, column_name: project_column_name, project_id: project_id
|
|
73
|
-
)
|
|
77
|
+
pr_number = github.create_pull_request(**generate_create_pr_options(**options))
|
|
78
|
+
github.add_labels(pr_number, *options[:labels]) unless options[:labels].nil?
|
|
79
|
+
unless options[:project_column_name].nil?
|
|
80
|
+
github.add_to_project(pr_number, **generate_add_to_project_options(**options))
|
|
74
81
|
end
|
|
75
82
|
true
|
|
76
83
|
end
|
|
77
|
-
# rubocop:enable Metrics/AbcSize
|
|
84
|
+
# rubocop:enable Metrics/AbcSize
|
|
78
85
|
|
|
79
86
|
private
|
|
80
87
|
|
|
81
88
|
attr_reader :git, :github, :base_branch, :topic_branch, :initial_sha1
|
|
82
89
|
|
|
90
|
+
def generate_create_pr_options(**options)
|
|
91
|
+
{
|
|
92
|
+
base: base_branch,
|
|
93
|
+
head: topic_branch,
|
|
94
|
+
title: options[:title],
|
|
95
|
+
body: options[:body]
|
|
96
|
+
}
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def generate_add_to_project_options(**options)
|
|
100
|
+
{
|
|
101
|
+
column_name: options[:project_column_name],
|
|
102
|
+
project_id: options[:project_id]
|
|
103
|
+
}
|
|
104
|
+
end
|
|
105
|
+
|
|
83
106
|
def git_condition_valid?
|
|
84
107
|
!git.current_sha1?(initial_sha1) && git.current_branch?(topic_branch)
|
|
85
108
|
end
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
class PrComet
|
|
4
4
|
# To execute command line. You should inherit this class to use.
|
|
5
5
|
module CommandLine
|
|
6
|
+
attr_reader :verbose
|
|
7
|
+
|
|
6
8
|
private
|
|
7
9
|
|
|
8
10
|
# Execute a command
|
|
@@ -10,10 +12,10 @@ class PrComet
|
|
|
10
12
|
# @param command [String] The command you want to execute
|
|
11
13
|
# @return [String] The result in the execution
|
|
12
14
|
def execute(command)
|
|
13
|
-
puts "$ #{command}"
|
|
15
|
+
puts "$ #{command}" if verbose
|
|
14
16
|
`#{command}`.chomp.tap do |result|
|
|
15
17
|
color = $CHILD_STATUS.success? ? :green : :red
|
|
16
|
-
puts Rainbow(result).color(color)
|
|
18
|
+
puts Rainbow(result).color(color) if verbose
|
|
17
19
|
end
|
|
18
20
|
end
|
|
19
21
|
end
|
data/lib/pr_comet/git/command.rb
CHANGED
|
@@ -6,9 +6,10 @@ class PrComet
|
|
|
6
6
|
class Command
|
|
7
7
|
include CommandLine
|
|
8
8
|
|
|
9
|
-
def initialize(user_name: nil, user_email: nil)
|
|
9
|
+
def initialize(user_name: nil, user_email: nil, verbose: false)
|
|
10
10
|
@user_name = user_name
|
|
11
11
|
@user_email = user_email
|
|
12
|
+
@verbose = verbose
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def user_name
|
|
@@ -71,8 +71,6 @@ class PrComet
|
|
|
71
71
|
# @return [Integer, nil] Project column ID
|
|
72
72
|
def get_project_column_id(project_id, column_name)
|
|
73
73
|
find_project_columns(project_id).find { |c| c.name == column_name }.id
|
|
74
|
-
rescue StandardError
|
|
75
|
-
raise "Cannot find the GitHub project column with '#{column_name}'"
|
|
76
74
|
end
|
|
77
75
|
|
|
78
76
|
# Returns the issue (or pull request) ID
|
|
@@ -91,8 +89,6 @@ class PrComet
|
|
|
91
89
|
# @see http://octokit.github.io/octokit.rb/Octokit/Client/Projects.html#projects-instance_method
|
|
92
90
|
def default_project_id
|
|
93
91
|
client.projects(repository).first.id
|
|
94
|
-
rescue Octokit::Error
|
|
95
|
-
raise 'Project does not found on this repository'
|
|
96
92
|
end
|
|
97
93
|
|
|
98
94
|
# Finds project columns with supplied project ID.
|
|
@@ -102,8 +98,6 @@ class PrComet
|
|
|
102
98
|
# @see http://octokit.github.io/octokit.rb/Octokit/Client/Projects.html#project_columns-instance_method
|
|
103
99
|
def find_project_columns(project_id)
|
|
104
100
|
client.project_columns(project_id)
|
|
105
|
-
rescue Octokit::Error
|
|
106
|
-
raise "Project columns does not found at project_id:#{project_id}"
|
|
107
101
|
end
|
|
108
102
|
end
|
|
109
103
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class PrComet
|
|
4
|
+
# Test helper module for RSpec
|
|
5
|
+
module Stub
|
|
6
|
+
def stub_pr_comet!
|
|
7
|
+
instance_double(PrComet, create!: true).tap do |pr_comet|
|
|
8
|
+
allow(pr_comet).to receive(:commit) { |_message, &block| block&.call }
|
|
9
|
+
allow(PrComet).to receive(:new).and_return(pr_comet)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/pr_comet/version.rb
CHANGED
data/pr_comet.gemspec
CHANGED
|
@@ -25,14 +25,14 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.add_runtime_dependency 'octokit'
|
|
26
26
|
spec.add_runtime_dependency 'rainbow'
|
|
27
27
|
|
|
28
|
-
spec.add_development_dependency 'bundler', '~>
|
|
28
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
|
29
29
|
spec.add_development_dependency 'pry-byebug'
|
|
30
|
-
spec.add_development_dependency 'rake', '~>
|
|
30
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
31
31
|
spec.add_development_dependency 'rspec'
|
|
32
32
|
spec.add_development_dependency 'rspec_junit_formatter'
|
|
33
33
|
spec.add_development_dependency 'rubocop'
|
|
34
34
|
spec.add_development_dependency 'rubocop-performance'
|
|
35
35
|
spec.add_development_dependency 'rubocop-rspec'
|
|
36
|
-
spec.add_development_dependency 'simplecov'
|
|
36
|
+
spec.add_development_dependency 'simplecov', '0.21.2'
|
|
37
37
|
spec.add_development_dependency 'yard'
|
|
38
38
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pr_comet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ryz310
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: octokit
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '2.2'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '2.2'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: pry-byebug
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
75
|
+
version: '13.0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
82
|
+
version: '13.0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: rspec
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -154,16 +154,16 @@ dependencies:
|
|
|
154
154
|
name: simplecov
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
156
156
|
requirements:
|
|
157
|
-
- -
|
|
157
|
+
- - '='
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version:
|
|
159
|
+
version: 0.21.2
|
|
160
160
|
type: :development
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
|
-
- -
|
|
164
|
+
- - '='
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version:
|
|
166
|
+
version: 0.21.2
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
168
|
name: yard
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -186,11 +186,15 @@ extensions: []
|
|
|
186
186
|
extra_rdoc_files: []
|
|
187
187
|
files:
|
|
188
188
|
- ".circleci/config.yml"
|
|
189
|
+
- ".dependabot/config.yml"
|
|
189
190
|
- ".envrc.skeleton"
|
|
191
|
+
- ".gem_comet.yml"
|
|
190
192
|
- ".gitignore"
|
|
191
193
|
- ".rspec"
|
|
192
194
|
- ".rubocop.yml"
|
|
195
|
+
- ".rubocop_challenge.yml"
|
|
193
196
|
- ".rubocop_todo.yml"
|
|
197
|
+
- CHANGELOG.md
|
|
194
198
|
- CODE_OF_CONDUCT.md
|
|
195
199
|
- Gemfile
|
|
196
200
|
- Gemfile.lock
|
|
@@ -205,8 +209,11 @@ files:
|
|
|
205
209
|
- lib/pr_comet/errors.rb
|
|
206
210
|
- lib/pr_comet/git/command.rb
|
|
207
211
|
- lib/pr_comet/github/client.rb
|
|
212
|
+
- lib/pr_comet/rspec.rb
|
|
213
|
+
- lib/pr_comet/rspec/stub.rb
|
|
208
214
|
- lib/pr_comet/version.rb
|
|
209
215
|
- pr_comet.gemspec
|
|
216
|
+
- renovate.json
|
|
210
217
|
homepage: https://github.com/ryz310/pr_comet
|
|
211
218
|
licenses:
|
|
212
219
|
- MIT
|
|
@@ -226,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
226
233
|
- !ruby/object:Gem::Version
|
|
227
234
|
version: '0'
|
|
228
235
|
requirements: []
|
|
229
|
-
rubygems_version: 3.
|
|
236
|
+
rubygems_version: 3.2.3
|
|
230
237
|
signing_key:
|
|
231
238
|
specification_version: 4
|
|
232
239
|
summary: Create a lots of pull request like comets
|