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
f377c313
Commit
f377c313
authored
May 25, 2015
by
Florian R. Hanke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Executable] Extract output handling to make it testable.
parent
179600e2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
executable.rb
lib/cocoapods/executable.rb
+27
-15
No files found.
lib/cocoapods/executable.rb
View file @
f377c313
...
...
@@ -49,21 +49,9 @@ module Pod
bin
=
`which
#{
executable
}
`
.
strip
raise
Informative
,
"Unable to locate the executable `
#{
executable
}
`"
if
bin
.
empty?
require
'shellwords'
command
=
command
.
map
(
&
:to_s
)
full_command
=
"
#{
bin
}
#{
command
.
join
(
' '
)
}
"
UI
.
message
(
"$
#{
full_command
}
"
)
if
Config
.
instance
.
verbose?
output
=
StringIO
.
new
indented
=
Indenter
.
new
(
output
)
status
=
with_verbose
do
spawn
(
bin
,
command
)
do
|
line
|
indented
<<
line
end
end
with_output
(
bin
,
command
.
map
(
&
:to_s
),
output
)
do
|
full_command
,
status
|
unless
status
.
success?
if
raise_on_failure
raise
Informative
,
"
#{
full_command
}
\n\n
#{
output
.
string
}
"
...
...
@@ -71,12 +59,32 @@ module Pod
UI
.
message
(
"[!] Failed:
#{
full_command
}
"
.
red
)
end
end
end
output
.
string
end
private
#
#
def
self
.
with_output
bin
,
command
,
output
full_command
=
"
#{
bin
}
#{
command
.
join
(
' '
)
}
"
UI
.
message
(
"$
#{
full_command
}
"
)
if
Config
.
instance
.
verbose?
indented
=
Indenter
.
new
(
output
)
status
=
with_verbose
do
spawn
(
bin
,
command
)
do
|
line
|
indented
.
write
line
end
end
yield
full_command
,
status
if
block_given?
status
end
# Spawn a subprocess.
#
# @param bin [String] Name of the binary to use.
...
...
@@ -150,8 +158,12 @@ module Pod
#
# @return [void]
#
def
<<
(
value
)
@io
<<
"
#{
indent
}#{
value
}
"
def
write
(
value
)
@io
.
write
"
#{
indent
}#{
value
}
"
end
def
flush
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