gitx 4.1.1 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/README.md +1 -1
- data/gitx.gemspec +2 -2
- data/lib/gitx/cli/release_command.rb +17 -12
- data/lib/gitx/configuration.rb +4 -0
- data/lib/gitx/version.rb +1 -1
- data/spec/gitx/cli/release_command_spec.rb +32 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d276a1d2a8560dbb235b82b3c85b086fde5bf1b082f204b9f49775b20f77489
|
4
|
+
data.tar.gz: b0b5a42771c92360458ba3c374cecac1d333aa2d34fb51c6c30a3962cc1d9812
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d44543c6d8c06a11cce788c19e90f3e1aa1497ff87eebdc7d7e88f00b805f38e8a1d005e87008d945c3df0e67fa199e8a39106cb091285eae61598f89d1400ed
|
7
|
+
data.tar.gz: 0a8f2e1a5f7a725556f97ebad9390f1d1c16a5668cb3812654621acf5ee7fd505ebe4dd0070665fb53e9ca142b93e3a5adea14b0b0bfc0a923b985b7b5760bbd
|
data/.rubocop.yml
CHANGED
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)
|
data/gitx.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.summary = 'Utility scripts for Git to increase productivity for common operations'
|
11
11
|
spec.homepage = ''
|
12
12
|
spec.license = 'MIT'
|
13
|
-
spec.required_ruby_version = '>= 2.
|
13
|
+
spec.required_ruby_version = '>= 2.7'
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_runtime_dependency 'octokit'
|
21
|
-
spec.add_runtime_dependency 'rugged'
|
21
|
+
spec.add_runtime_dependency 'rugged'
|
22
22
|
spec.add_runtime_dependency 'thor'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler'
|
@@ -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
|
-
|
24
|
-
if (label = config.release_label)
|
25
|
-
label_pull_request pull_request, label
|
26
|
-
else
|
27
|
-
return unless confirm_branch_status?(branch)
|
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]
|
data/lib/gitx/configuration.rb
CHANGED
data/lib/gitx/version.rb
CHANGED
@@ -235,5 +235,37 @@ describe Gitx::Cli::ReleaseCommand do
|
|
235
235
|
should meet_expectations
|
236
236
|
end
|
237
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
|
263
|
+
cli.release
|
264
|
+
end
|
265
|
+
end
|
266
|
+
it 'runs expected commands' do
|
267
|
+
should meet_expectations
|
268
|
+
end
|
269
|
+
end
|
238
270
|
end
|
239
271
|
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.4.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: 2023-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rugged
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
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: 0
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -275,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
275
275
|
requirements:
|
276
276
|
- - ">="
|
277
277
|
- !ruby/object:Gem::Version
|
278
|
-
version: 2.
|
278
|
+
version: '2.7'
|
279
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
280
|
requirements:
|
281
281
|
- - ">="
|