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
a98d0da6
Commit
a98d0da6
authored
Apr 29, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Pod::Command::Presenter] Last activity for GitHub repos
parent
96f9bab6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
4 deletions
+34
-4
presenter.rb
lib/cocoapods/command/presenter.rb
+2
-1
cocoa_pod.rb
lib/cocoapods/command/presenter/cocoa_pod.rb
+23
-0
statistics.rb
lib/cocoapods/specification/statistics.rb
+9
-3
No files found.
lib/cocoapods/command/presenter.rb
View file @
a98d0da6
...
...
@@ -24,10 +24,11 @@ module Pod
result
<<
detail
(
'Homepage'
,
pod
.
homepage
)
result
<<
detail
(
'Source'
,
pod
.
source_url
)
if
@stats
result
<<
detail
(
'Pushed'
,
pod
.
github_last_activity
)
result
<<
detail
(
'Authors'
,
pod
.
authors
)
if
pod
.
authors
=~
/,/
result
<<
detail
(
'Author'
,
pod
.
authors
)
if
pod
.
authors
!~
/,/
result
<<
detail
(
'Platform'
,
pod
.
platform
)
result
<<
detail
(
'License'
,
pod
.
license
)
result
<<
detail
(
'Platform'
,
pod
.
platform
)
result
<<
detail
(
'Watchers'
,
pod
.
github_watchers
)
result
<<
detail
(
'Forks'
,
pod
.
github_forks
)
end
...
...
lib/cocoapods/command/presenter/cocoa_pod.rb
View file @
a98d0da6
...
...
@@ -72,6 +72,10 @@ module Pod
Pod
::
Specification
::
Statistics
.
instance
.
github_forks
(
@set
)
end
def
github_last_activity
distance_from_now_in_words
(
Pod
::
Specification
::
Statistics
.
instance
.
github_pushed_at
(
@set
))
end
def
==
(
other
)
self
.
class
===
other
&&
@set
==
other
.
set
end
...
...
@@ -92,6 +96,25 @@ module Pod
"
#{
words
[
0
..-
2
].
join
(
', '
)
}
, and
#{
words
.
last
}
"
end
end
def
distance_from_now_in_words
(
from_time
)
from_time
=
Time
.
parse
(
from_time
)
to_time
=
Time
.
now
distance_in_days
=
(((
to_time
-
from_time
).
abs
)
/
60
/
60
/
24
).
round
case
distance_in_days
when
0
..
7
"less than a week ago"
when
8
..
29
"
#{
distance_in_days
}
days ago"
when
30
..
45
"1 month ago"
when
46
..
365
"
#{
(
distance_in_days
.
to_f
/
30
).
round
}
months ago"
else
"more than a year ago"
end
end
end
end
end
...
...
lib/cocoapods/specification/statistics.rb
View file @
a98d0da6
...
...
@@ -41,6 +41,11 @@ module Pod
get_value
(
set
,
:gh_forks
)
end
def
github_pushed_at
(
set
)
github_stats_if_needed
(
set
)
get_value
(
set
,
:pushed_at
)
end
private
def
cache
...
...
@@ -88,9 +93,10 @@ module Pod
end
cache
[
set
.
name
]
||=
{}
set_value
(
set
,
:gh_watchers
,
repo
[
'watchers'
])
set_value
(
set
,
:gh_forks
,
repo
[
'forks'
])
set_value
(
set
,
:gh_date
,
Time
.
now
)
set_value
(
set
,
:gh_watchers
,
repo
[
'watchers'
])
set_value
(
set
,
:gh_forks
,
repo
[
'forks'
])
set_value
(
set
,
:pushed_at
,
repo
[
'pushed_at'
])
set_value
(
set
,
:gh_date
,
Time
.
now
)
save_cache
end
end
...
...
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