thegarage-gitx 1.5.5.pre1 → 2.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +8 -0
- data/README.md +2 -0
- data/bin/git-buildtag +3 -2
- data/bin/git-cleanup +4 -2
- data/bin/git-integrate +3 -2
- data/bin/git-nuke +3 -2
- data/bin/git-release +3 -2
- data/bin/git-reviewrequest +3 -2
- data/bin/git-share +3 -2
- data/bin/git-start +3 -2
- data/bin/git-track +3 -2
- data/bin/git-update +3 -2
- data/lib/thegarage/gitx/cli/base_command.rb +74 -0
- data/lib/thegarage/gitx/cli/buildtag_command.rb +39 -0
- data/lib/thegarage/gitx/cli/cleanup_command.rb +36 -0
- data/lib/thegarage/gitx/cli/integrate_command.rb +40 -0
- data/lib/thegarage/gitx/cli/nuke_command.rb +64 -0
- data/lib/thegarage/gitx/cli/release_command.rb +31 -0
- data/lib/thegarage/gitx/cli/review_request_command.rb +203 -0
- data/lib/thegarage/gitx/cli/share_command.rb +17 -0
- data/lib/thegarage/gitx/cli/start_command.rb +31 -0
- data/lib/thegarage/gitx/cli/track_command.rb +16 -0
- data/lib/thegarage/gitx/cli/update_command.rb +23 -0
- data/lib/thegarage/gitx/version.rb +1 -1
- data/lib/thegarage/gitx.rb +0 -2
- data/spec/spec_helper.rb +3 -1
- data/spec/thegarage/gitx/cli/buildtag_command_spec.rb +71 -0
- data/spec/thegarage/gitx/cli/cleanup_command_spec.rb +38 -0
- data/spec/thegarage/gitx/cli/integrate_command_spec.rb +65 -0
- data/spec/thegarage/gitx/cli/nuke_command_spec.rb +105 -0
- data/spec/thegarage/gitx/cli/release_command_spec.rb +56 -0
- data/spec/thegarage/gitx/cli/review_request_command_spec.rb +188 -0
- data/spec/thegarage/gitx/cli/share_command_spec.rb +32 -0
- data/spec/thegarage/gitx/cli/start_command_spec.rb +61 -0
- data/spec/thegarage/gitx/cli/track_command_spec.rb +31 -0
- data/spec/thegarage/gitx/cli/update_command_spec.rb +33 -0
- data/thegarage-gitx.gemspec +3 -0
- metadata +76 -11
- data/lib/thegarage/gitx/cli.rb +0 -117
- data/lib/thegarage/gitx/git.rb +0 -210
- data/lib/thegarage/gitx/github.rb +0 -185
- data/spec/thegarage/gitx/cli_spec.rb +0 -257
- data/spec/thegarage/gitx/git_spec.rb +0 -231
- data/spec/thegarage/gitx/github_spec.rb +0 -91
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Thegarage::Gitx::Github do
|
4
|
-
let(:repo) { double('fake shell', config: repo_config) }
|
5
|
-
let(:repo_config) do
|
6
|
-
{
|
7
|
-
'remote.origin.url' => 'https://github.com/thegarage/thegarage-gitx'
|
8
|
-
}
|
9
|
-
end
|
10
|
-
let(:shell) { double('fake shell', say: nil, ask: nil) }
|
11
|
-
subject { Thegarage::Gitx::Github.new(repo, shell) }
|
12
|
-
|
13
|
-
describe '#authorization_token' do
|
14
|
-
context 'when github.user is not configured' do
|
15
|
-
it 'raises error' do
|
16
|
-
expect do
|
17
|
-
subject.authorization_token
|
18
|
-
end.to raise_error(/Github user not configured/)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
context 'when config.authorization_token is nil' do
|
22
|
-
let(:repo_config) do
|
23
|
-
{
|
24
|
-
'remote.origin.url' => 'https://github.com/thegarage/thegarage-gitx',
|
25
|
-
'github.user' => 'ryan@codecrate.com'
|
26
|
-
}
|
27
|
-
end
|
28
|
-
let(:github_password) { 'secretz' }
|
29
|
-
let(:authorization_token) { '123981239123' }
|
30
|
-
let(:expected_auth_body) do
|
31
|
-
JSON.dump({
|
32
|
-
scopes: ["repo"],
|
33
|
-
note: "The Garage Git eXtensions",
|
34
|
-
note_url: "https://github.com/thegarage/thegarage-gitx"
|
35
|
-
})
|
36
|
-
end
|
37
|
-
before do
|
38
|
-
stub_request(:post, "https://ryan@codecrate.com:secretz@api.github.com/authorizations").
|
39
|
-
with(:body => expected_auth_body).
|
40
|
-
to_return(:status => 200, :body => JSON.dump(token: authorization_token), :headers => {})
|
41
|
-
|
42
|
-
expect(shell).to receive(:ask).with('Github password for ryan@codecrate.com: ', {:echo => false}).and_return(github_password)
|
43
|
-
|
44
|
-
@auth_token = subject.authorization_token
|
45
|
-
end
|
46
|
-
it 'stores authorization_token in git config' do
|
47
|
-
expect(repo_config).to include('thegarage.gitx.githubauthtoken' => authorization_token)
|
48
|
-
end
|
49
|
-
it { expect(@auth_token).to eq authorization_token }
|
50
|
-
end
|
51
|
-
context 'when there is an existing authorization_token' do
|
52
|
-
let(:authorization_token) { '123981239123' }
|
53
|
-
let(:repo_config) do
|
54
|
-
{
|
55
|
-
'remote.origin.url' => 'https://github.com/thegarage/thegarage-gitx',
|
56
|
-
'github.user' => 'ryan@codecrate.com',
|
57
|
-
'thegarage.gitx.githubauthtoken' => authorization_token
|
58
|
-
}
|
59
|
-
end
|
60
|
-
before do
|
61
|
-
@auth_token = subject.authorization_token
|
62
|
-
end
|
63
|
-
it { expect(@auth_token).to eq authorization_token }
|
64
|
-
end
|
65
|
-
end
|
66
|
-
describe '#create_pull_request' do
|
67
|
-
context 'when there is an existing authorization_token' do
|
68
|
-
let(:authorization_token) { '123981239123' }
|
69
|
-
let(:repo_config) do
|
70
|
-
{
|
71
|
-
'remote.origin.url' => 'https://github.com/thegarage/thegarage-gitx',
|
72
|
-
'github.user' => 'ryan@codecrate.com',
|
73
|
-
'thegarage.gitx.githubauthtoken' => authorization_token
|
74
|
-
}
|
75
|
-
end
|
76
|
-
before do
|
77
|
-
stub_request(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/pulls").
|
78
|
-
to_return(:status => 200, :body => %q({"html_url": "http://github.com/repo/project/pulls/1"}), :headers => {})
|
79
|
-
|
80
|
-
expect(subject).to receive(:input_from_editor).and_return('scrubbed text')
|
81
|
-
subject.create_pull_request 'example-branch', 'changelog'
|
82
|
-
end
|
83
|
-
it 'should create github pull request' do
|
84
|
-
should meet_expectations
|
85
|
-
end
|
86
|
-
it 'should run expected commands' do
|
87
|
-
should meet_expectations
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|