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
fa5d18a2
Commit
fa5d18a2
authored
Apr 07, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dynamically justify options in help output.
parent
fba48103
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
17 deletions
+103
-17
command.rb
lib/cocoapods/command.rb
+16
-5
install.rb
lib/cocoapods/command/install.rb
+7
-6
list.rb
lib/cocoapods/command/list.rb
+1
-2
search.rb
lib/cocoapods/command/search.rb
+1
-2
set_present.rb
lib/cocoapods/command/set_present.rb
+77
-0
setup.rb
lib/cocoapods/command/setup.rb
+1
-2
No files found.
lib/cocoapods/command.rb
View file @
fa5d18a2
...
@@ -23,9 +23,18 @@ module Pod
...
@@ -23,9 +23,18 @@ module Pod
'Options'
,
'Options'
,
'-------'
,
'-------'
,
''
,
''
,
@command_class
.
options
options
].
join
(
"
\n
"
)
].
join
(
"
\n
"
)
end
end
private
def
options
options
=
@command_class
.
options
keys
=
options
.
map
(
&
:first
)
key_size
=
keys
.
inject
(
0
)
{
|
size
,
key
|
key
.
size
>
size
?
key
.
size
:
size
}
options
.
map
{
|
key
,
desc
|
"
#{
key
.
ljust
(
key_size
)
}
#{
desc
}
"
}.
join
(
"
\n
"
)
end
end
end
class
ARGV
<
Array
class
ARGV
<
Array
...
@@ -47,10 +56,12 @@ module Pod
...
@@ -47,10 +56,12 @@ module Pod
end
end
def
self
.
options
def
self
.
options
" --help Show help information
\n
"
\
[
" --silent Print nothing
\n
"
\
[
'--help'
,
'Show help information'
],
" --verbose Print more information while working
\n
"
\
[
'--silent'
,
'Print nothing'
],
" --version Prints the version of CocoaPods"
[
'--verbose'
,
'Print more information while working'
],
[
'--version'
,
'Prints the version of CocoaPods'
],
]
end
end
def
self
.
run
(
*
argv
)
def
self
.
run
(
*
argv
)
...
...
lib/cocoapods/command/install.rb
View file @
fa5d18a2
...
@@ -24,12 +24,13 @@ module Pod
...
@@ -24,12 +24,13 @@ module Pod
end
end
def
self
.
options
def
self
.
options
" --no-clean Leave SCM dirs like `.git' and `.svn' in tact after downloading
\n
"
+
[
" --no-doc Skip documentation generation with appledoc
\n
"
+
[
"--no-clean"
,
"Leave SCM dirs like `.git' and `.svn' in tact after downloading"
],
" --force-doc Force the generation of documentation
\n
"
+
[
"--no-doc"
,
"Skip documentation generation with appledoc"
],
" --no-integrate Skip integration of the Pods libraries in the Xcode project(s)
\n
"
+
[
"--force-doc"
,
"Force the generation of documentation"
],
" --no-update Skip running `pod repo update` before install
\n
"
+
[
"--no-integrate"
,
"Skip integration of the Pods libraries in the Xcode project(s)"
],
super
[
"--no-update"
,
"Skip running `pod repo update` before install"
],
].
concat
(
super
)
end
end
def
initialize
(
argv
)
def
initialize
(
argv
)
...
...
lib/cocoapods/command/list.rb
View file @
fa5d18a2
...
@@ -14,8 +14,7 @@ module Pod
...
@@ -14,8 +14,7 @@ module Pod
end
end
def
self
.
options
def
self
.
options
" --update runs `pod repo update` before list
\n
"
+
[[
"--update"
,
"Run `pod repo update` before listing"
]].
concat
(
Presenter
.
options
).
concat
(
super
)
Presenter
.
options
+
super
end
end
extend
Executable
extend
Executable
...
...
lib/cocoapods/command/search.rb
View file @
fa5d18a2
...
@@ -12,8 +12,7 @@ module Pod
...
@@ -12,8 +12,7 @@ module Pod
end
end
def
self
.
options
def
self
.
options
" --full Search by name, summary, and description
\n
"
+
[[
"--full"
,
"Search by name, summary, and description"
]].
concat
(
Presenter
.
options
).
concat
(
super
)
Presenter
.
options
+
super
end
end
def
initialize
(
argv
)
def
initialize
(
argv
)
...
...
lib/cocoapods/command/set_present.rb
0 → 100644
View file @
fa5d18a2
require
'net/http'
module
Pod
class
Command
module
SetPresent
def
self
.
options
[
[
"--name-only"
,
"Show only the names of the pods"
],
[
"--stats"
,
"Show additional stats (like GitHub watchers and forks)"
],
]
end
def
list
@list
end
def
parse_set_options
(
argv
)
@stats
=
argv
.
option
(
'--stats'
)
@list
=
argv
.
option
(
'--name-only'
)
end
def
present_sets
(
array
)
array
.
each
do
|
set
|
present_set
(
set
)
end
end
def
present_set
(
set
)
if
@list
puts
set
.
name
else
puts
"-->
#{
set
.
name
}
(
#{
set
.
versions
.
reverse
.
join
(
", "
)
}
)"
.
green
puts_wrapped_text
(
set
.
specification
.
summary
)
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
(
'Source'
,
source
)
if
@stats
stats
=
stats
(
source
)
puts_detail
(
'Watchers'
,
stats
[
:watchers
])
puts_detail
(
'Forks'
,
stats
[
:forks
])
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
)
indent
=
' '
*
indentation
puts
txt
.
strip
.
gsub
(
/(.{1,
#{
col
}
})( +|$)\n?|(.{
#{
col
}
})/
,
indent
+
"
\\
1
\\
3
\n
"
)
end
def
puts_detail
(
title
,
string
)
return
if
!
string
# 8 is the length of homepage
number_of_spaces
=
((
8
-
title
.
length
)
>
0
)
?
(
8
-
title
.
length
)
:
0
spaces
=
' '
*
number_of_spaces
puts
" -
#{
title
}
:
#{
spaces
+
string
}
"
end
def
stats
(
url
)
original_url
,
username
,
reponame
=
*
(
url
.
match
(
/[:\/]([\w\-]+)\/([\w\-]+)\.git/
).
to_a
)
result
=
{}
if
original_url
gh_response
=
Net
::
HTTP
.
get
(
'github.com'
,
"/api/v2/json/repos/show/
#{
username
}
/
#{
reponame
}
"
)
result
[
:watchers
]
=
gh_response
.
match
(
/\"watchers\"\W*:\W*([0-9]+)/
).
to_a
[
1
]
result
[
:forks
]
=
gh_response
.
match
(
/\"forks\"\W*:\W*([0-9]+)/
).
to_a
[
1
]
end
result
end
end
end
end
lib/cocoapods/command/setup.rb
View file @
fa5d18a2
...
@@ -15,8 +15,7 @@ module Pod
...
@@ -15,8 +15,7 @@ module Pod
end
end
def
self
.
options
def
self
.
options
" --push Use this option to enable push access once granted
\n
"
+
[[
"--push"
,
"Use this option to enable push access once granted"
]].
concat
(
super
)
super
end
end
extend
Executable
extend
Executable
...
...
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