gitx 4.0.0 → 4.3.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/README.md +1 -1
- data/lib/gitx/cli/integrate_command.rb +2 -1
- data/lib/gitx/cli/release_command.rb +17 -12
- data/lib/gitx/cli/update_command.rb +12 -3
- data/lib/gitx/configuration.rb +4 -0
- data/lib/gitx/defaults.yml +1 -1
- data/lib/gitx/github.rb +10 -0
- data/lib/gitx/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/{pull_request_does_exist_with_success_status_and_then_add_label.yml → pull_request_does_exist_and_then_add_label.yml} +0 -68
- data/spec/gitx/cli/integrate_command_spec.rb +24 -0
- data/spec/gitx/cli/release_command_spec.rb +39 -7
- data/spec/gitx/cli/review_command_spec.rb +29 -6
- data/spec/gitx/cli/update_command_spec.rb +15 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba914d70cddc88a7a718f8c05ea238822c79b2a58c09f30576835473ff008a0e
|
4
|
+
data.tar.gz: c1079014ac0699cf9eea62857061a5932e8b083620241f401a13113761c8f6f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 334ef2afbffbe44668f8b97aa8f85f142292dfb5811fd7c37ff7233ed40ae85e6890b08928fa4006b814933e8e68df93d9b9f0017596829a4d6af96184f06a5c
|
7
|
+
data.tar.gz: eead42c4bb02d2d8738a057962f9f7c2e5bc2f2318003833b0e7a472ea592197b3f3948d9c06a063a69e58470d641bf77808d1aa266ec8f0f8fffbcd6128cff3
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ This setting is cleared when a reviewer approves or rejects the pull request.
|
|
50
50
|
release the feature branch to the base branch (by default, main). This operation will perform the following:
|
51
51
|
|
52
52
|
* pull latest code from remote feature branch
|
53
|
-
* pull latest code from the base branch
|
53
|
+
* pull latest code from the base branch (unless `update_from_base_on_release` config is set to `false`)
|
54
54
|
* prompt user to confirm they actually want to perform the release
|
55
55
|
* check if pull request commit status is currently successful
|
56
56
|
* merge current branch into the base branch (or add release label if configured)
|
@@ -9,6 +9,7 @@ module Gitx
|
|
9
9
|
class IntegrateCommand < BaseCommand
|
10
10
|
include Gitx::Github
|
11
11
|
desc 'integrate', 'integrate the current branch into one of the aggregate development branches (default = staging)'
|
12
|
+
method_option :'skip-pull-request', type: :boolean, desc: 'skip pull request reference in merge commit'
|
12
13
|
method_option :resume, type: :string, aliases: '-r', desc: 'resume merging of feature-branch'
|
13
14
|
def integrate(integration_branch = 'staging')
|
14
15
|
assert_aggregate_branch!(integration_branch)
|
@@ -17,7 +18,7 @@ module Gitx
|
|
17
18
|
print_message(branch, integration_branch)
|
18
19
|
|
19
20
|
run_git_cmd 'update'
|
20
|
-
pull_request = pull_request_for_branch(branch)
|
21
|
+
pull_request = pull_request_for_branch(branch) unless options[:'skip-pull-request']
|
21
22
|
integrate_branch(branch, integration_branch, pull_request) unless options[:resume]
|
22
23
|
checkout_branch branch
|
23
24
|
end
|
@@ -17,19 +17,9 @@ module Gitx
|
|
17
17
|
|
18
18
|
assert_not_protected_branch!(branch, 'release')
|
19
19
|
checkout_branch(branch)
|
20
|
-
run_git_cmd 'update'
|
20
|
+
run_git_cmd 'update' if config.update_from_base_on_release?
|
21
21
|
|
22
|
-
|
23
|
-
return unless confirm_branch_status?(branch)
|
24
|
-
|
25
|
-
if (label = config.release_label)
|
26
|
-
label_pull_request pull_request, label
|
27
|
-
else
|
28
|
-
checkout_branch config.base_branch
|
29
|
-
run_git_cmd 'pull', 'origin', config.base_branch
|
30
|
-
run_git_cmd 'merge', '--no-ff', '--message', commit_message(branch, pull_request), branch
|
31
|
-
run_git_cmd 'push', 'origin', 'HEAD'
|
32
|
-
end
|
22
|
+
perform_release(branch)
|
33
23
|
|
34
24
|
after_release
|
35
25
|
end
|
@@ -51,6 +41,21 @@ module Gitx
|
|
51
41
|
end
|
52
42
|
end
|
53
43
|
|
44
|
+
def perform_release(branch)
|
45
|
+
pull_request = find_or_create_pull_request(branch)
|
46
|
+
|
47
|
+
if (label = config.release_label)
|
48
|
+
label_pull_request pull_request, label
|
49
|
+
else
|
50
|
+
return unless confirm_branch_status?(branch)
|
51
|
+
|
52
|
+
checkout_branch config.base_branch
|
53
|
+
run_git_cmd 'pull', 'origin', config.base_branch
|
54
|
+
run_git_cmd 'merge', '--no-ff', '--message', commit_message(branch, pull_request), branch
|
55
|
+
run_git_cmd 'push', 'origin', 'HEAD'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
54
59
|
def after_release
|
55
60
|
after_release_scripts = config.after_release_scripts.dup
|
56
61
|
after_release_scripts << 'git cleanup' if options[:cleanup]
|
@@ -12,15 +12,24 @@ module Gitx
|
|
12
12
|
say 'with latest changes from '
|
13
13
|
say config.base_branch, :green
|
14
14
|
|
15
|
+
update_base_branch
|
15
16
|
update_branch(current_branch.name) if remote_branch_exists?(current_branch.name)
|
16
|
-
update_branch(config.base_branch)
|
17
|
+
update_branch(config.base_branch, repository: '.')
|
18
|
+
|
17
19
|
run_git_cmd 'share'
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
21
23
|
|
22
|
-
def
|
23
|
-
|
24
|
+
def update_base_branch
|
25
|
+
branch_name = current_branch.name
|
26
|
+
checkout_branch(config.base_branch)
|
27
|
+
update_branch(config.base_branch)
|
28
|
+
checkout_branch(branch_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def update_branch(branch, repository: 'origin')
|
32
|
+
run_git_cmd 'pull', repository, branch
|
24
33
|
rescue Gitx::Executor::ExecutionError
|
25
34
|
raise MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the command'
|
26
35
|
end
|
data/lib/gitx/configuration.rb
CHANGED
data/lib/gitx/defaults.yml
CHANGED
data/lib/gitx/github.rb
CHANGED
@@ -17,6 +17,7 @@ module Gitx
|
|
17
17
|
#
|
18
18
|
# This footer will automatically be stripped from the pull request description
|
19
19
|
MESSAGE
|
20
|
+
PULL_REQEST_TEMPLATE_FILE='.github/PULL_REQUEST_TEMPLATE.md'
|
20
21
|
|
21
22
|
def find_or_create_pull_request(branch)
|
22
23
|
pull_request = find_pull_request(branch)
|
@@ -82,6 +83,7 @@ module Gitx
|
|
82
83
|
description_template = []
|
83
84
|
description_template << "#{description}\n" if description
|
84
85
|
description_template << changelog
|
86
|
+
description_template << "#{pull_request_template}\n" if pull_request_template
|
85
87
|
|
86
88
|
ask_editor(description_template.join("\n"), editor: repo.config['core.editor'], footer: PULL_REQUEST_FOOTER)
|
87
89
|
end
|
@@ -90,6 +92,14 @@ module Gitx
|
|
90
92
|
options[:title] || branch.gsub(/[-_]/, ' ')
|
91
93
|
end
|
92
94
|
|
95
|
+
def pull_request_template_file
|
96
|
+
File.expand_path(PULL_REQEST_TEMPLATE_FILE)
|
97
|
+
end
|
98
|
+
|
99
|
+
def pull_request_template
|
100
|
+
@pull_request_template ||= File.exist?(pull_request_template_file) ? File.read(pull_request_template_file) : nil
|
101
|
+
end
|
102
|
+
|
93
103
|
# authorization token used for github API calls
|
94
104
|
# the token is cached on the filesystem for future use
|
95
105
|
# @return [String] auth token stored in git (current repo, user config or installed global settings)
|
data/lib/gitx/version.rb
CHANGED
@@ -78,74 +78,6 @@ http_interactions:
|
|
78
78
|
string: '[{"html_url":"https://path/to/html/pull/request","issue_url":"https://api/path/to/issue/url","number":10,"head":{"ref":"branch_name", "sha": "e12da4"}}]'
|
79
79
|
http_version:
|
80
80
|
recorded_at: Tue, 05 Aug 2014 16:36:03 GMT
|
81
|
-
- request:
|
82
|
-
method: get
|
83
|
-
uri: https://api.github.com/repos/wireframe/gitx/commits/feature-branch/status
|
84
|
-
body:
|
85
|
-
encoding: US-ASCII
|
86
|
-
string: ''
|
87
|
-
headers:
|
88
|
-
Accept:
|
89
|
-
- application/vnd.github.v3+json
|
90
|
-
User-Agent:
|
91
|
-
- Octokit Ruby Gem 3.4.0
|
92
|
-
Content-Type:
|
93
|
-
- application/json
|
94
|
-
Authorization:
|
95
|
-
- token 123123
|
96
|
-
Accept-Encoding:
|
97
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
98
|
-
response:
|
99
|
-
status:
|
100
|
-
code: 200
|
101
|
-
message: OK
|
102
|
-
headers:
|
103
|
-
Server:
|
104
|
-
- GitHub.com
|
105
|
-
Date:
|
106
|
-
- Wed, 10 Dec 2014 19:01:27 GMT
|
107
|
-
Content-Type:
|
108
|
-
- application/json; charset=utf-8
|
109
|
-
Transfer-Encoding:
|
110
|
-
- chunked
|
111
|
-
Status:
|
112
|
-
- 200 OK
|
113
|
-
X-Ratelimit-Limit:
|
114
|
-
- '5000'
|
115
|
-
X-Ratelimit-Remaining:
|
116
|
-
- '4993'
|
117
|
-
X-Ratelimit-Reset:
|
118
|
-
- '1418241620'
|
119
|
-
X-Oauth-Scopes:
|
120
|
-
- repo
|
121
|
-
X-Accepted-Oauth-Scopes:
|
122
|
-
- repo, repo:status
|
123
|
-
X-Github-Media-Type:
|
124
|
-
- github.v3; format=json
|
125
|
-
X-Xss-Protection:
|
126
|
-
- 1; mode=block
|
127
|
-
X-Frame-Options:
|
128
|
-
- deny
|
129
|
-
Content-Security-Policy:
|
130
|
-
- default-src 'none'
|
131
|
-
Access-Control-Allow-Credentials:
|
132
|
-
- 'true'
|
133
|
-
Access-Control-Expose-Headers:
|
134
|
-
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
135
|
-
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
136
|
-
Access-Control-Allow-Origin:
|
137
|
-
- "*"
|
138
|
-
X-Github-Request-Id:
|
139
|
-
- C6CBAFAF:141D:2F27072:54889887
|
140
|
-
Strict-Transport-Security:
|
141
|
-
- max-age=31536000; includeSubdomains; preload
|
142
|
-
X-Content-Type-Options:
|
143
|
-
- nosniff
|
144
|
-
body:
|
145
|
-
encoding: UTF-8
|
146
|
-
string: '{"state":"success"}'
|
147
|
-
http_version:
|
148
|
-
recorded_at: Tue, 05 Aug 2014 16:36:03 GMT
|
149
81
|
- request:
|
150
82
|
method: post
|
151
83
|
uri: https://api.github.com/repos/wireframe/gitx/issues/10/labels
|
@@ -214,5 +214,29 @@ describe Gitx::Cli::IntegrateCommand do
|
|
214
214
|
should meet_expectations
|
215
215
|
end
|
216
216
|
end
|
217
|
+
context 'with --skip-pull-request' do
|
218
|
+
let(:changelog) { '* made some fixes' }
|
219
|
+
let(:changelog) { '2013-01-01 did some stuff' }
|
220
|
+
let(:options) { { 'skip-pull-request': true } }
|
221
|
+
before do
|
222
|
+
allow(cli).to receive(:ask_editor).and_return('description')
|
223
|
+
|
224
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
225
|
+
expect(executor).to receive(:execute).with('git', 'fetch', 'origin').ordered
|
226
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging').ordered
|
227
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'staging').ordered
|
228
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Integrate feature-branch into staging', 'feature-branch').ordered
|
229
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
230
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
231
|
+
|
232
|
+
cli.integrate
|
233
|
+
end
|
234
|
+
it 'does not create pull request' do
|
235
|
+
expect(WebMock).to_not have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/pulls')
|
236
|
+
end
|
237
|
+
it 'runs expected commands' do
|
238
|
+
should meet_expectations
|
239
|
+
end
|
240
|
+
end
|
217
241
|
end
|
218
242
|
end
|
@@ -68,7 +68,7 @@ describe Gitx::Cli::ReleaseCommand do
|
|
68
68
|
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
69
69
|
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
|
70
70
|
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
71
|
-
expect(executor).to receive(:execute).with('git integrate').ordered
|
71
|
+
expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
|
72
72
|
|
73
73
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
74
74
|
cli.release
|
@@ -121,7 +121,7 @@ describe Gitx::Cli::ReleaseCommand do
|
|
121
121
|
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
122
122
|
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
|
123
123
|
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
124
|
-
expect(executor).to receive(:execute).with('git integrate').ordered
|
124
|
+
expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
|
125
125
|
|
126
126
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
127
127
|
cli.release 'feature-branch'
|
@@ -159,7 +159,7 @@ describe Gitx::Cli::ReleaseCommand do
|
|
159
159
|
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
160
160
|
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
|
161
161
|
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
162
|
-
expect(executor).to receive(:execute).with('git integrate').ordered
|
162
|
+
expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
|
163
163
|
|
164
164
|
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
|
165
165
|
VCR.use_cassette('pull_request_does_not_exist') do
|
@@ -191,7 +191,7 @@ describe Gitx::Cli::ReleaseCommand do
|
|
191
191
|
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
192
192
|
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
|
193
193
|
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
194
|
-
expect(executor).to receive(:execute).with('git integrate').ordered
|
194
|
+
expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
|
195
195
|
expect(executor).to receive(:execute).with('git cleanup').ordered
|
196
196
|
|
197
197
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
@@ -202,7 +202,7 @@ describe Gitx::Cli::ReleaseCommand do
|
|
202
202
|
should meet_expectations
|
203
203
|
end
|
204
204
|
end
|
205
|
-
context 'when user confirms release
|
205
|
+
context 'when user confirms release with release_label config' do
|
206
206
|
let(:gitx_config) do
|
207
207
|
{
|
208
208
|
'release_label' => 'release-me'
|
@@ -225,9 +225,41 @@ describe Gitx::Cli::ReleaseCommand do
|
|
225
225
|
|
226
226
|
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
227
227
|
expect(executor).to receive(:execute).with('git', 'update').ordered
|
228
|
-
expect(executor).to receive(:execute).with('git integrate').ordered
|
228
|
+
expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
|
229
229
|
|
230
|
-
VCR.use_cassette('
|
230
|
+
VCR.use_cassette('pull_request_does_exist_and_then_add_label') do
|
231
|
+
cli.release
|
232
|
+
end
|
233
|
+
end
|
234
|
+
it 'runs expected commands' do
|
235
|
+
should meet_expectations
|
236
|
+
end
|
237
|
+
end
|
238
|
+
context 'when user confirms release with update_from_base_on_release config set to false' do
|
239
|
+
let(:gitx_config) do
|
240
|
+
{
|
241
|
+
'update_from_base_on_release' => false
|
242
|
+
}
|
243
|
+
end
|
244
|
+
before do
|
245
|
+
expect(repo).to receive(:workdir).and_return(temp_dir)
|
246
|
+
File.open(File.join(temp_dir, '.gitx.yml'), 'w') do |f|
|
247
|
+
f.puts gitx_config.to_yaml
|
248
|
+
end
|
249
|
+
|
250
|
+
expect(cli).to receive(:yes?).and_return(true)
|
251
|
+
expect(cli).to_not receive(:label_pull_request)
|
252
|
+
expect(executor).to_not receive(:execute).with('git', 'update')
|
253
|
+
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
254
|
+
|
255
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
256
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
|
257
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
258
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', "[gitx] Release feature-branch to main\n\nConnected to #10", 'feature-branch').ordered
|
259
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
260
|
+
expect(executor).to receive(:execute).with('git integrate --skip-pull-request').ordered
|
261
|
+
|
262
|
+
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
231
263
|
cli.release
|
232
264
|
end
|
233
265
|
end
|
@@ -63,8 +63,12 @@ describe Gitx::Cli::ReviewCommand do
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
context 'when target branch is not nil and pull request does not exist' do
|
66
|
+
subject(:review) do
|
67
|
+
VCR.use_cassette('pull_request_does_not_exist') do
|
68
|
+
cli.review 'feature-branch'
|
69
|
+
end
|
70
|
+
end
|
66
71
|
let(:authorization_token) { '123123' }
|
67
|
-
let(:changelog) { '* made some fixes' }
|
68
72
|
let(:fake_update_command) { double('fake update command', update: nil) }
|
69
73
|
let(:new_pull_request) do
|
70
74
|
{
|
@@ -77,21 +81,18 @@ describe Gitx::Cli::ReviewCommand do
|
|
77
81
|
}
|
78
82
|
end
|
79
83
|
let(:changelog) { "* old commit\n\n* new commit" }
|
84
|
+
let(:pull_request_body) { changelog }
|
80
85
|
let(:pull_request_description) { 'description' }
|
81
86
|
before do
|
82
87
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
83
88
|
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
84
89
|
expect(executor).to receive(:execute).with('git', 'update').ordered
|
85
90
|
expect(executor).to receive(:execute).with('git', 'log', 'origin/main...feature-branch', '--reverse', '--no-merges', '--pretty=format:* %B').and_return(changelog).ordered
|
86
|
-
expect(cli).to receive(:ask_editor).with(
|
91
|
+
expect(cli).to receive(:ask_editor).with(pull_request_body, hash_including(footer: Gitx::Github::PULL_REQUEST_FOOTER)).and_return(pull_request_description)
|
87
92
|
|
88
93
|
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls')
|
89
94
|
.with(body: { base: 'main', head: 'feature-branch', title: 'feature branch', body: pull_request_description }.to_json)
|
90
95
|
.to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
|
91
|
-
|
92
|
-
VCR.use_cassette('pull_request_does_not_exist') do
|
93
|
-
cli.review 'feature-branch'
|
94
|
-
end
|
95
96
|
end
|
96
97
|
it 'creates github pull request' do
|
97
98
|
should meet_expectations
|
@@ -99,6 +100,28 @@ describe Gitx::Cli::ReviewCommand do
|
|
99
100
|
it 'runs expected commands' do
|
100
101
|
should meet_expectations
|
101
102
|
end
|
103
|
+
context 'when PULL_REQUEST_TEMPLATE file exists' do
|
104
|
+
let(:pull_request_template) do
|
105
|
+
"## Summary\nPut your summary here\n## Artifacts\n- list\n- your\n-artifacts"
|
106
|
+
end
|
107
|
+
let(:pull_request_body) do
|
108
|
+
"#{changelog}\n#{pull_request_template}\n"
|
109
|
+
end
|
110
|
+
before do
|
111
|
+
expect(cli).to receive(:pull_request_template).and_return(pull_request_template).twice
|
112
|
+
|
113
|
+
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls')
|
114
|
+
.with(body: { base: 'main', head: 'feature-branch', title: 'feature branch', body: pull_request_description }.to_json)
|
115
|
+
.to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'creates github pull request' do
|
119
|
+
should meet_expectations
|
120
|
+
end
|
121
|
+
it 'runs expected commands' do
|
122
|
+
should meet_expectations
|
123
|
+
end
|
124
|
+
end
|
102
125
|
end
|
103
126
|
context 'when authorization_token is missing' do
|
104
127
|
let(:authorization_token) { nil }
|
@@ -27,8 +27,11 @@ describe Gitx::Cli::UpdateCommand do
|
|
27
27
|
before do
|
28
28
|
allow(cli).to receive(:say)
|
29
29
|
|
30
|
-
expect(executor).to receive(:execute).with('git', '
|
30
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
|
31
31
|
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
32
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
33
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'feature-branch').ordered
|
34
|
+
expect(executor).to receive(:execute).with('git', 'pull', '.', 'main').ordered
|
32
35
|
expect(executor).to receive(:execute).with('git', 'share').ordered
|
33
36
|
|
34
37
|
cli.update
|
@@ -41,6 +44,9 @@ describe Gitx::Cli::UpdateCommand do
|
|
41
44
|
before do
|
42
45
|
allow(cli).to receive(:say)
|
43
46
|
|
47
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
|
48
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
49
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
44
50
|
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'feature-branch').and_raise(Gitx::Executor::ExecutionError).ordered
|
45
51
|
|
46
52
|
expect { cli.update }.to raise_error(Gitx::Cli::BaseCommand::MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the command')
|
@@ -53,8 +59,11 @@ describe Gitx::Cli::UpdateCommand do
|
|
53
59
|
before do
|
54
60
|
allow(cli).to receive(:say)
|
55
61
|
|
62
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
|
63
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
64
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
56
65
|
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'feature-branch').ordered
|
57
|
-
expect(executor).to receive(:execute).with('git', 'pull', '
|
66
|
+
expect(executor).to receive(:execute).with('git', 'pull', '.', 'main').and_raise(Gitx::Executor::ExecutionError).ordered
|
58
67
|
|
59
68
|
expect { cli.update }.to raise_error(Gitx::Cli::BaseCommand::MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the command')
|
60
69
|
end
|
@@ -68,7 +77,11 @@ describe Gitx::Cli::UpdateCommand do
|
|
68
77
|
allow(cli).to receive(:say)
|
69
78
|
|
70
79
|
expect(executor).not_to receive(:execute).with('git', 'pull', 'origin', 'feature-branch')
|
80
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'main').ordered
|
71
81
|
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'main').ordered
|
82
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
83
|
+
expect(executor).to receive(:execute).with('git', 'pull', '.', 'main').ordered
|
84
|
+
expect(executor).to receive(:execute).with('git', 'share').ordered
|
72
85
|
|
73
86
|
cli.update
|
74
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Sonnek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -238,9 +238,9 @@ files:
|
|
238
238
|
- lib/gitx/extensions/thor.rb
|
239
239
|
- lib/gitx/github.rb
|
240
240
|
- lib/gitx/version.rb
|
241
|
+
- spec/fixtures/vcr_cassettes/pull_request_does_exist_and_then_add_label.yml
|
241
242
|
- spec/fixtures/vcr_cassettes/pull_request_does_exist_with_failure_status.yml
|
242
243
|
- spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status.yml
|
243
|
-
- spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status_and_then_add_label.yml
|
244
244
|
- spec/fixtures/vcr_cassettes/pull_request_does_not_exist.yml
|
245
245
|
- spec/gitx/cli/base_command_spec.rb
|
246
246
|
- spec/gitx/cli/buildtag_command_spec.rb
|
@@ -287,9 +287,9 @@ signing_key:
|
|
287
287
|
specification_version: 4
|
288
288
|
summary: Utility scripts for Git to increase productivity for common operations
|
289
289
|
test_files:
|
290
|
+
- spec/fixtures/vcr_cassettes/pull_request_does_exist_and_then_add_label.yml
|
290
291
|
- spec/fixtures/vcr_cassettes/pull_request_does_exist_with_failure_status.yml
|
291
292
|
- spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status.yml
|
292
|
-
- spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status_and_then_add_label.yml
|
293
293
|
- spec/fixtures/vcr_cassettes/pull_request_does_not_exist.yml
|
294
294
|
- spec/gitx/cli/base_command_spec.rb
|
295
295
|
- spec/gitx/cli/buildtag_command_spec.rb
|