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
b15bb507
Commit
b15bb507
authored
Apr 11, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[pod-list] Presenter now just renders and doesn't puts text directly + related minor changes
parent
081643b0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
31 deletions
+42
-31
list.rb
lib/cocoapods/command/list.rb
+8
-15
presenter.rb
lib/cocoapods/command/presenter.rb
+17
-14
cocoa_pod.rb
lib/cocoapods/command/presenter/cocoa_pod.rb
+8
-0
search.rb
lib/cocoapods/command/search.rb
+1
-1
platform.rb
lib/cocoapods/platform.rb
+8
-1
No files found.
lib/cocoapods/command/list.rb
View file @
b15bb507
require
'time'
module
Pod
class
Command
class
List
<
Command
...
...
@@ -16,7 +15,7 @@ module Pod
def
self
.
options
" --update runs `pod repo update` before list
\n
"
+
SetPresent
.
options
+
super
Presenter
.
options
+
super
end
extend
Executable
...
...
@@ -30,8 +29,9 @@ module Pod
end
def
list_all
@presenter
.
present_sets
(
all
=
Source
.
all_sets
)
puts
"
#{
all
.
count
}
pods were found"
sets
=
Source
.
all_sets
puts
@presenter
.
render
(
sets
)
puts
"
#{
sets
.
count
}
pods were found"
puts
end
...
...
@@ -57,21 +57,14 @@ module Pod
sets
=
groups
[
d
]
next
unless
sets
puts
"Pods added in the last
#{
d
==
1
?
'1 day'
:
"
#{
d
}
days"
}
"
.
yellow
@presenter
.
present_sets
(
sets
.
sort_by
{
|
set
|
creation_dates
[
set
.
name
]})
puts
@presenter
.
render
(
sets
.
sort_by
{
|
set
|
creation_dates
[
set
.
name
]})
end
end
def
run
if
@update
puts
"
\n
Updating Spec Repositories
\n
"
.
yellow
if
config
.
verbose?
Repo
.
new
(
ARGV
.
new
([
"update"
])).
run
end
if
@new
list_new
else
list_all
end
puts
"
\n
Updating Spec Repositories
\n
"
.
yellow
if
@update
&&
config
.
verbose?
Repo
.
new
(
ARGV
.
new
([
"update"
])).
run
if
@update
@new
?
list_new
:
list_all
end
end
end
...
...
lib/cocoapods/command/presenter.rb
View file @
b15bb507
...
...
@@ -11,20 +11,23 @@ module Pod
@stats
=
argv
.
option
(
'--stats'
)
end
def
present_sets
(
array
)
puts
array
.
each
{
|
set
|
present_set
(
set
)}
def
render
(
array
)
result
=
"
\n
"
array
.
each
{
|
set
|
result
<<
render_set
(
set
)}
result
end
def
present
_set
(
set
)
def
render
_set
(
set
)
pod
=
CocoaPod
.
new
(
set
)
puts
"-->
#{
pod
.
name
}
(
#{
pod
.
versions
}
)"
.
green
puts
wrap_string
(
pod
.
summary
)
puts_detail
(
'Homepage'
,
pod
.
homepage
)
puts_detail
(
'Source'
,
pod
.
source_url
)
puts_detail
(
'Watchers'
,
pod
.
github_watchers
)
if
@stats
puts_detail
(
'Forks'
,
pod
.
github_forks
)
if
@stats
puts
result
=
"-->
#{
pod
.
name
}
(
#{
pod
.
versions
}
)
\n
"
.
green
result
<<
wrap_string
(
pod
.
summary
)
result
<<
detail
(
'Homepage'
,
pod
.
homepage
)
result
<<
detail
(
'Source'
,
pod
.
source_url
)
result
<<
detail
(
'Platform'
,
pod
.
platform
)
if
@stats
result
<<
detail
(
'License'
,
pod
.
license
)
if
@stats
result
<<
detail
(
'Watchers'
,
pod
.
github_watchers
)
if
@stats
result
<<
detail
(
'Forks'
,
pod
.
github_forks
)
if
@stats
result
<<
"
\n
"
end
private
...
...
@@ -35,12 +38,12 @@ module Pod
txt
.
strip
.
gsub
(
/(.{1,
#{
col
}
})( +|$)\n?|(.{
#{
col
}
})/
,
indent
+
"
\\
1
\\
3
\n
"
)
end
def
puts_
detail
(
title
,
string
,
preferred_indentation
=
8
)
def
detail
(
title
,
string
,
preferred_indentation
=
8
)
# 8 is the length of Homepage
return
if
!
string
return
''
if
!
string
number_of_spaces
=
((
preferred_indentation
-
title
.
length
)
>
0
)
?
(
preferred_indentation
-
title
.
length
)
:
0
spaces
=
' '
*
number_of_spaces
puts
" -
#{
title
}
:
#{
spaces
+
string
}
"
" -
#{
title
}
:
#{
spaces
+
string
}
\n
"
end
end
end
...
...
lib/cocoapods/command/presenter/cocoa_pod.rb
View file @
b15bb507
...
...
@@ -38,6 +38,14 @@ module Pod
spec
.
source
.
reject
{
|
k
,
_
|
k
==
:commit
||
k
==
:tag
}.
values
.
first
end
def
platform
spec
.
platform
.
to_s
end
def
license
spec
.
license
[
:type
]
if
spec
.
license
end
def
creation_date
Pod
::
Specification
::
Statistics
.
instance
.
creation_date
(
@set
)
end
...
...
lib/cocoapods/command/search.rb
View file @
b15bb507
...
...
@@ -25,7 +25,7 @@ module Pod
def
run
sets
=
Source
.
search_by_name
(
@query
.
strip
,
@full_text_search
)
@presenter
.
present_sets
(
sets
)
puts
@presenter
.
render
(
sets
)
end
end
end
...
...
lib/cocoapods/platform.rb
View file @
b15bb507
...
...
@@ -20,7 +20,14 @@ module Pod
end
def
to_s
name
.
to_s
case
@symbolic_name
when
:ios
'iOS'
when
:osx
'OS X'
else
'iOS - OS X'
end
end
def
to_sym
...
...
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