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

Remove Alcatraz from Xcode skipped plugins list on install #315

Merged
merged 4 commits into from
Nov 27, 2015

Conversation

guillaumealgis
Copy link
Member

Related to #281, #282, #303 and probably a whole bunch of other issues.

This is very similar #282, but just removes Alcatraz from the skipped plugins list instead of un-blocking everything.
I also took the chance to add "strict flags" to the sh script, and echoing the current selected version of Xcode after install.

@guillaumealgis guillaumealgis force-pushed the feature/whitelist-on-install branch 2 times, most recently from 6db011b to ecf1d67 Compare July 11, 2015 16:05
@guillaumealgis guillaumealgis mentioned this pull request Aug 7, 2015
@guillaumealgis
Copy link
Member Author

Rebased this PR on top of master. Could you take a look? Thanks!

XCODE_VERSION="$(xcrun xcodebuild -version | head -n1 | awk '{ print $2 }')"
PLIST_PLUGINS_KEY="DVTPlugInManagerNonApplePlugIns-Xcode-${XCODE_VERSION}"
BUNDLE_ID="com.mneorr.Alcatraz"
TMP_FILE="/tmp/${BUNDLE_ID}.xcode-defaults"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should add $(random) somewhere in here to avoid collisions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kattrali not sure random is installed on OSX by default.

mktemp might work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right, echo $RANDOM

@kattrali
Copy link
Contributor

LGTM, added inline comments.

/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" "$(< $TMP_FILE)"
echo 'Alcatraz was removed from Xcode'\''s skipped plugins list. Next time you start Xcode select "Load Bundle" when prompted.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, it'd be appreciated if length could be <80

@guillaumealgis
Copy link
Member Author

I made the requested changes:

  • Used mktemp instead of $RANDOM as it made the intent clearer;
  • Replaced "$(< $TMP_FILE)" by "$(cat "$TMP_FILE")" as the $(< ) construct is apparently not POSIX compliant;
  • Made most of the script fit on 80 cols. The remaining lines are harder to compress, and would harm readability imo.
  • Replaced tabs with spaces.

@kattrali
Copy link
Contributor

👍 Awesome! Thanks @guillaume-algis, looks good.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants