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
e46364e6
Commit
e46364e6
authored
Apr 10, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[pod-list] Introduced pod list new
parent
8fb0665b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
53 deletions
+54
-53
list.rb
lib/cocoapods/command/list.rb
+33
-48
set_present.rb
lib/cocoapods/command/set_present.rb
+2
-5
source.rb
lib/cocoapods/source.rb
+8
-0
specification.rb
lib/cocoapods/specification.rb
+5
-0
set.rb
lib/cocoapods/specification/set.rb
+6
-0
No files found.
lib/cocoapods/command/list.rb
View file @
e46364e6
require
'time'
module
Pod
module
Pod
class
Command
class
Command
class
List
<
Command
class
List
<
Command
def
self
.
banner
def
self
.
banner
%{List all pods:
%{List all pods:
$ pod list
$ pod list
Lists all available pods.
Lists all available pods.
$ pod list
[DAYS]
$ pod list
new
Lists the pods introduced in the master repo
since the given number of days
.}
Lists the pods introduced in the master repo
sitory since the last check
.}
end
end
def
self
.
options
def
self
.
options
...
@@ -24,75 +25,59 @@ module Pod
...
@@ -24,75 +25,59 @@ module Pod
def
initialize
(
argv
)
def
initialize
(
argv
)
parse_set_options
(
argv
)
parse_set_options
(
argv
)
@days
=
argv
.
arguments
.
first
@new
=
argv
.
option
(
'new'
)
unless
@days
==
nil
||
@days
=~
/^[0-9]+$/
super
unless
argv
.
empty?
super
end
end
end
def
dir
def
dir
config
.
repos_dir
+
'master'
config
.
repos_dir
+
'master'
end
end
def
dir_list_from_commit
(
commit
)
def
last_check_file
Dir
.
chdir
(
dir
)
{
git
(
"ls-tree --name-only -r
#{
commit
}
"
)
}
config
.
repos_dir
+
'list_new.txt'
end
end
def
commit_from_days_ago
(
days
)
def
update_last_check_time
(
time
)
Dir
.
chdir
(
dir
)
{
git
(
"rev-list -n1 --before=
\"
#{
days
}
day ago
\"
--first-parent master"
)
}
File
.
open
(
last_check_file
,
'w'
)
{
|
f
|
f
.
write
(
time
)
}
end
end
def
spec_names_from_commit
(
commit
)
def
last_check_time
dir_list
=
dir_list_from_commit
(
commit
)
string
=
File
.
open
(
last_check_file
,
"rb"
).
read
Time
.
parse
(
string
)
# Keep only subdirectories
rescue
dir_list
.
gsub!
(
/^[^\/]*$/
,
''
)
Time
.
now
-
60
*
60
*
24
*
15
# Keep only subdirectories name
dir_list
.
gsub!
(
/(.*)\/[0-9].*/
,
'\1'
)
result
=
dir_list
.
split
(
"
\n
"
).
uniq
result
.
delete
(
''
)
result
end
end
def
new_specs_set
(
commit
)
def
new_specs_since
(
time
)
#TODO: find the changes for all repos
all
=
Source
.
all_sets
new_specs
=
spec_names_from_commit
(
'HEAD'
)
-
spec_names_from_commit
(
commit
)
all
.
reject!
{
|
set
|
(
set
.
creation_date
-
time
).
to_i
<=
0
}
sets
=
all_specs_set
.
select
{
|
set
|
new_specs
.
include?
(
set
.
name
)
}
all
.
sort_by
{
|
set
|
set
.
creation_date
}
end
def
all_specs_set
result
=
[]
Source
.
all
.
each
do
|
source
|
source
.
pod_sets
.
each
do
|
set
|
result
<<
set
end
end
result
end
end
def
list_new
def
list_new
sets
=
new_specs_set
(
commit_from_days_ago
(
@days
))
time
=
last_check_time
present_sets
(
sets
)
time_string
=
time
.
strftime
(
"%A %m %B %Y (%H:%M)"
)
if
!
list
sets
=
new_specs_since
(
time
)
if
sets
.
count
!=
0
if
sets
.
empty?
puts
"
#{
sets
.
count
}
new pods were added in the last
#{
@days
}
days"
puts
"
\n
No new pods were added since
#{
time
.
localtime
}
"
unless
list
puts
else
else
puts
"No new pods were added in the last
#{
@days
}
days"
present_sets
(
sets
)
puts
update_last_check_time
(
sets
.
last
.
creation_date
)
end
puts
"
#{
sets
.
count
}
new pods were added since
#{
time_string
}
"
unless
list
end
end
puts
end
end
def
list_all
def
list_all
present_sets
(
all
_specs_set
)
present_sets
(
all
=
Source
.
all_sets
)
puts
"
#{
all
_specs_set
.
count
}
pods were found"
puts
"
#{
all
.
count
}
pods were found"
puts
puts
end
end
def
run
def
run
if
@days
if
@new
puts
"
\n
Updating Spec Repositories
\n
"
.
yellow
if
config
.
verbose?
#Repo.new(ARGV.new(["update"])).run
list_new
list_new
else
else
list_all
list_all
...
...
lib/cocoapods/command/set_present.rb
View file @
e46364e6
...
@@ -29,15 +29,12 @@ module Pod
...
@@ -29,15 +29,12 @@ module Pod
else
else
puts
"-->
#{
set
.
name
}
(
#{
set
.
versions
.
reverse
.
join
(
", "
)
}
)"
.
green
puts
"-->
#{
set
.
name
}
(
#{
set
.
versions
.
reverse
.
join
(
", "
)
}
)"
.
green
puts_wrapped_text
(
set
.
specification
.
summary
)
puts_wrapped_text
(
set
.
specification
.
summary
)
spec
=
set
.
specification
.
part_of_other_pod?
?
set
.
specification
.
part_of_specification
:
set
.
specification
spec
=
set
.
specification
.
part_of_other_pod?
?
set
.
specification
.
part_of_specification
:
set
.
specification
source
=
spec
.
source
.
reject
{
|
k
,
_
|
k
==
:commit
||
k
==
:tag
}.
values
.
first
puts_detail
(
'Homepage'
,
spec
.
homepage
)
puts_detail
(
'Homepage'
,
spec
.
homepage
)
puts_detail
(
'Source'
,
s
ource
)
puts_detail
(
'Source'
,
s
pec
.
source_url
)
if
@stats
if
@stats
stats
=
stats
(
s
ource
)
stats
=
stats
(
s
pec
.
source_url
)
puts_detail
(
'Watchers'
,
stats
[
:watchers
])
puts_detail
(
'Watchers'
,
stats
[
:watchers
])
puts_detail
(
'Forks'
,
stats
[
:forks
])
puts_detail
(
'Forks'
,
stats
[
:forks
])
end
end
...
...
lib/cocoapods/source.rb
View file @
e46364e6
...
@@ -12,6 +12,10 @@ module Pod
...
@@ -12,6 +12,10 @@ module Pod
end
end
end
end
def
all_sets
all
.
map!
{
|
source
|
source
.
pod_sets
}.
flatten
end
def
search
(
dependency
)
def
search
(
dependency
)
all
.
map
{
|
s
|
s
.
search
(
dependency
)
}.
compact
.
first
||
all
.
map
{
|
s
|
s
.
search
(
dependency
)
}.
compact
.
first
||
raise
(
Informative
,
"[!] Unable to find a pod named `
#{
dependency
.
name
}
'"
.
red
)
raise
(
Informative
,
"[!] Unable to find a pod named `
#{
dependency
.
name
}
'"
.
red
)
...
@@ -32,6 +36,10 @@ module Pod
...
@@ -32,6 +36,10 @@ module Pod
Aggregate
.
new
.
all
Aggregate
.
new
.
all
end
end
def
self
.
all_sets
Aggregate
.
new
.
all_sets
end
def
self
.
search
(
dependency
)
def
self
.
search
(
dependency
)
Aggregate
.
new
.
search
(
dependency
)
Aggregate
.
new
.
search
(
dependency
)
end
end
...
...
lib/cocoapods/specification.rb
View file @
e46364e6
...
@@ -126,10 +126,15 @@ module Pod
...
@@ -126,10 +126,15 @@ module Pod
def
header_dir
=
(
dir
)
def
header_dir
=
(
dir
)
@header_dir
=
Pathname
.
new
(
dir
)
@header_dir
=
Pathname
.
new
(
dir
)
end
end
def
header_dir
def
header_dir
@header_dir
||
pod_destroot_name
@header_dir
||
pod_destroot_name
end
end
def
source_url
source
.
reject
{
|
k
,
_
|
k
==
:commit
||
k
==
:tag
}.
values
.
first
end
attr_writer
:compiler_flags
attr_writer
:compiler_flags
def
compiler_flags
def
compiler_flags
flags
=
"
#{
@compiler_flags
}
"
flags
=
"
#{
@compiler_flags
}
"
...
...
lib/cocoapods/specification/set.rb
View file @
e46364e6
...
@@ -67,6 +67,12 @@ module Pod
...
@@ -67,6 +67,12 @@ module Pod
end
.
compact
.
sort
.
reverse
end
.
compact
.
sort
.
reverse
end
end
def
creation_date
Dir
.
chdir
(
@pod_dir
.
dirname
)
do
@creation_date
||=
Time
.
at
(
`git log --format=%ct ./
#{
name
}
| tail -1`
.
to_i
)
end
end
class
External
<
Set
class
External
<
Set
def
initialize
(
specification
)
def
initialize
(
specification
)
@specification
=
specification
@specification
=
specification
...
...
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