octopi 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 1
4
+ :patch: 2
@@ -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
- @@retries += 1
125
- sleep 6
126
- retry
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."
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{octopi}
8
- s.version = "0.2.1"
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-11-10}
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",
@@ -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.1
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-11-10 00:00:00 +10:00
12
+ date: 2009-12-05 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency