Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

Commit

Permalink
Merge pull request #315 from guillaume-algis/feature/whitelist-on-ins…
Browse files Browse the repository at this point in the history
…tall

Remove Alcatraz from Xcode skipped plugins list on install
  • Loading branch information
kattrali committed Nov 27, 2015
2 parents 62aaeba + 25c4b3d commit 50ebd9f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Scripts/install.sh
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)."

0 comments on commit 50ebd9f

Please sign in to comment.