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
ca895cda
Commit
ca895cda
authored
Mar 07, 2016
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Executable] Handle when $PATH is not set
parent
1160056e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
CHANGELOG.md
CHANGELOG.md
+3
-0
executable.rb
lib/cocoapods/executable.rb
+20
-5
No files found.
CHANGELOG.md
View file @
ca895cda
...
@@ -32,6 +32,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -32,6 +32,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
`Copy Pods Resources`
build phase.
`Copy Pods Resources`
build phase.
[
seaders
](
https://github.com/seaders
)
[
#4940
]
(https://github.com/CocoaPods/CocoaPods/issues/4940)
[
seaders
](
https://github.com/seaders
)
[
#4940
]
(https://github.com/CocoaPods/CocoaPods/issues/4940)
*
Handle when
`$PATH`
isn't set.
[
Samuel Giddins
](
https://github.com/segiddins
)
## 1.0.0.beta.4 (2016-02-24)
## 1.0.0.beta.4 (2016-02-24)
...
...
lib/cocoapods/executable.rb
View file @
ca895cda
...
@@ -46,8 +46,7 @@ module Pod
...
@@ -46,8 +46,7 @@ module Pod
# @return [String] the output of the command (STDOUT and STDERR).
# @return [String] the output of the command (STDOUT and STDERR).
#
#
def
self
.
execute_command
(
executable
,
command
,
raise_on_failure
=
true
)
def
self
.
execute_command
(
executable
,
command
,
raise_on_failure
=
true
)
bin
=
which
(
executable
)
bin
=
which!
(
executable
)
raise
Informative
,
"Unable to locate the executable `
#{
executable
}
`"
unless
bin
command
=
command
.
map
(
&
:to_s
)
command
=
command
.
map
(
&
:to_s
)
full_command
=
"
#{
bin
}
#{
command
.
join
(
' '
)
}
"
full_command
=
"
#{
bin
}
#{
command
.
join
(
' '
)
}
"
...
@@ -87,7 +86,10 @@ module Pod
...
@@ -87,7 +86,10 @@ module Pod
#
#
def
self
.
which
(
program
)
def
self
.
which
(
program
)
program
=
program
.
to_s
program
=
program
.
to_s
ENV
[
'PATH'
].
split
(
File
::
PATH_SEPARATOR
).
each
do
|
path
|
paths
=
ENV
.
fetch
(
'PATH'
)
{
''
}.
split
(
File
::
PATH_SEPARATOR
)
paths
.
unshift
(
'./'
)
paths
.
uniq!
paths
.
each
do
|
path
|
bin
=
File
.
expand_path
(
program
,
path
)
bin
=
File
.
expand_path
(
program
,
path
)
if
File
.
file?
(
bin
)
&&
File
.
executable?
(
bin
)
if
File
.
file?
(
bin
)
&&
File
.
executable?
(
bin
)
return
bin
return
bin
...
@@ -96,6 +98,20 @@ module Pod
...
@@ -96,6 +98,20 @@ module Pod
nil
nil
end
end
# Returns the absolute path to the binary with the given name on the current
# `PATH`, or raises if none is found.
#
# @param [String] program
# The name of the program being searched for.
#
# @return [String] The absolute path to the given program.
#
def
self
.
which!
(
program
)
which
(
program
).
tap
do
|
bin
|
raise
Informative
,
"Unable to locate the executable `
#{
executable
}
`"
unless
bin
end
end
# Runs the given command, capturing the desired output.
# Runs the given command, capturing the desired output.
#
#
# @param [String] bin
# @param [String] bin
...
@@ -114,8 +130,7 @@ module Pod
...
@@ -114,8 +130,7 @@ module Pod
# running the command.
# running the command.
#
#
def
self
.
capture_command
(
executable
,
command
,
capture: :merge
)
def
self
.
capture_command
(
executable
,
command
,
capture: :merge
)
bin
=
which
(
executable
)
bin
=
which!
(
executable
)
raise
Informative
,
"Unable to locate the executable `
#{
executable
}
`"
unless
bin
require
'open3'
require
'open3'
command
=
command
.
map
(
&
:to_s
)
command
=
command
.
map
(
&
:to_s
)
...
...
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