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
762400ea
Commit
762400ea
authored
Mar 24, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[list-new] Introduce option to list new pods
parent
d68d308b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
7 deletions
+91
-7
list.rb
lib/cocoapods/command/list.rb
+91
-7
No files found.
lib/cocoapods/command/list.rb
View file @
762400ea
# from https://github.com/aanand/deadweight
begin
require
'colored'
rescue
LoadError
class
String
%w(red green blue yellow)
.
each
do
|
color
|
define_method
(
color
)
{
self
}
end
end
end
module
Pod
class
Command
class
List
<
Command
include
DisplayPods
def
self
.
banner
%{List all pods:
%{List all pods:
$ pod list [DAYS]
$ pod list
Lists all available pods.
Lists all available pods.}
$ pod list [DAYS]
Lists the pods introduced in the master repo since the given number of days.}
end
def
self
.
options
" --stats Show additional stats (like GitHub watchers and forks)
\n
"
+
super
end
def
initialize
(
argv
)
@stats
=
argv
.
option
(
'--stats'
)
@days
=
argv
.
arguments
.
first
end
def
run
def
list_all
display_pod_list
(
all_pods_sets
,
@stats
)
end
def
dir
File
.
expand_path
'~/.cocoapods/master'
end
def
list_directory_at_commit
(
commit
)
Dir
.
chdir
(
dir
)
do
|
_
|
`git ls-tree --name-only -r
#{
commit
}
`
end
end
def
commit_at_days_ago
(
days
)
return
'HEAD'
if
days
==
0
Dir
.
chdir
(
dir
)
do
|
_
|
`git rev-list -n1 --before="
#{
days
}
day ago" master`
end
end
def
pods_at_days_ago
(
days
=
7
)
commit
=
commit_at_days_ago
(
days
)
dir_list
=
list_directory_at_commit
(
commit
)
# Keep only directories
dir_list
.
gsub!
(
/^[^\/]*$/
,
''
)
#Clean pod names
dir_list
.
gsub!
(
/(.*)\/[0-9].*/
,
'\1'
)
result
=
dir_list
.
split
(
"
\n
"
).
uniq
result
.
delete
(
''
)
result
end
def
all_pods_sets
result
=
[]
Source
.
all
.
each
do
|
source
|
source
.
pod_sets
.
each
do
|
set
|
puts
"==>
#{
set
.
name
}
(
#{
set
.
versions
.
reverse
.
join
(
", "
)
}
)"
puts
"
#{
set
.
specification
.
summary
.
strip
}
"
puts
result
<<
set
end
end
result
end
def
list_new
pods_past
=
pods_at_days_ago
(
@days
)
pods_now
=
pods_at_days_ago
(
0
)
pods_diff
=
pods_now
-
pods_past
sets
=
all_pods_sets
.
select
{
|
set
|
pods_diff
.
include?
(
set
.
name
)
}
puts
if
pods_diff
.
count
puts
"
#{
pods_diff
.
count
}
new pods were added in the last
#{
@days
}
days
\n
"
puts
display_pod_list
(
sets
,
@stats
)
else
puts
"No new pods"
.
red
end
puts
end
def
run
if
@days
list_new
else
list_all
end
end
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