This repository has been archived by the owner on Sep 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 #315 from guillaume-algis/feature/whitelist-on-ins…
…tall Remove Alcatraz from Xcode skipped plugins list on install
- Loading branch information
Showing
1 changed file
with
22 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
#!/bin/sh | ||
|
||
set -euo pipefail | ||
|
||
DOWNLOAD_URI=https://github.com/alcatraz/Alcatraz/releases/download/1.1.13/Alcatraz.tar.gz | ||
PLUGINS_DIR="${HOME}/Library/Application Support/Developer/Shared/Xcode/Plug-ins" | ||
XCODE_VERSION="$(xcrun xcodebuild -version | head -n1 | awk '{ print $2 }')" | ||
PLIST_PLUGINS_KEY="DVTPlugInManagerNonApplePlugIns-Xcode-${XCODE_VERSION}" | ||
BUNDLE_ID="com.mneorr.Alcatraz" | ||
TMP_FILE="$(mktemp -t ${BUNDLE_ID})" | ||
|
||
# Remove Alcatraz from Xcode's skipped plugins list if needed | ||
defaults read -app Xcode "$PLIST_PLUGINS_KEY" > "$TMP_FILE" | ||
/usr/libexec/PlistBuddy -c "delete skipped:$BUNDLE_ID" "$TMP_FILE" > /dev/null 2>&1 && { | ||
pgrep Xcode > /dev/null && { | ||
echo 'An instance of Xcode is currently running.' \ | ||
'Please close Xcode before installing Alcatraz.' | ||
exit 1 | ||
} | ||
defaults write -app Xcode "$PLIST_PLUGINS_KEY" "$(cat "$TMP_FILE")" | ||
echo 'Alcatraz was removed from Xcode'\''s skipped plugins list.' \ | ||
'Next time you start Xcode select "Load Bundle" when prompted.' | ||
} | ||
rm "$TMP_FILE" | ||
|
||
mkdir -p "${PLUGINS_DIR}" | ||
curl -L $DOWNLOAD_URI | tar xvz -C "${PLUGINS_DIR}" | ||
|
||
# the 1 is not a typo! | ||
echo "Alcatraz successfully installed!!1!🍻 Please restart your Xcode." | ||
echo 'Alcatraz successfully installed!!1!🍻 ' \ | ||
"Please restart your Xcode ($XCODE_VERSION)." | ||
|