gitwrap 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gitwrap/data_creator.rb +50 -50
- data/lib/gitwrap/orgs.rb +9 -4
- data/lib/gitwrap/repos.rb +16 -5
- data/lib/gitwrap/users.rb +7 -2
- data/lib/gitwrap/version.rb +1 -1
- data/lib/gitwrap.rb +0 -2
- metadata +1 -2
- data/gitwrap-1.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b67a059d9c170daf80acb6d6f893309327b48a31
|
4
|
+
data.tar.gz: adea36ec4453c52631697d6eb9965c4743a06f24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a41968b4eabb0f86db6edf7959bff2f1acb410324e9502e876f91bd46a0a4f676660ec103d005c1008011eac319bcd16e6d2b1492cd52a2223b3de619a63fc5f
|
7
|
+
data.tar.gz: 62f33322695553554e9925954d082ef46faebebce365efb8d14ba3acfea8d4b3e01193468067b5ea700819c80c9052bb97313956cf60123685c95f832c9d9947
|
data/lib/gitwrap/data_creator.rb
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
module DataCreator
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
1
|
+
# module DataCreator
|
2
|
+
# $parsed_array = []
|
3
|
+
|
4
|
+
# def parse_data(url)
|
5
|
+
# data = open(url).read()
|
6
|
+
# data = JSON.parse(data)
|
7
|
+
# end
|
8
|
+
|
9
|
+
# def create_user(url)
|
10
|
+
# User.new(parse_data(url))
|
11
|
+
# end
|
12
|
+
|
13
|
+
# def create_many_users(url)
|
14
|
+
# data = parse_data(url)
|
15
|
+
# data.each {|user| $parsed_array << User.new(user) }
|
16
|
+
# $parsed_array
|
17
|
+
# end
|
18
|
+
|
19
|
+
# def create_org(url)
|
20
|
+
# Org.new(parse_data(url))
|
21
|
+
# end
|
22
|
+
|
23
|
+
# def create_many_orgs(url)
|
24
|
+
# data = parse_data(url)
|
25
|
+
# data.each { |org| $parsed_array << Org.new(org)}
|
26
|
+
# $parsed_array
|
27
|
+
# end
|
28
|
+
|
29
|
+
# def create_user_repos(url)
|
30
|
+
# data = parse_data(url)
|
31
|
+
# data.each { |repo| $parsed_array << Repo.new(repo)}
|
32
|
+
# $parsed_array
|
33
|
+
# end
|
34
|
+
|
35
|
+
# def create_org_repos(url)
|
36
|
+
# data = parse_data(url)
|
37
|
+
# data.each { |repo| $parsed_array << Repo.new(repo)}
|
38
|
+
# $parsed_array
|
39
|
+
# end
|
40
|
+
|
41
|
+
# def create_many_repos(url)
|
42
|
+
# data = parse_data(url)
|
43
|
+
# data.each { |repo| $parsed_array << Repo.new(repo)}
|
44
|
+
# $parsed_array
|
45
|
+
# end
|
46
|
+
|
47
|
+
# def create_single_repo(url)
|
48
|
+
# Repo.new(parse_data(url))
|
49
|
+
# end
|
50
|
+
# end
|
data/lib/gitwrap/orgs.rb
CHANGED
@@ -2,7 +2,8 @@ module Gitwrap
|
|
2
2
|
class Org < GithubConnection
|
3
3
|
attr_accessor :name, :site, :location, :public_repos, :followers, :members, :id
|
4
4
|
$current_org = 0
|
5
|
-
|
5
|
+
$all_orgs = []
|
6
|
+
|
6
7
|
def initialize(hash)
|
7
8
|
@id = hash["id"]
|
8
9
|
@name = hash["login"]
|
@@ -14,13 +15,17 @@ module Gitwrap
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def self.fetch_single_org(organization)
|
17
|
-
|
18
|
+
data = open("#{BASE_URL}orgs/#{organization}").open()
|
19
|
+
data = JSON.parse(data)
|
20
|
+
org = new(data)
|
18
21
|
end
|
19
22
|
|
20
23
|
def self.fetch_all_orgs
|
21
|
-
|
24
|
+
data = open("#{BASE_URL}organizations?since=#{$current_org}").read()
|
25
|
+
data = JSON.parse(data)
|
26
|
+
data.each {|org| $all_orgs << new(org)}
|
22
27
|
$current_org += orgs.length-1
|
23
|
-
|
28
|
+
$all_orgs
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
data/lib/gitwrap/repos.rb
CHANGED
@@ -2,6 +2,8 @@ module Gitwrap
|
|
2
2
|
class Repo < GithubConnection
|
3
3
|
attr_accessor :name, :url, :forks_count, :language, :stars
|
4
4
|
$current_repo = 0
|
5
|
+
$all_repos = []
|
6
|
+
$all_org_repos = []
|
5
7
|
|
6
8
|
def initialize(hash)
|
7
9
|
@name = hash["name"]
|
@@ -12,21 +14,30 @@ module Gitwrap
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def self.fetch_user_repos(username)
|
15
|
-
|
17
|
+
data = open("#{BASE_URL}users/#{username}/repos").read()
|
18
|
+
data = JSON.parse(data)
|
19
|
+
repo = new(data)
|
16
20
|
end
|
17
21
|
|
18
22
|
def self.fetch_org_repos(org)
|
19
|
-
|
23
|
+
data = open("#{BASE_URL}orgs/#{org}/repos").read()
|
24
|
+
data = JSON.parse(data)
|
25
|
+
data.each {|repo| $all_org_repos << new(repo) }
|
26
|
+
$all_org_repos
|
20
27
|
end
|
21
28
|
|
22
29
|
def self.fetch_all_repos
|
23
|
-
|
30
|
+
data = open("#{BASE_URL}repositories").read()
|
31
|
+
data = JSON.parse(data)
|
32
|
+
data.each { |repo| $all_repos << new(repo) }
|
24
33
|
$current_repo += repos.length-1
|
25
|
-
|
34
|
+
$all_repos
|
26
35
|
end
|
27
36
|
|
28
37
|
def self.fetch_single_repo(username, repo)
|
29
|
-
|
38
|
+
data = open("#{BASE_URL}repos/#{username}/#{repo}").read()
|
39
|
+
data = JSON.parse(data)
|
40
|
+
repo = new(data)
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
data/lib/gitwrap/users.rb
CHANGED
@@ -2,6 +2,7 @@ module Gitwrap
|
|
2
2
|
class User < GithubConnection
|
3
3
|
attr_accessor :name, :location, :email, :username
|
4
4
|
$current_id = 0
|
5
|
+
$all_users = []
|
5
6
|
|
6
7
|
def initialize(hash)
|
7
8
|
@name = hash['name']
|
@@ -11,11 +12,15 @@ module Gitwrap
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def self.fetch_single_user(username)
|
14
|
-
|
15
|
+
data = open("#{BASE_URL}users/#{username}").read()
|
16
|
+
data = JSON.parse(data)
|
17
|
+
user = new(data)
|
15
18
|
end
|
16
19
|
|
17
20
|
def self.fetch_all_users
|
18
|
-
|
21
|
+
data = open("#{BASE_URL}users?since=#{$current_id}").read()
|
22
|
+
data = JSON.parse(data)
|
23
|
+
data.each {|user| $all_users << new(user)}
|
19
24
|
$current_id += $all_users.length-1
|
20
25
|
$all_users
|
21
26
|
end
|
data/lib/gitwrap/version.rb
CHANGED
data/lib/gitwrap.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitwrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- oscarmarcelo95
|
@@ -53,7 +53,6 @@ files:
|
|
53
53
|
- Rakefile
|
54
54
|
- bin/console
|
55
55
|
- bin/setup
|
56
|
-
- gitwrap-1.1.0.gem
|
57
56
|
- gitwrap.gemspec
|
58
57
|
- lib/gitwrap.rb
|
59
58
|
- lib/gitwrap/.DS_Store
|
data/gitwrap-1.1.0.gem
DELETED
Binary file
|