Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix 404 error for github api, now used v3 api.

  • Loading branch information...
commit d10debc84d2dda457698dc77b769c735561d8a58 1 parent ed0fd0b
@hsbt hsbt authored
View
2  Gemfile.lock
@@ -20,7 +20,7 @@ GEM
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
rspec-mocks (~> 2.10.0)
- rspec-core (2.10.0)
+ rspec-core (2.10.1)
rspec-expectations (2.10.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.10.1)
View
8 lib/atig/update_checker.rb
@@ -3,7 +3,7 @@
module Atig
module UpdateChecker
def commits
- uri = URI("http://github.com/api/v1/json/mzp/atig/commits/master")
+ uri = URI("https://api.github.com/repos/mzp/atig/commits")
http = Atig::Http.new
res = http.http(uri).request http.req(:get, uri)
JSON.parse(res.body)['commits']
@@ -29,18 +29,18 @@ def latest
[]
else
cs = commits
- latest = cs.first['id'][/^[0-9a-z]{40}$/]
+ latest = cs.first['sha'][/^[0-9a-z]{40}$/]
raise "github API changed?" unless latest
if local_repos?(latest) then
[]
else
- current = cs.map {|i| i['id'] }.index(server_version)
+ current = cs.map {|i| i['sha'] }.index(server_version)
if current then
cs[0...current]
else
cs
- end.map {|i| i['message'] }
+ end.map {|i| i['commit']['message'] }
end
end
rescue Errno::ECONNREFUSED, Timeout::Error => e
View
2  spec/update_checker_spec.rb
@@ -9,7 +9,7 @@ def rev(c)
end
def commit(c, mesg)
- {'id' => rev(c), 'message' => mesg}
+ {'sha' => rev(c), 'commit' => {'message' => mesg}}
end
before do
Please sign in to comment.
Something went wrong with that request. Please try again.