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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3794617867e08f0a15468dd3291883d22bed44fa9dfde0350cf120e5c5c8890c
4
- data.tar.gz: 827802ca75c6a1f4243fa628a12dc3cc1e9b11afef91d587fc9fe4ae4a9b2b6e
3
+ metadata.gz: 7d276a1d2a8560dbb235b82b3c85b086fde5bf1b082f204b9f49775b20f77489
4
+ data.tar.gz: b0b5a42771c92360458ba3c374cecac1d333aa2d34fb51c6c30a3962cc1d9812
5
5
  SHA512:
6
- metadata.gz: ae00b7739d6b3488d0ae4ae588d776c1a004eeb36167587699d2c0dae2ec49902dfc78d122f1edcab7e9ce47a3cecfd36efe59491bce0d663562058e08975f57
7
- data.tar.gz: 8727bf623a20f50a6de72088a0e1106e26ccd1ba974d66471e2ed0f8643ffe3c04ec299b6d4343df3816f8c881af3588497e7a2fd9806627c418d461933d24dc
6
+ metadata.gz: d44543c6d8c06a11cce788c19e90f3e1aa1497ff87eebdc7d7e88f00b805f38e8a1d005e87008d945c3df0e67fa199e8a39106cb091285eae61598f89d1400ed
7
+ data.tar.gz: 0a8f2e1a5f7a725556f97ebad9390f1d1c16a5668cb3812654621acf5ee7fd505ebe4dd0070665fb53e9ca142b93e3a5adea14b0b0bfc0a923b985b7b5760bbd
data/.rubocop.yml CHANGED
@@ -7,7 +7,7 @@
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  AllCops:
10
- TargetRubyVersion: '2.6'
10
+ TargetRubyVersion: '2.7'
11
11
 
12
12
  FileName:
13
13
  Exclude:
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.6.7'
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', '~> 0.27.10'
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
- pull_request = find_or_create_pull_request(branch)
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]
@@ -45,6 +45,10 @@ module Gitx
45
45
  taggable_branches.include?(branch)
46
46
  end
47
47
 
48
+ def update_from_base_on_release?
49
+ config.fetch(:update_from_base_on_release, true)
50
+ end
51
+
48
52
  def after_release_scripts
49
53
  config[:after_release]
50
54
  end
data/lib/gitx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gitx
2
- VERSION = '4.1.1'.freeze
2
+ VERSION = '4.4.0'.freeze
3
3
  end
@@ -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.1.1
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: 2021-08-06 00:00:00.000000000 Z
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.27.10
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.27.10
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.6.7
278
+ version: '2.7'
279
279
  required_rubygems_version: !ruby/object:Gem::Requirement
280
280
  requirements:
281
281
  - - ">="