octopi 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/octopi/api.rb +8 -4
- data/octopi.gemspec +2 -2
- data/test/repository_test.rb +10 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/octopi/api.rb
CHANGED
@@ -119,11 +119,15 @@ module Octopi
|
|
119
119
|
self.class.get "/#{format}#{path}", { :format => format, :query => query }
|
120
120
|
end
|
121
121
|
rescue RetryableAPIError => e
|
122
|
-
if @@retries < MAX_RETRIES
|
122
|
+
if @@retries < MAX_RETRIES
|
123
123
|
$stderr.puts e.message
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
if e.code != 403
|
125
|
+
@@retries += 1
|
126
|
+
sleep 6
|
127
|
+
retry
|
128
|
+
else
|
129
|
+
raise APIError, "Github returned status #{e.code}, you may not have access to this resource."
|
130
|
+
end
|
127
131
|
else
|
128
132
|
raise APIError, "GitHub returned status #{e.code}, despite" +
|
129
133
|
" repeating the request #{MAX_RETRIES} times. Giving up."
|
data/octopi.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{octopi}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Felipe Coury"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-12-05}
|
13
13
|
s.email = %q{felipe.coury@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
data/test/repository_test.rb
CHANGED
@@ -16,6 +16,16 @@ class RepositoryTest < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
context Repository do
|
18
18
|
|
19
|
+
should "not retry for a repository you don't have access to" do
|
20
|
+
FakeWeb.register_uri(:get, "#{yaml_api}/repos/show/github/github", :status => 403)
|
21
|
+
|
22
|
+
exception = assert_raise APIError do
|
23
|
+
Repository.find(:user => "github", :name => "github")
|
24
|
+
end
|
25
|
+
|
26
|
+
assert_equal exception.message, "Github returned status 403, you may not have access to this resource."
|
27
|
+
end
|
28
|
+
|
19
29
|
should "return a repository for a user" do
|
20
30
|
assert_not_nil @user.repository(:name => "octopi")
|
21
31
|
assert @user.repository(:name => "octopi").is_a?(Repository)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felipe Coury
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-05 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|