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
6ae76658
Commit
6ae76658
authored
Apr 10, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactor] moved spec_present module to presenter class
parent
31b6da64
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
31 deletions
+16
-31
command.rb
lib/cocoapods/command.rb
+1
-1
list.rb
lib/cocoapods/command/list.rb
+6
-8
presenter.rb
lib/cocoapods/command/presenter.rb
+4
-13
search.rb
lib/cocoapods/command/search.rb
+5
-9
No files found.
lib/cocoapods/command.rb
View file @
6ae76658
...
...
@@ -3,13 +3,13 @@ require 'colored'
module
Pod
class
Command
autoload
:ErrorReport
,
'cocoapods/command/error_report'
autoload
:SetPresent
,
'cocoapods/command/set_present'
autoload
:Install
,
'cocoapods/command/install'
autoload
:List
,
'cocoapods/command/list'
autoload
:Repo
,
'cocoapods/command/repo'
autoload
:Search
,
'cocoapods/command/search'
autoload
:Setup
,
'cocoapods/command/setup'
autoload
:Spec
,
'cocoapods/command/spec'
autoload
:Presenter
,
'cocoapods/command/presenter'
class
Help
<
Informative
def
initialize
(
command_class
,
argv
)
...
...
lib/cocoapods/command/list.rb
View file @
6ae76658
...
...
@@ -15,22 +15,20 @@ module Pod
end
def
self
.
options
SetPresent
.
set_present_options
+
super
SetPresent
.
options
+
super
end
include
SetPresent
extend
Executable
executable
:git
def
initialize
(
argv
)
parse_set_options
(
argv
)
@new
=
argv
.
option
(
'new'
)
@presenter
=
Presenter
.
new
(
argv
)
super
unless
argv
.
empty?
end
def
list_all
present_sets
(
all
=
Source
.
all_sets
)
@presenter
.
present_sets
(
all
=
Source
.
all_sets
)
puts
"
#{
all
.
count
}
pods were found"
puts
end
...
...
@@ -53,15 +51,15 @@ module Pod
days
.
reverse
.
each
do
|
d
|
sets
=
groups
[
d
]
next
unless
sets
puts
"Pods added in the last
#{
d
==
1
?
'1 day'
:
"
#{
d
}
days"
}
\n
"
.
yellow
present_sets
(
sets
)
puts
"Pods added in the last
#{
d
==
1
?
'1 day'
:
"
#{
d
}
days"
}
"
.
yellow
@presenter
.
present_sets
(
sets
)
end
end
def
run
if
@new
puts
"
\n
Updating Spec Repositories
\n
"
.
yellow
if
config
.
verbose?
Repo
.
new
(
ARGV
.
new
([
"update"
])).
run
#
Repo.new(ARGV.new(["update"])).run
list_new
else
list_all
...
...
lib/cocoapods/command/
set_present
.rb
→
lib/cocoapods/command/
presenter
.rb
View file @
6ae76658
...
...
@@ -2,29 +2,21 @@ require 'net/http'
module
Pod
class
Command
module
SetPresent
def
self
.
set_present_options
" --name-only Show only the names of the pods
\n
"
+
class
Presenter
def
self
.
options
" --stats Show additional stats (like GitHub watchers and forks)
\n
"
end
def
list
@list
end
def
parse_set_options
(
argv
)
def
initialize
(
argv
)
@stats
=
argv
.
option
(
'--stats'
)
@list
=
argv
.
option
(
'--name-only'
)
end
def
present_sets
(
array
)
puts
array
.
each
{
|
set
|
present_set
(
set
)}
end
def
present_set
(
set
)
if
@list
puts
set
.
name
else
puts
"-->
#{
set
.
name
}
(
#{
set
.
versions
.
reverse
.
join
(
", "
)
}
)"
.
green
puts_wrapped_text
(
set
.
summary
)
spec
=
set
.
specification
.
part_of_other_pod?
?
set
.
specification
.
part_of_specification
:
set
.
specification
...
...
@@ -37,7 +29,6 @@ module Pod
end
puts
end
end
# adapted from http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
def
puts_wrapped_text
(
txt
,
col
=
80
,
indentation
=
4
)
...
...
lib/cocoapods/command/search.rb
View file @
6ae76658
...
...
@@ -13,23 +13,19 @@ module Pod
def
self
.
options
" --full Search by name, summary, and description
\n
"
+
SetPresent
.
set_present_options
+
super
Presenter
.
options
+
super
end
include
SetPresent
def
initialize
(
argv
)
parse_set_options
(
argv
)
@full_text_search
=
argv
.
option
(
'--full'
)
unless
@query
=
argv
.
arguments
.
first
super
end
@presenter
=
Presenter
.
new
(
argv
)
@query
=
argv
.
shift_argument
super
unless
argv
.
empty?
&&
@query
end
def
run
sets
=
Source
.
search_by_name
(
@query
.
strip
,
@full_text_search
)
present_sets
(
sets
)
@presenter
.
present_sets
(
sets
)
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