This repository has been archived by the owner on Oct 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from lacostej/features/wrap_xcodebuild
Issue #168 wrap xcodebuild calls within ruby system environment
- Loading branch information
Showing
5 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash --login | ||
|
||
# Originally from, http://stackoverflow.com/questions/33041109 | ||
# Modified to work in RVM and non RVM environments | ||
# | ||
# Xcode 7 (incl. 7.0.1) seems to have a dependency on the system ruby. | ||
# xcodebuild is screwed up by using rvm to map to another non-system | ||
# ruby†. This script is a fix that allows you call xcodebuild in a | ||
# "safe" rvm environment, but will not (AFAIK) affect the "external" | ||
# rvm setting. | ||
# | ||
# The script is a drop in replacement for your xcodebuild call. | ||
# | ||
# xcodebuild arg1 ... argn | ||
# | ||
# would become | ||
# | ||
# path/to/xcbuild-safe.sh arg1 ... argn | ||
# | ||
# ----- | ||
# † Because, you know, that *never* happens when you are building | ||
# Xcode projects, say with abstruse tools like Rake or CocoaPods. | ||
|
||
which rvm > /dev/null | ||
|
||
if [[ $? -eq 0 ]]; then | ||
echo "RVM detected, forcing to use system ruby" | ||
# This allows you to use rvm in a script. Otherwise you get a BS | ||
# error along the lines of "cannot use rvm as function". Jeez. | ||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | ||
|
||
# Cause rvm to use system ruby. AFAIK, this is effective only for | ||
# the scope of this script. | ||
rvm use system | ||
|
||
# rvm doesn't unset itself properly without doing this | ||
unset RUBYLIB | ||
unset RUBYOPT | ||
unset BUNDLE_BIN_PATH | ||
unset _ORIGINAL_GEM_PATH | ||
unset BUNDLE_GEMFILE | ||
fi | ||
|
||
# to help troubleshooting | ||
# env | sort > /tmp/env.wrapper | ||
# rvm info >> /tmp/env.wrapper | ||
|
||
set -x # echoes commands | ||
xcodebuild "$@" # calls xcodebuild with all the arguments passed to this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters