Permalink
Browse files

Updated nutmbundle to detect whether TextMate version 1 or 2

TextMate 2 installs bundles differently. The nutmbundle now checks
which version of TextMate is installed and runs the appropriate
installation commands.
  • Loading branch information...
1 parent 030c15d commit ac1e2990f1c43a3f2caec1c607055606836d4934 @tjklemz tjklemz committed Feb 15, 2014
Showing with 17 additions and 5 deletions.
  1. +17 −5 tools/nutmbundle
View
22 tools/nutmbundle
@@ -3,8 +3,20 @@
# Install the Nu TextMate bundle from Jason Sallis' GitHub repository.
# Warning: This will remove any existing Nu.tmbundle.
#
-rm -rf ~/"Library/Application Support/TextMate/Bundles/Nu.tmbundle"
-mkdir -pv ~/"Library/Application Support/TextMate/Bundles/"
-cd ~/"Library/Application Support/TextMate/Bundles/"
-git clone git://github.com/jsallis/nu.tmbundle.git "Nu.tmbundle"
-osascript -e 'tell app "TextMate" to reload bundles'
+
+BUNDLES_DIR="$HOME/Library/Application Support/TextMate/Bundles"
+BUNDLE_NAME="Nu.tmbundle"
+VERSION=`osascript -e 'tell application "TextMate" to version' | cut -d. -f1`
+
+function getbundle () {
+ git clone git://github.com/jsallis/nu.tmbundle.git $BUNDLE_NAME
+}
+
+if [ $VERSION -eq 2 ]; then
+ getbundle && open $BUNDLE_NAME
+else
+ rm -rf "$BUNDLES_DIR/$BUNDLE_NAME"
+ mkdir -pv $BUNDLES_DIR
+ cd $BUNDLES_DIR
+ getbundle && osascript -e 'tell app "TextMate" to reload bundles'
+fi

0 comments on commit ac1e299

Please sign in to comment.