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
5f8ba914
Commit
5f8ba914
authored
Mar 24, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#188] Further cleanup
parent
e7453f1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
list.rb
lib/cocoapods/command/list.rb
+18
-17
search.rb
lib/cocoapods/command/search.rb
+3
-3
No files found.
lib/cocoapods/command/list.rb
View file @
5f8ba914
module
Pod
module
Pod
class
Command
class
Command
class
List
<
Command
class
List
<
Command
include
DisplayPods
def
self
.
banner
def
self
.
banner
%{List all pods:
%{List all pods:
$ pod list
$ pod list
...
@@ -20,35 +18,33 @@ module Pod
...
@@ -20,35 +18,33 @@ module Pod
super
super
end
end
include
DisplayPods
extend
Executable
executable
:git
def
initialize
(
argv
)
def
initialize
(
argv
)
@stats
=
argv
.
option
(
'--stats'
)
@stats
=
argv
.
option
(
'--stats'
)
#TODO: accept only integers
@days
=
argv
.
arguments
.
first
@days
=
argv
.
arguments
.
first
end
end
def
list_all
display_pod_list
(
all_pods_sets
,
@stats
)
end
def
dir
def
dir
File
.
expand_path
'~/.cocoapods/master'
File
.
expand_path
'~/.cocoapods/master'
end
end
def
list_directory_at_commit
(
commit
)
def
list_directory_at_commit
(
commit
)
Dir
.
chdir
(
dir
)
do
|
_
|
Dir
.
chdir
(
dir
)
{
git
(
"ls-tree --name-only -r
#{
commit
}
"
)
}
`git ls-tree --name-only -r
#{
commit
}
`
end
end
end
def
commit_at_days_ago
(
days
)
def
commit_at_days_ago
(
days
)
return
'HEAD'
if
days
==
0
return
'HEAD'
if
days
==
0
Dir
.
chdir
(
dir
)
do
|
_
|
Dir
.
chdir
(
dir
)
{
git
(
"rev-list -n1 --before=
\"
#{
days
}
day ago
\"
master"
)
}
`git rev-list -n1 --before="
#{
days
}
day ago" master`
end
end
end
def
pods_at_days_ago
(
days
=
7
)
def
pods_at_days_ago
(
days
)
commit
=
commit_at_days_ago
(
days
)
commit
=
commit_at_days_ago
(
days
)
dir_list
=
list_directory_at_commit
(
commit
)
dir_list
=
list_directory_at_commit
(
commit
)
# Keep only directories
# Keep only directories
dir_list
.
gsub!
(
/^[^\/]*$/
,
''
)
dir_list
.
gsub!
(
/^[^\/]*$/
,
''
)
#Clean pod names
#Clean pod names
...
@@ -70,22 +66,27 @@ module Pod
...
@@ -70,22 +66,27 @@ module Pod
end
end
def
list_new
def
list_new
#TODO: find the changes of all repos
pods_past
=
pods_at_days_ago
(
@days
)
pods_past
=
pods_at_days_ago
(
@days
)
pods_now
=
pods_at_days_ago
(
0
)
pods_now
=
pods_at_days_ago
(
0
)
pods_diff
=
pods_now
-
pods_past
pods_diff
=
pods_now
-
pods_past
sets
=
all_pods_sets
.
select
{
|
set
|
pods_diff
.
include?
(
set
.
name
)
}
sets
=
all_pods_sets
.
select
{
|
set
|
pods_diff
.
include?
(
set
.
name
)
}
puts
puts
if
pods_diff
.
count
if
sets
.
count
!=
0
puts
"
#{
pods_diff
.
count
}
new pods were added in the last
#{
@days
}
days
\n
"
puts
"
#{
sets
.
count
}
new pods were added in the last
#{
@days
}
days
"
puts
puts
display_pod_list
(
sets
,
@stats
)
display_pod_list
(
sets
,
@stats
)
else
else
puts
"No new pods
"
.
red
puts
"No new pods
were added in the last
#{
@days
}
days"
end
end
puts
puts
end
end
def
list_all
display_pod_list
(
all_pods_sets
,
@stats
)
end
def
run
def
run
if
@days
if
@days
list_new
list_new
...
...
lib/cocoapods/command/search.rb
View file @
5f8ba914
module
Pod
module
Pod
class
Command
class
Command
class
Search
<
Command
class
Search
<
Command
include
DisplayPods
def
self
.
banner
def
self
.
banner
%{Search pods:
%{Search pods:
$ pod search [QUERY]
$ pod search [QUERY]
...
@@ -19,6 +17,8 @@ module Pod
...
@@ -19,6 +17,8 @@ module Pod
super
super
end
end
include
DisplayPods
def
initialize
(
argv
)
def
initialize
(
argv
)
@stats
=
argv
.
option
(
'--stats'
)
@stats
=
argv
.
option
(
'--stats'
)
@full_text_search
=
argv
.
option
(
'--full'
)
@full_text_search
=
argv
.
option
(
'--full'
)
...
...
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