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