octopi 0.3.0 → 0.4.0
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.rb +4 -1
- data/lib/octopi/api.rb +2 -1
- data/lib/octopi/gist.rb +1 -1
- data/lib/octopi/repository.rb +2 -2
- data/octopi.gemspec +2 -2
- data/test/repository_test.rb +1 -1
- data/test/test_helper.rb +15 -15
- metadata +4 -4
data/VERSION.yml
CHANGED
data/lib/octopi.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
+
require 'open-uri'
|
4
|
+
|
3
5
|
require 'httparty'
|
4
6
|
require 'mechanize'
|
5
7
|
require 'nokogiri'
|
@@ -8,6 +10,7 @@ require 'api_cache'
|
|
8
10
|
require 'yaml'
|
9
11
|
require 'pp'
|
10
12
|
|
13
|
+
|
11
14
|
# Core extension stuff
|
12
15
|
Dir[File.join(File.dirname(__FILE__), "ext/*.rb")].each { |f| require f }
|
13
16
|
|
@@ -76,7 +79,7 @@ module Octopi
|
|
76
79
|
}
|
77
80
|
|
78
81
|
# Login with the provided
|
79
|
-
a.get('
|
82
|
+
a.get('https://github.com/login') do |page|
|
80
83
|
user_page = page.form_with(:action => '/session') do |login|
|
81
84
|
login.login = username
|
82
85
|
login.password = password
|
data/lib/octopi/api.rb
CHANGED
@@ -11,7 +11,7 @@ module Octopi
|
|
11
11
|
class AnonymousApi < Api
|
12
12
|
include HTTParty
|
13
13
|
include Singleton
|
14
|
-
base_uri "
|
14
|
+
base_uri "https://github.com/api/v2"
|
15
15
|
|
16
16
|
def read_only?
|
17
17
|
true
|
@@ -166,6 +166,7 @@ module Octopi
|
|
166
166
|
# Ergh. Ugly way to do this. Find a better one!
|
167
167
|
cache = params.delete(:cache)
|
168
168
|
cache = true if cache.nil?
|
169
|
+
cache = false
|
169
170
|
params.each_pair do |k,v|
|
170
171
|
if path =~ /:#{k.to_s}/
|
171
172
|
params.delete(k)
|
data/lib/octopi/gist.rb
CHANGED
data/lib/octopi/repository.rb
CHANGED
@@ -44,8 +44,8 @@ module Octopi
|
|
44
44
|
def comments
|
45
45
|
# We have to specify xmlns as a prefix as the document is namespaced.
|
46
46
|
# Be wary!
|
47
|
-
path = "
|
48
|
-
xml = Nokogiri::XML(
|
47
|
+
path = "https://github.com/#{owner}/#{name}/comments.atom"
|
48
|
+
xml = Nokogiri::XML(open(URI.parse(path)))
|
49
49
|
entries = xml.xpath("//xmlns:entry")
|
50
50
|
comments = []
|
51
51
|
for entry in entries
|
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.
|
8
|
+
s.version = "0.4.0"
|
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{2010-
|
12
|
+
s.date = %q{2010-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
@@ -17,7 +17,7 @@ class RepositoryTest < Test::Unit::TestCase
|
|
17
17
|
context Repository do
|
18
18
|
|
19
19
|
should "not retry for a repository you don't have access to" do
|
20
|
-
FakeWeb.register_uri(:get, "
|
20
|
+
FakeWeb.register_uri(:get, "https://#{yaml_api}/repos/show/github/github", :status => 403)
|
21
21
|
|
22
22
|
exception = assert_raise APIError do
|
23
23
|
Repository.find(:user => "github", :name => "github")
|
data/test/test_helper.rb
CHANGED
@@ -49,7 +49,7 @@ def fake_everything
|
|
49
49
|
sha = "f6609209c3ac0badd004512d318bfaa508ea10ae"
|
50
50
|
fake_sha = "ea3cd978650417470535f3a4725b6b5042a6ab59"
|
51
51
|
|
52
|
-
plain_api = "github.com
|
52
|
+
plain_api = "github.com/api/v2/plain"
|
53
53
|
|
54
54
|
# Public stuff
|
55
55
|
fakes = {
|
@@ -147,7 +147,7 @@ def fake_everything
|
|
147
147
|
end
|
148
148
|
|
149
149
|
fakes.each do |key, value|
|
150
|
-
FakeWeb.register_uri(:get, "
|
150
|
+
FakeWeb.register_uri(:get, "https://#{yaml_api}/" + key, :response => stub_file(value))
|
151
151
|
end
|
152
152
|
|
153
153
|
gist_fakes = {
|
@@ -156,10 +156,10 @@ def fake_everything
|
|
156
156
|
|
157
157
|
|
158
158
|
gist_fakes.each do |key, value|
|
159
|
-
FakeWeb.register_uri(:get, "
|
159
|
+
FakeWeb.register_uri(:get, "https://gist.github.com/api/v1/yaml/#{key}", :response => stub_file(value))
|
160
160
|
end
|
161
161
|
["augustl", "bcalloway", "danlucraft", "dcrec1", "derencius", "dustin", "elliottcable", "gwoliveira", "hashrocket", "jruby", "kchris", "paulorv", "radar", "remi", "shanesveller", "superfeedr", "taylorrf", "tgraham", "tmm1", "tpope", "webbynode"].each do |followee|
|
162
|
-
FakeWeb.register_uri(:get, "
|
162
|
+
FakeWeb.register_uri(:get, "https://#{yaml_api}/user/show/#{followee}", :response => stub_file("users/#{followee}") )
|
163
163
|
end
|
164
164
|
|
165
165
|
|
@@ -175,25 +175,25 @@ def fake_everything
|
|
175
175
|
"issues/reopen/fcoury/octopi/27" => issues("27-reopened"),
|
176
176
|
"issues/comment/fcoury/octopi/28" => issues("comment", "28-comment")
|
177
177
|
}.each do |key, value|
|
178
|
-
FakeWeb.register_uri(:post, "
|
178
|
+
FakeWeb.register_uri(:post, "https://#{yaml_api}/" + key, :response => stub_file(value))
|
179
179
|
end
|
180
180
|
|
181
181
|
# # rboard is a private repository
|
182
|
-
FakeWeb.register_uri(:get, "
|
182
|
+
FakeWeb.register_uri(:get, "https://#{yaml_api}/repos/show/fcoury/rboard", :response => stub_file("errors", "repository", "not_found"))
|
183
183
|
|
184
184
|
# nothere is obviously an invalid sha
|
185
|
-
FakeWeb.register_uri(:get, "
|
185
|
+
FakeWeb.register_uri(:get, "https://#{yaml_api}/commits/show/fcoury/octopi/nothere", :status => ["404", "Not Found"])
|
186
186
|
# not-a-number is obviously not a *number*
|
187
|
-
FakeWeb.register_uri(:get, "
|
187
|
+
FakeWeb.register_uri(:get, "https://#{yaml_api}/issues/show/fcoury/octopi/not-a-number", :status => ["404", "Not Found"])
|
188
188
|
# is an invalid hash
|
189
|
-
FakeWeb.register_uri(:get, "
|
189
|
+
FakeWeb.register_uri(:get, "https://#{yaml_api}/tree/show/fcoury/octopi/#{fake_sha}", :status => ["404", "Not Found"])
|
190
190
|
# is not a user
|
191
|
-
FakeWeb.register_uri(:get, "
|
191
|
+
FakeWeb.register_uri(:get, "https://#{yaml_api}/user/show/i-am-most-probably-a-user-that-does-not-exist", :status => ["404", "Not Found"])
|
192
192
|
|
193
193
|
|
194
|
-
FakeWeb.register_uri(:get, "
|
195
|
-
FakeWeb.register_uri(:post, "
|
196
|
-
FakeWeb.register_uri(:get, "
|
194
|
+
FakeWeb.register_uri(:get, "https://github.com/login", :response => stub_file("login"))
|
195
|
+
FakeWeb.register_uri(:post, "https://github.com/session", :response => stub_file("dashboard"))
|
196
|
+
FakeWeb.register_uri(:get, "https://github.com/account", :response => stub_file("account"))
|
197
197
|
|
198
198
|
# Personal & Private stuff
|
199
199
|
|
@@ -234,11 +234,11 @@ def fake_everything
|
|
234
234
|
|
235
235
|
|
236
236
|
# And the plain fakes
|
237
|
-
FakeWeb.register_uri(:get, "
|
237
|
+
FakeWeb.register_uri(:get, "https://#{plain_api}/blob/show/fcoury/octopi/#{sha}",
|
238
238
|
:response => stub_file(File.join("blob", "fcoury", "octopi", "plain", sha)))
|
239
239
|
|
240
240
|
|
241
|
-
FakeWeb.register_uri(:get, "
|
241
|
+
FakeWeb.register_uri(:get, "https://github.com/fcoury/octopi/comments.atom", :response => stub_file("comments", "fcoury", "octopi", "comments.atom"))
|
242
242
|
end
|
243
243
|
|
244
244
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Felipe Coury
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-05 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|