otr 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/lib/otr.rb +8 -3
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
= One True Repo
|
2
2
|
|
3
|
-
Created by {Stephen McDonald}[http://twitter.com/stephen_mcd]
|
4
|
-
|
5
3
|
== One feed to rule them all, and in the mashup bind them.
|
6
4
|
|
5
|
+
Created by {Stephen McDonald}[http://twitter.com/stephen_mcd]
|
6
|
+
|
7
7
|
_One_ _True_ _Repo_ merges both the {GitHub}[http://github.com] and
|
8
8
|
{Bitbucket}[http://bitbucket.org] APIs into a single JSON feed,
|
9
9
|
for the purpose of combining numbers of watchers and forks across
|
data/lib/otr.rb
CHANGED
@@ -5,12 +5,17 @@ require "json"
|
|
5
5
|
require "rest_client"
|
6
6
|
|
7
7
|
module OTR
|
8
|
-
VERSION = "0.1.
|
8
|
+
VERSION = "0.1.3"
|
9
|
+
USER_AGENT = "otr.jupo.org"
|
10
|
+
|
11
|
+
def self.get_json(url)
|
12
|
+
JSON.parse(RestClient.get(url, :user_agent => USER_AGENT))
|
13
|
+
end
|
9
14
|
|
10
15
|
def self.get_bb(username)
|
11
16
|
repos = {}
|
12
17
|
url = "https://api.bitbucket.org/1.0/users/#{username}/"
|
13
|
-
|
18
|
+
self.get_json(url)["repositories"].map { |repo|
|
14
19
|
Thread.new repo do |repo|
|
15
20
|
name = repo["slug"]
|
16
21
|
url = "https://bitbucket.org/#{username}/#{name}/descendants"
|
@@ -33,7 +38,7 @@ module OTR
|
|
33
38
|
while true
|
34
39
|
page += 1
|
35
40
|
url = "https://api.github.com/users/#{username}/repos?page=#{page}"
|
36
|
-
repos =
|
41
|
+
repos = self.get_json(url)
|
37
42
|
break if repos.count == 0
|
38
43
|
all_repos += repos
|
39
44
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: otr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stephen McDonald
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-05-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rest-client
|