Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
6c9c347a
Commit
6c9c347a
authored
Apr 12, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[statistics] Switch to GitHub v3 api
parent
75de2a58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
statistics.rb
lib/cocoapods/specification/statistics.rb
+10
-4
No files found.
lib/cocoapods/specification/statistics.rb
View file @
6c9c347a
require
'net/http'
require
'net/https'
require
'uri'
require
'yaml'
require
'yaml'
module
Pod
module
Pod
...
@@ -81,9 +82,14 @@ module Pod
...
@@ -81,9 +82,14 @@ module Pod
gh_url
,
username
,
reponame
=
*
(
url
.
match
(
/[:\/]([\w\-]+)\/([\w\-]+)\.git/
).
to_a
)
gh_url
,
username
,
reponame
=
*
(
url
.
match
(
/[:\/]([\w\-]+)\/([\w\-]+)\.git/
).
to_a
)
return
unless
gh_url
return
unless
gh_url
response
=
Net
::
HTTP
.
get
(
'github.com'
,
"/api/v2/json/repos/show/
#{
username
}
/
#{
reponame
}
"
)
uri
=
URI
.
parse
(
"https://api.github.com/repos/
#{
username
}
/
#{
reponame
}
"
)
watchers
=
response
.
match
(
/\"watchers\"\W*:\W*([0-9]+)/
).
to_a
[
1
]
http
=
Net
::
HTTP
.
new
(
uri
.
host
,
uri
.
port
)
forks
=
response
.
match
(
/\"forks\"\W*:\W*([0-9]+)/
).
to_a
[
1
]
http
.
use_ssl
=
true
http
.
verify_mode
=
OpenSSL
::
SSL
::
VERIFY_NONE
request
=
Net
::
HTTP
::
Get
.
new
(
uri
.
request_uri
)
response
=
http
.
request
(
request
).
body
watchers
=
response
.
match
(
/"watchers"\W*:\W*([0-9]+)/
).
to_a
[
1
]
forks
=
response
.
match
(
/"forks"\W*:\W*([0-9]+)/
).
to_a
[
1
]
return
unless
watchers
&&
forks
return
unless
watchers
&&
forks
cache
[
set
.
name
]
||=
{}
cache
[
set
.
name
]
||=
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment