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
b5dc7c66
Commit
b5dc7c66
authored
Apr 10, 2013
by
Marin Usalj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored a bit, made it more explicit
parent
a725d61a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
help.rb
lib/cocoapods/command/help.rb
+12
-7
help_spec.rb
spec/functional/command/help_spec.rb
+5
-6
No files found.
lib/cocoapods/command/help.rb
View file @
b5dc7c66
module
Pod
module
Pod
class
Command
class
Command
class
Help
<
Command
class
Help
<
Command
self
.
summary
=
'Show help for the given command'
self
.
summary
=
'Show help for the given command
.
'
self
.
arguments
=
'[COMMAND]'
self
.
arguments
=
'[COMMAND]'
def
self
.
pars
e
(
argv
)
def
initializ
e
(
argv
)
command_needs_help
=
[
argv
.
shift_argument
,
'--help'
]
@help_command
=
Pod
::
Command
.
parse
(
argv
)
unless
argv
.
empty?
argv
.
empty?
?
super
:
Pod
::
Command
.
parse
(
command_needs_help
)
super
end
end
def
run
def
run
help!
help_command
.
help!
end
private
def
help_command
@help_command
||
self
end
end
end
end
end
end
end
end
\ No newline at end of file
spec/functional/command/help_spec.rb
View file @
b5dc7c66
...
@@ -6,17 +6,17 @@ module Pod
...
@@ -6,17 +6,17 @@ module Pod
it
"invokes the right command with --help flag"
do
it
"invokes the right command with --help flag"
do
command
=
command
(
'help'
,
'push'
)
command
=
command
(
'help'
,
'push'
)
command
.
should
.
be
.
instance_of
Pod
::
Command
::
Push
command
.
s
end
(
:help_command
).
s
hould
.
be
.
instance_of
Pod
::
Command
::
Push
lambda
{
command
.
validate!
}.
should
.
raise
CLAide
::
Help
lambda
{
command
.
run
}.
should
.
raise
CLAide
::
Help
end
end
it
"raises help! if no other command is passed"
do
it
"raises help! if no other command is passed"
do
lambda
{
command
(
'help'
).
validate!
}.
should
.
raise
CLAide
::
Help
lambda
{
command
(
'help'
).
run
}.
should
.
raise
CLAide
::
Help
end
end
it
"shows the right usage"
do
it
"shows the right usage"
do
Pod
::
Command
::
Help
.
arguments
.
should
.
equal
'[COMMAND]'
Pod
::
Command
::
Help
.
arguments
.
should
.
equal
'[COMMAND]'
end
end
end
end
end
end
\ No newline at end of file
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