pra 0.1.1
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 +7 -0
- data/.gitignore +17 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/ChangeLog.md +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +47 -0
- data/README.md +181 -0
- data/Rakefile +1 -0
- data/bin/pra +10 -0
- data/lib/pra/app.rb +36 -0
- data/lib/pra/config.rb +40 -0
- data/lib/pra/curses_window_system.rb +124 -0
- data/lib/pra/github_pull_source.rb +36 -0
- data/lib/pra/pull_request.rb +15 -0
- data/lib/pra/pull_request_service.rb +27 -0
- data/lib/pra/pull_source.rb +17 -0
- data/lib/pra/pull_source_factory.rb +20 -0
- data/lib/pra/stash_pull_source.rb +36 -0
- data/lib/pra/version.rb +3 -0
- data/lib/pra/window_system.rb +38 -0
- data/lib/pra/window_system_factory.rb +16 -0
- data/lib/pra.rb +5 -0
- data/pra.gemspec +27 -0
- data/spec/lib/pra/app_spec.rb +72 -0
- data/spec/lib/pra/config_spec.rb +128 -0
- data/spec/lib/pra/curses_window_system_spec.rb +4 -0
- data/spec/lib/pra/github_pull_source_spec.rb +128 -0
- data/spec/lib/pra/pull_request_service_spec.rb +78 -0
- data/spec/lib/pra/pull_request_spec.rb +4 -0
- data/spec/lib/pra/pull_source_factory_spec.rb +40 -0
- data/spec/lib/pra/pull_source_spec.rb +17 -0
- data/spec/lib/pra/stash_pull_source_spec.rb +128 -0
- data/spec/lib/pra/window_system_factory_spec.rb +13 -0
- data/spec/lib/pra/window_system_spec.rb +27 -0
- data/spec/spec_helper.rb +0 -0
- metadata +163 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
require_relative "../../../lib/pra/stash_pull_source"
|
2
|
+
|
3
|
+
describe Pra::StashPullSource do
|
4
|
+
describe "#pull_requests" do
|
5
|
+
it "gets all the repositories" do
|
6
|
+
subject.should_receive(:repositories).and_return([])
|
7
|
+
subject.pull_requests
|
8
|
+
end
|
9
|
+
|
10
|
+
it "gets the pull requests for each repository" do
|
11
|
+
config = {
|
12
|
+
"protocol" => "https",
|
13
|
+
"host" => "my.stash.instance",
|
14
|
+
"username" => "foo",
|
15
|
+
"password" => "bar",
|
16
|
+
"repositories" => [
|
17
|
+
{ "project_slug" => "CAP", "repository_slug" => "capture_api" }
|
18
|
+
]
|
19
|
+
}
|
20
|
+
pull_source = Pra::StashPullSource.new(config)
|
21
|
+
pull_source.should_receive(:get_repo_pull_requests).with({ "project_slug" => "CAP", "repository_slug" => "capture_api" }).and_return([])
|
22
|
+
pull_source.pull_requests
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns the collection of all of the pull requests for the configured repos" do
|
26
|
+
config = {
|
27
|
+
"protocol" => "https",
|
28
|
+
"host" => "my.stash.instance",
|
29
|
+
"username" => "foo",
|
30
|
+
"password" => "bar",
|
31
|
+
"repositories" => [
|
32
|
+
{ "project_slug" => "CAP", "repository_slug" => "capture_api" },
|
33
|
+
{ "project_slug" => "CAP", "repository_slug" => "capture_crawler_api" }
|
34
|
+
]
|
35
|
+
}
|
36
|
+
pull_request_one = double('pull request one')
|
37
|
+
pull_request_two = double('pull request two')
|
38
|
+
pull_source = Pra::StashPullSource.new(config)
|
39
|
+
pull_source.stub(:get_repo_pull_requests).with({ "project_slug" => "CAP", "repository_slug" => "capture_api" }).and_return([pull_request_one])
|
40
|
+
pull_source.stub(:get_repo_pull_requests).with({ "project_slug" => "CAP", "repository_slug" => "capture_crawler_api" }).and_return([pull_request_two])
|
41
|
+
pull_source.pull_requests.should eq([pull_request_one, pull_request_two])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#repositories" do
|
46
|
+
it "returns the repositories segment of the config" do
|
47
|
+
config = {
|
48
|
+
"protocol" => "https",
|
49
|
+
"host" => "my.stash.instance",
|
50
|
+
"username" => "foo",
|
51
|
+
"password" => "bar",
|
52
|
+
"repositories" => [
|
53
|
+
{ "project_slug" => "CAP", "repository_slug" => "capture_api" }
|
54
|
+
]
|
55
|
+
}
|
56
|
+
pull_source = Pra::StashPullSource.new(config)
|
57
|
+
pull_source.repositories.should eq([{ "project_slug" => "CAP", "repository_slug" => "capture_api" }])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#get_repo_pull_requests" do
|
62
|
+
it "requests the pull requests for the given repo" do
|
63
|
+
config = {
|
64
|
+
"protocol" => "https",
|
65
|
+
"host" => "my.stash.instance",
|
66
|
+
"username" => "foo",
|
67
|
+
"password" => "bar",
|
68
|
+
"repositories" => [
|
69
|
+
{ "project_slug" => "CAP", "repository_slug" => "capture_api" }
|
70
|
+
]
|
71
|
+
}
|
72
|
+
pull_source = Pra::StashPullSource.new(config)
|
73
|
+
the_resource = double
|
74
|
+
pull_source.stub(:rest_api_pull_request_resource).with({ "project_slug" => "CAP", "repository_slug" => "capture_api" }).and_return(the_resource)
|
75
|
+
the_resource.should_receive(:get).and_return('{ "values": [] }')
|
76
|
+
pull_source.get_repo_pull_requests({ "project_slug" => "CAP", "repository_slug" => "capture_api" })
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "#rest_api_pull_request_url" do
|
81
|
+
let(:config) do
|
82
|
+
{
|
83
|
+
"protocol" => "https",
|
84
|
+
"host" => "my.stash.instance",
|
85
|
+
"username" => "foo",
|
86
|
+
"password" => "bar",
|
87
|
+
"repositories" => [
|
88
|
+
{ "project_slug" => "CAP", "repository_slug" => "capture_api" }
|
89
|
+
]
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
it "returns the pull request url compiled from the config options" do
|
94
|
+
pull_source = Pra::StashPullSource.new(config)
|
95
|
+
pull_source.rest_api_pull_request_url({ "project_slug" => "CAP", "repository_slug" => "capture_api" }).should eq("https://my.stash.instance/rest/api/1.0/projects/CAP/repos/capture_api/pull-requests")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "#rest_api_pull_request_resource" do
|
100
|
+
let(:config) do
|
101
|
+
{
|
102
|
+
"protocol" => "https",
|
103
|
+
"host" => "my.stash.instance",
|
104
|
+
"username" => "foo",
|
105
|
+
"password" => "bar",
|
106
|
+
"repositories" => [
|
107
|
+
{ "project_slug" => "CAP", "repository_slug" => "capture_api" }
|
108
|
+
]
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
let(:repo_config) { {"project_slug" => "CAP", "repository_slug" => "capture_api"} }
|
113
|
+
|
114
|
+
subject { Pra::StashPullSource.new(config) }
|
115
|
+
|
116
|
+
it "gets the repository url compiled from the config options" do
|
117
|
+
subject.should_receive(:rest_api_pull_request_url).with(repo_config)
|
118
|
+
subject.rest_api_pull_request_resource(repo_config)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "builds a restclient resource using the pull request url and user credentials" do
|
122
|
+
url = "https://my.stash.instance/rest/api/1.0/projects/CAP/repos/capture_api/pull-requests"
|
123
|
+
subject.stub(:rest_api_pull_request_url).and_return(url)
|
124
|
+
RestClient::Resource.should_receive(:new).with(url, {user: "foo", password: "bar", content_type: :json, accept: :json})
|
125
|
+
subject.rest_api_pull_request_resource(repo_config)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../../../lib/pra/window_system_factory'
|
2
|
+
|
3
|
+
describe Pra::WindowSystemFactory do
|
4
|
+
describe ".build" do
|
5
|
+
it "constructs a CursesWindowSystem given a curses window system id 'curses'" do
|
6
|
+
expect(subject.build('curses')).to be_a(Pra::CursesWindowSystem)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "raises an exception when given an window system id it doesn't understand" do
|
10
|
+
expect{ subject.build('some_unknown_window_system_id') }.to raise_error(Pra::WindowSystemFactory::UnknownWindowSystemId)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative "../../../lib/pra/window_system"
|
2
|
+
|
3
|
+
describe Pra::WindowSystem do
|
4
|
+
describe "#setup" do
|
5
|
+
it "raises a message stating that the pure virtual method has not been implemented" do
|
6
|
+
expect { subject.setup }.to raise_error(Pra::WindowSystem::PureVirtualMethodNotImplemented)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#fetching_pull_requests" do
|
11
|
+
it "raises a message stating that the pure virtual method has not been implemented" do
|
12
|
+
expect { subject.fetching_pull_requests }.to raise_error(Pra::WindowSystem::PureVirtualMethodNotImplemented)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#refresh_pull_requests" do
|
17
|
+
it "raises a message stating that the pure virtual method has not been implemented" do
|
18
|
+
expect { subject.refresh_pull_requests(double('pull requests')) }.to raise_error(Pra::WindowSystem::PureVirtualMethodNotImplemented)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#run_loop" do
|
23
|
+
it "raises a message stating that the pure virtual method has not been implemented" do
|
24
|
+
expect { subject.run_loop }.to raise_error(Pra::WindowSystem::PureVirtualMethodNotImplemented)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pra
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew De Ponte
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.14.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.14.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.6.7
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.6.7
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: launchy
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.3.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.3.0
|
83
|
+
description: Command Line utility to make you aware of open pull-requests across systems
|
84
|
+
at all times.
|
85
|
+
email:
|
86
|
+
- cyphactor@gmail.com
|
87
|
+
executables:
|
88
|
+
- pra
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- .gitignore
|
93
|
+
- .ruby-gemset
|
94
|
+
- .ruby-version
|
95
|
+
- ChangeLog.md
|
96
|
+
- Gemfile
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bin/pra
|
101
|
+
- lib/pra.rb
|
102
|
+
- lib/pra/app.rb
|
103
|
+
- lib/pra/config.rb
|
104
|
+
- lib/pra/curses_window_system.rb
|
105
|
+
- lib/pra/github_pull_source.rb
|
106
|
+
- lib/pra/pull_request.rb
|
107
|
+
- lib/pra/pull_request_service.rb
|
108
|
+
- lib/pra/pull_source.rb
|
109
|
+
- lib/pra/pull_source_factory.rb
|
110
|
+
- lib/pra/stash_pull_source.rb
|
111
|
+
- lib/pra/version.rb
|
112
|
+
- lib/pra/window_system.rb
|
113
|
+
- lib/pra/window_system_factory.rb
|
114
|
+
- pra.gemspec
|
115
|
+
- spec/lib/pra/app_spec.rb
|
116
|
+
- spec/lib/pra/config_spec.rb
|
117
|
+
- spec/lib/pra/curses_window_system_spec.rb
|
118
|
+
- spec/lib/pra/github_pull_source_spec.rb
|
119
|
+
- spec/lib/pra/pull_request_service_spec.rb
|
120
|
+
- spec/lib/pra/pull_request_spec.rb
|
121
|
+
- spec/lib/pra/pull_source_factory_spec.rb
|
122
|
+
- spec/lib/pra/pull_source_spec.rb
|
123
|
+
- spec/lib/pra/stash_pull_source_spec.rb
|
124
|
+
- spec/lib/pra/window_system_factory_spec.rb
|
125
|
+
- spec/lib/pra/window_system_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
homepage: http://github.com/reachlocal/pra
|
128
|
+
licenses:
|
129
|
+
- MIT
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.0.5
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: CLI tool that shows open pull-requests across systems.
|
151
|
+
test_files:
|
152
|
+
- spec/lib/pra/app_spec.rb
|
153
|
+
- spec/lib/pra/config_spec.rb
|
154
|
+
- spec/lib/pra/curses_window_system_spec.rb
|
155
|
+
- spec/lib/pra/github_pull_source_spec.rb
|
156
|
+
- spec/lib/pra/pull_request_service_spec.rb
|
157
|
+
- spec/lib/pra/pull_request_spec.rb
|
158
|
+
- spec/lib/pra/pull_source_factory_spec.rb
|
159
|
+
- spec/lib/pra/pull_source_spec.rb
|
160
|
+
- spec/lib/pra/stash_pull_source_spec.rb
|
161
|
+
- spec/lib/pra/window_system_factory_spec.rb
|
162
|
+
- spec/lib/pra/window_system_spec.rb
|
163
|
+
- spec/spec_helper.rb
|