thegarage-gitx 2.13.1 → 2.14.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 +4 -0
- data/lib/thegarage/gitx/cli/integrate_command.rb +2 -1
- data/lib/thegarage/gitx/version.rb +1 -1
- data/spec/thegarage/gitx/cli/integrate_command_spec.rb +76 -58
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dbfd6ee46fe1a237617f9d3b49870be833ceb3a
|
4
|
+
data.tar.gz: 70a854edc6ab9e7f53826fb499ad08226f4fa318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 838035ded4221ebe0e430c31b44bef2d77798aa0ddebf7effb8ef7a45df1aa211daa35e0394a35bb0054b607b8956e033680d2e74c142bddb635159737af73bb
|
7
|
+
data.tar.gz: 2ee82330158b17347e098d3d303aa456ce8c4770707746b005cd94ab88807ccf628a4aa9660eb040cb32b0b9cc82e32003a40e3830a68bc4b540a7f12dfb1fa2
|
data/README.md
CHANGED
@@ -26,6 +26,10 @@ update the local feature branch with latest remote changes plus upstream release
|
|
26
26
|
|
27
27
|
integrate the current feature branch into an aggregate branch (ex: prototype, staging)
|
28
28
|
|
29
|
+
options:
|
30
|
+
* `--comment` or `-c` = Add a comment about the integration to an existing PR for the working branch. Create a new PR for that branch if one does not exist.
|
31
|
+
* `--resume` or `-r` = Resume integration after resolving a merge conflict on the aggregate branch.
|
32
|
+
|
29
33
|
## git review <feature_branch_name (optional, default: current_branch)>
|
30
34
|
|
31
35
|
create a pull request on github for peer review of the current branch. This command is re-runnable
|
@@ -11,6 +11,7 @@ module Thegarage
|
|
11
11
|
include Thegarage::Gitx::Github
|
12
12
|
desc 'integrate', 'integrate the current branch into one of the aggregate development branches (default = staging)'
|
13
13
|
method_option :resume, :type => :string, :aliases => '-r', :desc => 'resume merging of feature-branch'
|
14
|
+
method_option :comment, :type => :boolean, :aliases => '-c', :desc => 'add a comment to the pull request for this branch. Creates a new PR if none exists.'
|
14
15
|
def integrate(integration_branch = 'staging')
|
15
16
|
assert_aggregate_branch!(integration_branch)
|
16
17
|
|
@@ -26,7 +27,7 @@ module Thegarage
|
|
26
27
|
integrate_branch(branch, integration_branch) unless options[:resume]
|
27
28
|
checkout_branch branch
|
28
29
|
|
29
|
-
create_integrate_comment(branch)
|
30
|
+
create_integrate_comment(branch) if options[:comment] && !config.reserved_branch?(branch)
|
30
31
|
end
|
31
32
|
|
32
33
|
private
|
@@ -47,9 +47,8 @@ describe Thegarage::Gitx::Cli::IntegrateCommand do
|
|
47
47
|
it 'defaults to staging branch' do
|
48
48
|
should meet_expectations
|
49
49
|
end
|
50
|
-
it '
|
51
|
-
expect(WebMock).
|
52
|
-
with(body: {body: '[gitx] integrated into staging :twisted_rightwards_arrows:'})
|
50
|
+
it 'does not post comment to pull request' do
|
51
|
+
expect(WebMock).to_not have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments")
|
53
52
|
end
|
54
53
|
end
|
55
54
|
context 'when current_branch == master' do
|
@@ -74,51 +73,6 @@ describe Thegarage::Gitx::Cli::IntegrateCommand do
|
|
74
73
|
expect(WebMock).to_not have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/pulls")
|
75
74
|
end
|
76
75
|
end
|
77
|
-
context 'when a pull request doesnt exist for the feature-branch' do
|
78
|
-
let(:authorization_token) { '123123' }
|
79
|
-
let(:changelog) { '* made some fixes' }
|
80
|
-
let(:new_pull_request) do
|
81
|
-
{
|
82
|
-
html_url: "https://path/to/html/pull/request",
|
83
|
-
issue_url: "https://api/path/to/issue/url",
|
84
|
-
number: 10,
|
85
|
-
head: {
|
86
|
-
ref: "branch_name"
|
87
|
-
}
|
88
|
-
}
|
89
|
-
end
|
90
|
-
before do
|
91
|
-
allow(cli).to receive(:ask_editor).and_return('description')
|
92
|
-
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
93
|
-
expect(cli).to receive(:execute_command).with(Thegarage::Gitx::Cli::UpdateCommand, :update).twice
|
94
|
-
|
95
|
-
expect(cli).to receive(:run_cmd).with("git fetch origin").ordered
|
96
|
-
expect(cli).to receive(:run_cmd).with("git branch -D staging", allow_failure: true).ordered
|
97
|
-
expect(cli).to receive(:run_cmd).with("git checkout staging").ordered
|
98
|
-
expect(cli).to receive(:run_cmd).with("git merge feature-branch").ordered
|
99
|
-
expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
|
100
|
-
expect(cli).to receive(:run_cmd).with("git checkout feature-branch").ordered
|
101
|
-
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
102
|
-
expect(cli).to receive(:run_cmd).with("git log master...feature-branch --reverse --no-merges --pretty=format:'* %s%n%b'").and_return("2013-01-01 did some stuff").ordered
|
103
|
-
|
104
|
-
stub_request(:post, 'https://api.github.com/repos/thegarage/thegarage-gitx/pulls').to_return(:status => 201, :body => new_pull_request.to_json, :headers => {'Content-Type' => 'application/json'})
|
105
|
-
stub_request(:post, 'https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments').to_return(:status => 201)
|
106
|
-
|
107
|
-
VCR.use_cassette('pull_request_does_not_exist') do
|
108
|
-
cli.integrate
|
109
|
-
end
|
110
|
-
end
|
111
|
-
it 'creates github pull request' do
|
112
|
-
should meet_expectations
|
113
|
-
end
|
114
|
-
it 'creates github comment for integration' do
|
115
|
-
expect(WebMock).to have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments").
|
116
|
-
with(body: {body: '[gitx] integrated into staging :twisted_rightwards_arrows:'})
|
117
|
-
end
|
118
|
-
it 'runs expected commands' do
|
119
|
-
should meet_expectations
|
120
|
-
end
|
121
|
-
end
|
122
76
|
context 'when staging branch does not exist remotely' do
|
123
77
|
let(:authorization_token) { '123123' }
|
124
78
|
let(:remote_branch_names) { [] }
|
@@ -146,9 +100,6 @@ describe Thegarage::Gitx::Cli::IntegrateCommand do
|
|
146
100
|
it 'creates remote aggregate branch' do
|
147
101
|
should meet_expectations
|
148
102
|
end
|
149
|
-
it 'posts comment to pull request' do
|
150
|
-
expect(WebMock).to have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments")
|
151
|
-
end
|
152
103
|
end
|
153
104
|
context 'when integration branch == prototype and remote branch exists' do
|
154
105
|
let(:authorization_token) { '123123' }
|
@@ -173,9 +124,6 @@ describe Thegarage::Gitx::Cli::IntegrateCommand do
|
|
173
124
|
it 'runs expected commands' do
|
174
125
|
should meet_expectations
|
175
126
|
end
|
176
|
-
it 'posts comment to pull request' do
|
177
|
-
expect(WebMock).to have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments")
|
178
|
-
end
|
179
127
|
end
|
180
128
|
context 'when integration branch is not an aggregate branch' do
|
181
129
|
it 'raises an error' do
|
@@ -235,9 +183,6 @@ describe Thegarage::Gitx::Cli::IntegrateCommand do
|
|
235
183
|
it 'does not delete local staging branch' do
|
236
184
|
should meet_expectations
|
237
185
|
end
|
238
|
-
it 'posts comment to pull request' do
|
239
|
-
expect(WebMock).to have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments")
|
240
|
-
end
|
241
186
|
end
|
242
187
|
context 'with --resume "feature-branch" flag when feature-branch does not exist' do
|
243
188
|
let(:options) do
|
@@ -264,8 +209,81 @@ describe Thegarage::Gitx::Cli::IntegrateCommand do
|
|
264
209
|
it 'asks user for feature-branch name' do
|
265
210
|
should meet_expectations
|
266
211
|
end
|
212
|
+
end
|
213
|
+
context 'for default integration (to staging) with --comment flag' do
|
214
|
+
let(:options) do
|
215
|
+
{ comment: true }
|
216
|
+
end
|
217
|
+
let(:authorization_token) { '123123' }
|
218
|
+
let(:remote_branch_names) { ['origin/staging'] }
|
219
|
+
before do
|
220
|
+
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
221
|
+
expect(cli).to receive(:execute_command).with(Thegarage::Gitx::Cli::UpdateCommand, :update)
|
222
|
+
|
223
|
+
expect(cli).to receive(:run_cmd).with("git fetch origin").ordered
|
224
|
+
expect(cli).to receive(:run_cmd).with("git branch -D staging", allow_failure: true).ordered
|
225
|
+
expect(cli).to receive(:run_cmd).with("git checkout staging").ordered
|
226
|
+
expect(cli).to receive(:run_cmd).with("git merge feature-branch").ordered
|
227
|
+
expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
|
228
|
+
expect(cli).to receive(:run_cmd).with("git checkout feature-branch").ordered
|
229
|
+
|
230
|
+
stub_request(:post, /.*api.github.com.*/).to_return(:status => 201)
|
231
|
+
|
232
|
+
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
233
|
+
cli.integrate
|
234
|
+
end
|
235
|
+
end
|
236
|
+
it 'defaults to staging branch' do
|
237
|
+
should meet_expectations
|
238
|
+
end
|
267
239
|
it 'posts comment to pull request' do
|
268
|
-
expect(WebMock).to have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments")
|
240
|
+
expect(WebMock).to have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments").
|
241
|
+
with(body: {body: '[gitx] integrated into staging :twisted_rightwards_arrows:'})
|
242
|
+
end
|
243
|
+
end
|
244
|
+
context 'with --comment flag when a pull request doesn\'t exist for the feature-branch' do
|
245
|
+
let(:options) do
|
246
|
+
{ comment: true }
|
247
|
+
end
|
248
|
+
let(:authorization_token) { '123123' }
|
249
|
+
let(:changelog) { '* made some fixes' }
|
250
|
+
let(:new_pull_request) do
|
251
|
+
{
|
252
|
+
html_url: "https://path/to/html/pull/request",
|
253
|
+
issue_url: "https://api/path/to/issue/url",
|
254
|
+
number: 10,
|
255
|
+
head: {
|
256
|
+
ref: "branch_name"
|
257
|
+
}
|
258
|
+
}
|
259
|
+
end
|
260
|
+
before do
|
261
|
+
allow(cli).to receive(:ask_editor).and_return('description')
|
262
|
+
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
263
|
+
expect(cli).to receive(:execute_command).with(Thegarage::Gitx::Cli::UpdateCommand, :update).twice
|
264
|
+
|
265
|
+
expect(cli).to receive(:run_cmd).with("git fetch origin").ordered
|
266
|
+
expect(cli).to receive(:run_cmd).with("git branch -D staging", allow_failure: true).ordered
|
267
|
+
expect(cli).to receive(:run_cmd).with("git checkout staging").ordered
|
268
|
+
expect(cli).to receive(:run_cmd).with("git merge feature-branch").ordered
|
269
|
+
expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
|
270
|
+
expect(cli).to receive(:run_cmd).with("git checkout feature-branch").ordered
|
271
|
+
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
272
|
+
expect(cli).to receive(:run_cmd).with("git log master...feature-branch --reverse --no-merges --pretty=format:'* %s%n%b'").and_return("2013-01-01 did some stuff").ordered
|
273
|
+
|
274
|
+
stub_request(:post, 'https://api.github.com/repos/thegarage/thegarage-gitx/pulls').to_return(:status => 201, :body => new_pull_request.to_json, :headers => {'Content-Type' => 'application/json'})
|
275
|
+
stub_request(:post, 'https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments').to_return(:status => 201)
|
276
|
+
|
277
|
+
VCR.use_cassette('pull_request_does_not_exist') do
|
278
|
+
cli.integrate
|
279
|
+
end
|
280
|
+
end
|
281
|
+
it 'creates github pull request' do
|
282
|
+
should meet_expectations
|
283
|
+
end
|
284
|
+
it 'creates github comment for integration' do
|
285
|
+
expect(WebMock).to have_requested(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/issues/10/comments").
|
286
|
+
with(body: {body: '[gitx] integrated into staging :twisted_rightwards_arrows:'})
|
269
287
|
end
|
270
288
|
end
|
271
289
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thegarage-gitx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.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: 2015-
|
11
|
+
date: 2015-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|