thegarage-gitx 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thegarage/gitx/cli/integrate_command.rb +1 -1
- data/lib/thegarage/gitx/cli/release_command.rb +5 -0
- data/lib/thegarage/gitx/cli/review_command.rb +1 -1
- data/lib/thegarage/gitx/{cli/github.rb → github.rb} +0 -0
- data/lib/thegarage/gitx/version.rb +1 -1
- data/spec/thegarage/gitx/cli/release_command_spec.rb +52 -2
- 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: 0c816348d551adad9dafcf7efb19f3430707347d
|
4
|
+
data.tar.gz: e99bc201fb96d47977ab8f105a234e0c47549f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c412f5989ed6aba0ffb0485d655af476967c0631c35ffa39ff874f24b6826cdff9db8a94bbc7676f33339583334032e72f33341ac8fb94d485b7ed32b9e3504
|
7
|
+
data.tar.gz: 74f411acf2307fa4470478400f244db2ef27afbbe22dccc8055350b5e5791494b866bd3ccb98cf86c673c61f4410312a47441c88066781e17a5642e509f1ba4a
|
@@ -4,11 +4,14 @@ require 'thegarage/gitx/cli/base_command'
|
|
4
4
|
require 'thegarage/gitx/cli/update_command'
|
5
5
|
require 'thegarage/gitx/cli/integrate_command'
|
6
6
|
require 'thegarage/gitx/cli/cleanup_command'
|
7
|
+
require 'thegarage/gitx/github'
|
7
8
|
|
8
9
|
module Thegarage
|
9
10
|
module Gitx
|
10
11
|
module Cli
|
11
12
|
class ReleaseCommand < BaseCommand
|
13
|
+
include Github
|
14
|
+
|
12
15
|
desc 'release', 'release the current branch to production'
|
13
16
|
def release
|
14
17
|
return unless yes?("Release #{current_branch.name} to production? (y/n)", :green)
|
@@ -17,6 +20,8 @@ module Thegarage
|
|
17
20
|
assert_not_protected_branch!(branch, 'release')
|
18
21
|
UpdateCommand.new.update
|
19
22
|
|
23
|
+
find_or_create_pull_request(branch)
|
24
|
+
|
20
25
|
checkout_branch Thegarage::Gitx::BASE_BRANCH
|
21
26
|
run_cmd "git pull origin #{Thegarage::Gitx::BASE_BRANCH}"
|
22
27
|
run_cmd "git merge --no-ff #{branch}"
|
File without changes
|
@@ -28,10 +28,11 @@ describe Thegarage::Gitx::Cli::ReleaseCommand do
|
|
28
28
|
should meet_expectations
|
29
29
|
end
|
30
30
|
end
|
31
|
-
context 'when user confirms release' do
|
31
|
+
context 'when user confirms release and pull request exists' do
|
32
32
|
let(:fake_update_command) { double('fake update command', update: nil) }
|
33
33
|
let(:fake_integrate_command) { double('fake integrate command') }
|
34
34
|
let(:fake_cleanup_command) { double('fake cleanup command', cleanup: nil) }
|
35
|
+
let(:authorization_token) { '123123' }
|
35
36
|
before do
|
36
37
|
expect(Thegarage::Gitx::Cli::UpdateCommand).to receive(:new).and_return(fake_update_command)
|
37
38
|
expect(Thegarage::Gitx::Cli::IntegrateCommand).to receive(:new).and_return(fake_integrate_command)
|
@@ -40,13 +41,62 @@ describe Thegarage::Gitx::Cli::ReleaseCommand do
|
|
40
41
|
expect(fake_integrate_command).to receive(:integrate).with('staging')
|
41
42
|
|
42
43
|
expect(cli).to receive(:yes?).and_return(true)
|
44
|
+
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
43
45
|
|
44
46
|
expect(cli).to receive(:run_cmd).with("git checkout master").ordered
|
45
47
|
expect(cli).to receive(:run_cmd).with("git pull origin master").ordered
|
46
48
|
expect(cli).to receive(:run_cmd).with("git merge --no-ff feature-branch").ordered
|
47
49
|
expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
|
48
50
|
|
49
|
-
|
51
|
+
VCR.use_cassette('pull_request_does_exist') do
|
52
|
+
cli.release
|
53
|
+
end
|
54
|
+
end
|
55
|
+
it 'runs expected commands' do
|
56
|
+
should meet_expectations
|
57
|
+
end
|
58
|
+
end
|
59
|
+
context 'when user confirms release and pull request does not exist' do
|
60
|
+
let(:authorization_token) { '123123' }
|
61
|
+
let(:fake_update_command) { double('fake update command', update: nil) }
|
62
|
+
let(:fake_integrate_command) { double('fake integrate command') }
|
63
|
+
let(:fake_cleanup_command) { double('fake cleanup command', cleanup: nil) }
|
64
|
+
let(:new_pull_request) do
|
65
|
+
{
|
66
|
+
html_url: "https://path/to/html/pull/request",
|
67
|
+
issue_url: "https://api/path/to/issue/url",
|
68
|
+
number: 10,
|
69
|
+
head: {
|
70
|
+
ref: "branch_name"
|
71
|
+
}
|
72
|
+
}
|
73
|
+
end
|
74
|
+
before do
|
75
|
+
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
76
|
+
allow(cli).to receive(:ask_editor).and_return('description')
|
77
|
+
|
78
|
+
expect(Thegarage::Gitx::Cli::UpdateCommand).to receive(:new).and_return(fake_update_command).twice
|
79
|
+
expect(Thegarage::Gitx::Cli::IntegrateCommand).to receive(:new).and_return(fake_integrate_command)
|
80
|
+
expect(Thegarage::Gitx::Cli::CleanupCommand).to receive(:new).and_return(fake_cleanup_command)
|
81
|
+
|
82
|
+
expect(fake_update_command).to receive(:update).twice
|
83
|
+
expect(fake_integrate_command).to receive(:integrate).with('staging')
|
84
|
+
|
85
|
+
expect(cli).to receive(:yes?).and_return(true)
|
86
|
+
|
87
|
+
expect(cli).to receive(:run_cmd).with("git log master...feature-branch --no-merges --pretty=format:'* %s%n%b'").and_return("2013-01-01 did some stuff").ordered
|
88
|
+
expect(cli).to receive(:run_cmd).with("git checkout master").ordered
|
89
|
+
expect(cli).to receive(:run_cmd).with("git pull origin master").ordered
|
90
|
+
expect(cli).to receive(:run_cmd).with("git merge --no-ff feature-branch").ordered
|
91
|
+
expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
|
92
|
+
|
93
|
+
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'})
|
94
|
+
VCR.use_cassette('pull_request_does_not_exist') do
|
95
|
+
cli.release
|
96
|
+
end
|
97
|
+
end
|
98
|
+
it 'creates pull request on github' do
|
99
|
+
should meet_expectations
|
50
100
|
end
|
51
101
|
it 'runs expected commands' do
|
52
102
|
should meet_expectations
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thegarage-gitx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Sonnek
|
@@ -263,7 +263,6 @@ files:
|
|
263
263
|
- lib/thegarage/gitx/cli/base_command.rb
|
264
264
|
- lib/thegarage/gitx/cli/buildtag_command.rb
|
265
265
|
- lib/thegarage/gitx/cli/cleanup_command.rb
|
266
|
-
- lib/thegarage/gitx/cli/github.rb
|
267
266
|
- lib/thegarage/gitx/cli/integrate_command.rb
|
268
267
|
- lib/thegarage/gitx/cli/nuke_command.rb
|
269
268
|
- lib/thegarage/gitx/cli/release_command.rb
|
@@ -274,6 +273,7 @@ files:
|
|
274
273
|
- lib/thegarage/gitx/cli/update_command.rb
|
275
274
|
- lib/thegarage/gitx/extensions/string.rb
|
276
275
|
- lib/thegarage/gitx/extensions/thor.rb
|
276
|
+
- lib/thegarage/gitx/github.rb
|
277
277
|
- lib/thegarage/gitx/version.rb
|
278
278
|
- spec/fixtures/vcr_cassettes/pull_request_does_exist.yml
|
279
279
|
- spec/fixtures/vcr_cassettes/pull_request_does_not_exist.yml
|