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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +8 -0
  3. data/README.md +2 -0
  4. data/bin/git-buildtag +3 -2
  5. data/bin/git-cleanup +4 -2
  6. data/bin/git-integrate +3 -2
  7. data/bin/git-nuke +3 -2
  8. data/bin/git-release +3 -2
  9. data/bin/git-reviewrequest +3 -2
  10. data/bin/git-share +3 -2
  11. data/bin/git-start +3 -2
  12. data/bin/git-track +3 -2
  13. data/bin/git-update +3 -2
  14. data/lib/thegarage/gitx/cli/base_command.rb +74 -0
  15. data/lib/thegarage/gitx/cli/buildtag_command.rb +39 -0
  16. data/lib/thegarage/gitx/cli/cleanup_command.rb +36 -0
  17. data/lib/thegarage/gitx/cli/integrate_command.rb +40 -0
  18. data/lib/thegarage/gitx/cli/nuke_command.rb +64 -0
  19. data/lib/thegarage/gitx/cli/release_command.rb +31 -0
  20. data/lib/thegarage/gitx/cli/review_request_command.rb +203 -0
  21. data/lib/thegarage/gitx/cli/share_command.rb +17 -0
  22. data/lib/thegarage/gitx/cli/start_command.rb +31 -0
  23. data/lib/thegarage/gitx/cli/track_command.rb +16 -0
  24. data/lib/thegarage/gitx/cli/update_command.rb +23 -0
  25. data/lib/thegarage/gitx/version.rb +1 -1
  26. data/lib/thegarage/gitx.rb +0 -2
  27. data/spec/spec_helper.rb +3 -1
  28. data/spec/thegarage/gitx/cli/buildtag_command_spec.rb +71 -0
  29. data/spec/thegarage/gitx/cli/cleanup_command_spec.rb +38 -0
  30. data/spec/thegarage/gitx/cli/integrate_command_spec.rb +65 -0
  31. data/spec/thegarage/gitx/cli/nuke_command_spec.rb +105 -0
  32. data/spec/thegarage/gitx/cli/release_command_spec.rb +56 -0
  33. data/spec/thegarage/gitx/cli/review_request_command_spec.rb +188 -0
  34. data/spec/thegarage/gitx/cli/share_command_spec.rb +32 -0
  35. data/spec/thegarage/gitx/cli/start_command_spec.rb +61 -0
  36. data/spec/thegarage/gitx/cli/track_command_spec.rb +31 -0
  37. data/spec/thegarage/gitx/cli/update_command_spec.rb +33 -0
  38. data/thegarage-gitx.gemspec +3 -0
  39. metadata +76 -11
  40. data/lib/thegarage/gitx/cli.rb +0 -117
  41. data/lib/thegarage/gitx/git.rb +0 -210
  42. data/lib/thegarage/gitx/github.rb +0 -185
  43. data/spec/thegarage/gitx/cli_spec.rb +0 -257
  44. data/spec/thegarage/gitx/git_spec.rb +0 -231
  45. 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