gitx 2.14.2.ci.70.1 → 2.15.0.ci.75.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGU4NzQwZWM3ZDMwZjI5MGNhOTZlYTg3MDBlMDQyMDAxNjkxN2Y4Nw==
4
+ MzMxY2Q5YjdlNGQwMDQ4YzBkYTIxMzMzMDlkNzI1MDk2NTRmZmI0OQ==
5
5
  data.tar.gz: !binary |-
6
- YWZkMGExMDc0YjY2NDE4ZGVjOGJiMmM0NzZkYzMyOTQwMzAxZDkyNA==
6
+ ZWIxNDE3ZGM1ZDE5YWEyOTBiNmUyNTNhMDBiYjg0N2E5NjQ5MjE3MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODg3Mjg0ZGM5MDIzNWU0YWJmNDBkYmQyNmIzYTM1MGU3N2NhNGNjM2ExZTE2
10
- OTQ2NWU1MTRjYzg4MGM3YmQ4NjJiMWQ3YzNlMjlhYWViMDEwM2JhNTFlOWRi
11
- MjFlYTFkZjM4NDU2NmZkMmRkYmFhODFlNzFjZTRkMmFhODBiYzI=
9
+ YzdmNTE4ZTI4OGNlMWQxYjgwNjFkNGZmYzE2N2NkZjRmM2VmNjViMzFhZGU3
10
+ MjMwZjAwYWNlN2U5YzMwMTc4OWY3YzAwNTUxMjAyZGMwNmZmYTNmYTcxNDcy
11
+ NDM0ZjY1ZmEwMmJkMzgzNmYxNWY5OGYzNTNlYmY1NjY5OTdiOTM=
12
12
  data.tar.gz: !binary |-
13
- MGY0N2JkMDYwOTE3NjhlNGI1MzY2MGRjYjhlMmU2NGQ3ODQ3MDM2NTcwZDhm
14
- MmRlM2QzYmI3OWEyYTJkZDk3YTY4ZmM5MGFhNjgwNjQyZTlkMWY1MGVjZDUy
15
- M2RlNGFhOTExMGZlZTQ3ZTdkNTFhNWY1ZDM5M2Q4NGNiNTg1N2M=
13
+ MzljNjczZmNhOGE2MTE2ZjE1Njk0ZmE5YTU2NzhjNzA3YjQ0ODc5Y2ZhN2Vi
14
+ MTQ5ZjE2OGIxZmYxNDM2ZjZiZjRjZTI2NTYwZTk5NjFiY2MyODk0ODA2ZmVi
15
+ NmJmMDUyYTEzNjQ5NTIzOTBhMWVkOThmOTgzMjgxOWU4NWRmM2E=
data/.gitx.yml ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ after_release:
3
+ - rake release
data/README.md CHANGED
@@ -68,6 +68,9 @@ reset an aggregate branch (ex: prototype, staging) back to a known good state.
68
68
 
69
69
  create a build tag for the current Travis-CI build and push it back to origin
70
70
 
71
+ ## Configuration
72
+ Any of the [default settings defined in the gem](lib/gitx/defaults.yml) can be overridden
73
+ by creating a custom `.gitx.yml` file in the root directory of your project.
71
74
 
72
75
  ## Contributing
73
76
  See [CONTRIBUTING.md](CONTRIBUTING.md)
@@ -2,7 +2,6 @@ require 'thor'
2
2
  require 'gitx'
3
3
  require 'gitx/cli/base_command'
4
4
  require 'gitx/cli/update_command'
5
- require 'gitx/cli/integrate_command'
6
5
  require 'gitx/cli/cleanup_command'
7
6
  require 'gitx/github'
8
7
 
@@ -21,19 +20,34 @@ module Gitx
21
20
  checkout_branch(branch)
22
21
  execute_command(UpdateCommand, :update)
23
22
 
24
- find_or_create_pull_request(branch)
25
- status = branch_status(branch)
26
- if status != 'success'
27
- return unless yes?("Branch status is currently: #{status}. Proceed with release? (y/n)", :red)
28
- end
23
+ return unless confirm_branch_status?(branch)
29
24
 
30
25
  checkout_branch Gitx::BASE_BRANCH
31
26
  run_cmd "git pull origin #{Gitx::BASE_BRANCH}"
32
27
  run_cmd "git merge --no-ff #{branch}"
33
28
  run_cmd 'git push origin HEAD'
34
29
 
35
- execute_command(IntegrateCommand, :integrate, 'staging')
36
- execute_command(CleanupCommand, :cleanup) if options[:cleanup]
30
+ after_release
31
+ end
32
+
33
+ private
34
+
35
+ def confirm_branch_status?(branch)
36
+ find_or_create_pull_request(branch)
37
+ status = branch_status(branch)
38
+ if status == 'success'
39
+ true
40
+ else
41
+ yes?("Branch status is currently: #{status}. Proceed with release? (y/n)", :red)
42
+ end
43
+ end
44
+
45
+ def after_release
46
+ after_release_scripts = config.after_release_scripts.dup
47
+ after_release_scripts << 'git cleanup' if options[:cleanup]
48
+ after_release_scripts.each do |cmd|
49
+ run_cmd cmd
50
+ end
37
51
  end
38
52
  end
39
53
  end
@@ -36,6 +36,10 @@ module Gitx
36
36
  taggable_branches.include?(branch)
37
37
  end
38
38
 
39
+ def after_release_scripts
40
+ config[:after_release]
41
+ end
42
+
39
43
  private
40
44
 
41
45
  # load configuration file
@@ -11,3 +11,5 @@ reserved_branches:
11
11
  taggable_branches:
12
12
  - master
13
13
  - staging
14
+ after_release:
15
+ - git integrate
data/lib/gitx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gitx
2
- VERSION = '2.14.2'
2
+ VERSION = '2.15.0'
3
3
  end
@@ -12,6 +12,7 @@ describe Gitx::Cli::ReleaseCommand do
12
12
  let(:cli) { described_class.new(args, options, config) }
13
13
  let(:branch) { double('fake branch', name: 'feature-branch') }
14
14
  let(:authorization_token) { '123123' }
15
+ let(:repo) { cli.send(:repo) }
15
16
 
16
17
  before do
17
18
  allow(cli).to receive(:current_branch).and_return(branch)
@@ -31,9 +32,8 @@ describe Gitx::Cli::ReleaseCommand do
31
32
  end
32
33
  context 'when user confirms release and pull request exists with non-success status' do
33
34
  before do
35
+ expect(repo).to receive(:workdir).and_return(temp_dir)
34
36
  expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
35
- expect(cli).to_not receive(:execute_command).with(Gitx::Cli::IntegrateCommand, :integrate, 'staging')
36
- expect(cli).to_not receive(:execute_command).with(Gitx::Cli::CleanupCommand, :cleanup)
37
37
 
38
38
  expect(cli).to receive(:yes?).with('Release feature-branch to production? (y/n)', :green).and_return(true)
39
39
  expect(cli).to receive(:yes?).with('Branch status is currently: failure. Proceed with release? (y/n)', :red).and_return(false)
@@ -52,11 +52,42 @@ describe Gitx::Cli::ReleaseCommand do
52
52
  should meet_expectations
53
53
  end
54
54
  end
55
- context 'when user confirms release and pull request exists with success status' do
55
+ context 'when user confirms release and pull request exists with success status with default config' do
56
56
  before do
57
+ expect(repo).to receive(:workdir).and_return(temp_dir)
58
+
59
+ expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
60
+
61
+ expect(cli).to receive(:yes?).and_return(true)
62
+ allow(cli).to receive(:authorization_token).and_return(authorization_token)
63
+
64
+ expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
65
+ expect(cli).to receive(:run_cmd).with('git checkout master').ordered
66
+ expect(cli).to receive(:run_cmd).with('git pull origin master').ordered
67
+ expect(cli).to receive(:run_cmd).with('git merge --no-ff feature-branch').ordered
68
+ expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
69
+ expect(cli).to receive(:run_cmd).with('git integrate').ordered
70
+
71
+ VCR.use_cassette('pull_request_does_exist_with_success_status') do
72
+ cli.release
73
+ end
74
+ end
75
+ it 'runs expected commands' do
76
+ should meet_expectations
77
+ end
78
+ end
79
+ context 'when user confirms release and pull request exists with success status with custom after_release config' do
80
+ let(:gitx_config) do
81
+ {
82
+ 'after_release' => ['echo hello']
83
+ }
84
+ end
85
+ before do
86
+ expect(repo).to receive(:workdir).and_return(temp_dir)
87
+ File.open(File.join(temp_dir, '.gitx.yml'), 'w') do |f|
88
+ f.puts gitx_config.to_yaml
89
+ end
57
90
  expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
58
- expect(cli).to receive(:execute_command).with(Gitx::Cli::IntegrateCommand, :integrate, 'staging')
59
- expect(cli).to_not receive(:execute_command).with(Gitx::Cli::CleanupCommand, :cleanup)
60
91
 
61
92
  expect(cli).to receive(:yes?).and_return(true)
62
93
  allow(cli).to receive(:authorization_token).and_return(authorization_token)
@@ -66,6 +97,7 @@ describe Gitx::Cli::ReleaseCommand do
66
97
  expect(cli).to receive(:run_cmd).with('git pull origin master').ordered
67
98
  expect(cli).to receive(:run_cmd).with('git merge --no-ff feature-branch').ordered
68
99
  expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
100
+ expect(cli).to receive(:run_cmd).with('echo hello').ordered
69
101
 
70
102
  VCR.use_cassette('pull_request_does_exist_with_success_status') do
71
103
  cli.release
@@ -77,9 +109,8 @@ describe Gitx::Cli::ReleaseCommand do
77
109
  end
78
110
  context 'when target_branch is not nil and user confirms release and pull request exists with success status' do
79
111
  before do
112
+ expect(repo).to receive(:workdir).and_return(temp_dir)
80
113
  expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
81
- expect(cli).to receive(:execute_command).with(Gitx::Cli::IntegrateCommand, :integrate, 'staging')
82
- expect(cli).to_not receive(:execute_command).with(Gitx::Cli::CleanupCommand, :cleanup)
83
114
 
84
115
  expect(cli).to receive(:yes?).and_return(true)
85
116
  allow(cli).to receive(:authorization_token).and_return(authorization_token)
@@ -89,6 +120,7 @@ describe Gitx::Cli::ReleaseCommand do
89
120
  expect(cli).to receive(:run_cmd).with('git pull origin master').ordered
90
121
  expect(cli).to receive(:run_cmd).with('git merge --no-ff feature-branch').ordered
91
122
  expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
123
+ expect(cli).to receive(:run_cmd).with('git integrate').ordered
92
124
 
93
125
  VCR.use_cassette('pull_request_does_exist_with_success_status') do
94
126
  cli.release 'feature-branch'
@@ -110,12 +142,11 @@ describe Gitx::Cli::ReleaseCommand do
110
142
  }
111
143
  end
112
144
  before do
145
+ expect(repo).to receive(:workdir).and_return(temp_dir)
113
146
  allow(cli).to receive(:authorization_token).and_return(authorization_token)
114
147
  allow(cli).to receive(:ask_editor).and_return('description')
115
148
 
116
149
  expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update).twice
117
- expect(cli).to receive(:execute_command).with(Gitx::Cli::IntegrateCommand, :integrate, 'staging')
118
- expect(cli).to_not receive(:execute_command).with(Gitx::Cli::CleanupCommand, :cleanup)
119
150
 
120
151
  expect(cli).to receive(:yes?).with('Release feature-branch to production? (y/n)', :green).and_return(true)
121
152
  expect(cli).to receive(:yes?).with('Branch status is currently: pending. Proceed with release? (y/n)', :red).and_return(true)
@@ -127,6 +158,7 @@ describe Gitx::Cli::ReleaseCommand do
127
158
  expect(cli).to receive(:run_cmd).with('git pull origin master').ordered
128
159
  expect(cli).to receive(:run_cmd).with('git merge --no-ff feature-branch').ordered
129
160
  expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
161
+ expect(cli).to receive(:run_cmd).with('git integrate').ordered
130
162
 
131
163
  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' })
132
164
  VCR.use_cassette('pull_request_does_not_exist') do
@@ -147,9 +179,8 @@ describe Gitx::Cli::ReleaseCommand do
147
179
  }
148
180
  end
149
181
  before do
182
+ expect(repo).to receive(:workdir).and_return(temp_dir)
150
183
  expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
151
- expect(cli).to receive(:execute_command).with(Gitx::Cli::IntegrateCommand, :integrate, 'staging')
152
- expect(cli).to receive(:execute_command).with(Gitx::Cli::CleanupCommand, :cleanup)
153
184
 
154
185
  expect(cli).to receive(:yes?).and_return(true)
155
186
  allow(cli).to receive(:authorization_token).and_return(authorization_token)
@@ -159,6 +190,8 @@ describe Gitx::Cli::ReleaseCommand do
159
190
  expect(cli).to receive(:run_cmd).with('git pull origin master').ordered
160
191
  expect(cli).to receive(:run_cmd).with('git merge --no-ff feature-branch').ordered
161
192
  expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
193
+ expect(cli).to receive(:run_cmd).with('git integrate').ordered
194
+ expect(cli).to receive(:run_cmd).with('git cleanup').ordered
162
195
 
163
196
  VCR.use_cassette('pull_request_does_exist_with_success_status') do
164
197
  cli.release
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitx
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.2.ci.70.1
4
+ version: 2.15.0.ci.75.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek
@@ -252,6 +252,7 @@ extensions: []
252
252
  extra_rdoc_files: []
253
253
  files:
254
254
  - .gitignore
255
+ - .gitx.yml
255
256
  - .hound.yml
256
257
  - .rspec
257
258
  - .rubocop.yml