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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
41 deletions
+52
-41
list.rb
lib/cocoapods/command/list.rb
+10
-17
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
+16
-9
No files found.
lib/cocoapods/command/list.rb
View file @
b15bb507
require
'time'
module
Pod
module
Pod
class
Command
class
Command
class
List
<
Command
class
List
<
Command
...
@@ -16,22 +15,23 @@ module Pod
...
@@ -16,22 +15,23 @@ module Pod
def
self
.
options
def
self
.
options
" --update runs `pod repo update` before list
\n
"
+
" --update runs `pod repo update` before list
\n
"
+
SetPresent
.
options
+
super
Presenter
.
options
+
super
end
end
extend
Executable
extend
Executable
executable
:git
executable
:git
def
initialize
(
argv
)
def
initialize
(
argv
)
@update
=
argv
.
option
(
'--update'
)
@update
=
argv
.
option
(
'--update'
)
@new
=
argv
.
option
(
'new'
)
@new
=
argv
.
option
(
'new'
)
@presenter
=
Presenter
.
new
(
argv
)
@presenter
=
Presenter
.
new
(
argv
)
super
unless
argv
.
empty?
super
unless
argv
.
empty?
end
end
def
list_all
def
list_all
@presenter
.
present_sets
(
all
=
Source
.
all_sets
)
sets
=
Source
.
all_sets
puts
"
#{
all
.
count
}
pods were found"
puts
@presenter
.
render
(
sets
)
puts
"
#{
sets
.
count
}
pods were found"
puts
puts
end
end
...
@@ -57,21 +57,14 @@ module Pod
...
@@ -57,21 +57,14 @@ module Pod
sets
=
groups
[
d
]
sets
=
groups
[
d
]
next
unless
sets
next
unless
sets
puts
"Pods added in the last
#{
d
==
1
?
'1 day'
:
"
#{
d
}
days"
}
"
.
yellow
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
end
end
def
run
def
run
if
@update
puts
"
\n
Updating Spec Repositories
\n
"
.
yellow
if
@update
&&
config
.
verbose?
puts
"
\n
Updating Spec Repositories
\n
"
.
yellow
if
config
.
verbose?
Repo
.
new
(
ARGV
.
new
([
"update"
])).
run
if
@update
Repo
.
new
(
ARGV
.
new
([
"update"
])).
run
@new
?
list_new
:
list_all
end
if
@new
list_new
else
list_all
end
end
end
end
end
end
end
...
...
lib/cocoapods/command/presenter.rb
View file @
b15bb507
...
@@ -11,20 +11,23 @@ module Pod
...
@@ -11,20 +11,23 @@ module Pod
@stats
=
argv
.
option
(
'--stats'
)
@stats
=
argv
.
option
(
'--stats'
)
end
end
def
present_sets
(
array
)
def
render
(
array
)
puts
result
=
"
\n
"
array
.
each
{
|
set
|
present_set
(
set
)}
array
.
each
{
|
set
|
result
<<
render_set
(
set
)}
result
end
end
def
present
_set
(
set
)
def
render
_set
(
set
)
pod
=
CocoaPod
.
new
(
set
)
pod
=
CocoaPod
.
new
(
set
)
puts
"-->
#{
pod
.
name
}
(
#{
pod
.
versions
}
)"
.
green
result
=
"-->
#{
pod
.
name
}
(
#{
pod
.
versions
}
)
\n
"
.
green
puts
wrap_string
(
pod
.
summary
)
result
<<
wrap_string
(
pod
.
summary
)
puts_detail
(
'Homepage'
,
pod
.
homepage
)
result
<<
detail
(
'Homepage'
,
pod
.
homepage
)
puts_detail
(
'Source'
,
pod
.
source_url
)
result
<<
detail
(
'Source'
,
pod
.
source_url
)
puts_detail
(
'Watchers'
,
pod
.
github_watchers
)
if
@stats
result
<<
detail
(
'Platform'
,
pod
.
platform
)
if
@stats
puts_detail
(
'Forks'
,
pod
.
github_forks
)
if
@stats
result
<<
detail
(
'License'
,
pod
.
license
)
if
@stats
puts
result
<<
detail
(
'Watchers'
,
pod
.
github_watchers
)
if
@stats
result
<<
detail
(
'Forks'
,
pod
.
github_forks
)
if
@stats
result
<<
"
\n
"
end
end
private
private
...
@@ -35,12 +38,12 @@ module Pod
...
@@ -35,12 +38,12 @@ module Pod
txt
.
strip
.
gsub
(
/(.{1,
#{
col
}
})( +|$)\n?|(.{
#{
col
}
})/
,
indent
+
"
\\
1
\\
3
\n
"
)
txt
.
strip
.
gsub
(
/(.{1,
#{
col
}
})( +|$)\n?|(.{
#{
col
}
})/
,
indent
+
"
\\
1
\\
3
\n
"
)
end
end
def
puts_
detail
(
title
,
string
,
preferred_indentation
=
8
)
def
detail
(
title
,
string
,
preferred_indentation
=
8
)
# 8 is the length of Homepage
# 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
number_of_spaces
=
((
preferred_indentation
-
title
.
length
)
>
0
)
?
(
preferred_indentation
-
title
.
length
)
:
0
spaces
=
' '
*
number_of_spaces
spaces
=
' '
*
number_of_spaces
puts
" -
#{
title
}
:
#{
spaces
+
string
}
"
" -
#{
title
}
:
#{
spaces
+
string
}
\n
"
end
end
end
end
end
end
...
...
lib/cocoapods/command/presenter/cocoa_pod.rb
View file @
b15bb507
...
@@ -38,6 +38,14 @@ module Pod
...
@@ -38,6 +38,14 @@ module Pod
spec
.
source
.
reject
{
|
k
,
_
|
k
==
:commit
||
k
==
:tag
}.
values
.
first
spec
.
source
.
reject
{
|
k
,
_
|
k
==
:commit
||
k
==
:tag
}.
values
.
first
end
end
def
platform
spec
.
platform
.
to_s
end
def
license
spec
.
license
[
:type
]
if
spec
.
license
end
def
creation_date
def
creation_date
Pod
::
Specification
::
Statistics
.
instance
.
creation_date
(
@set
)
Pod
::
Specification
::
Statistics
.
instance
.
creation_date
(
@set
)
end
end
...
...
lib/cocoapods/command/search.rb
View file @
b15bb507
...
@@ -25,7 +25,7 @@ module Pod
...
@@ -25,7 +25,7 @@ module Pod
def
run
def
run
sets
=
Source
.
search_by_name
(
@query
.
strip
,
@full_text_search
)
sets
=
Source
.
search_by_name
(
@query
.
strip
,
@full_text_search
)
@presenter
.
present_sets
(
sets
)
puts
@presenter
.
render
(
sets
)
end
end
end
end
end
end
...
...
lib/cocoapods/platform.rb
View file @
b15bb507
module
Pod
module
Pod
class
Platform
class
Platform
attr_reader
:options
attr_reader
:options
def
initialize
(
symbolic_name
,
options
=
{})
def
initialize
(
symbolic_name
,
options
=
{})
@symbolic_name
=
symbolic_name
@symbolic_name
=
symbolic_name
@options
=
options
@options
=
options
end
end
def
name
def
name
@symbolic_name
@symbolic_name
end
end
def
==
(
other_platform_or_symbolic_name
)
def
==
(
other_platform_or_symbolic_name
)
if
other_platform_or_symbolic_name
.
is_a?
(
Symbol
)
if
other_platform_or_symbolic_name
.
is_a?
(
Symbol
)
@symbolic_name
==
other_platform_or_symbolic_name
@symbolic_name
==
other_platform_or_symbolic_name
...
@@ -18,25 +18,32 @@ module Pod
...
@@ -18,25 +18,32 @@ module Pod
self
==
(
other_platform_or_symbolic_name
.
name
)
self
==
(
other_platform_or_symbolic_name
.
name
)
end
end
end
end
def
to_s
def
to_s
name
.
to_s
case
@symbolic_name
when
:ios
'iOS'
when
:osx
'OS X'
else
'iOS - OS X'
end
end
end
def
to_sym
def
to_sym
name
name
end
end
def
nil?
def
nil?
name
.
nil?
name
.
nil?
end
end
def
deployment_target
def
deployment_target
if
(
opt
=
options
[
:deployment_target
])
if
(
opt
=
options
[
:deployment_target
])
Pod
::
Version
.
new
(
opt
)
Pod
::
Version
.
new
(
opt
)
end
end
end
end
def
requires_legacy_ios_archs?
def
requires_legacy_ios_archs?
return
unless
deployment_target
return
unless
deployment_target
(
name
==
:ios
)
&&
(
deployment_target
<
Pod
::
Version
.
new
(
"4.3"
))
(
name
==
:ios
)
&&
(
deployment_target
<
Pod
::
Version
.
new
(
"4.3"
))
...
...
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