Skip to content

Instantly share code, notes, and snippets.

@DaveEveritt
Created May 31, 2011 13:16

Revisions

  1. DaveEveritt created this gist May 31, 2011.
    43 changes: 43 additions & 0 deletions tm_bundle.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    #!/bin/sh

    ############################################################################
    # Run from your 'Home' folder.
    # Replace 'Bundle Name' with exact name (include spaces but not ".tmbundle")
    # ./tm_bundle.sh Bundle Name
    #
    # This script is adapted from the scripts in this list of bundles:
    # http://netcetera.org/cgi-bin/tmbundles.cgi
    # the 'official' bundle list with extensions is at:
    # http://svn.textmate.org/trunk/Bundles/
    #
    # Dave Everitt 2010 (deveritt[at]innotts.co.uk)
    # TO DO: add path to 'Bundles' as variable
    ############################################################################


    # exit if errors:
    set -e

    LC_CTYPE=en_US.UTF-8
    SVN=`which svn`
    # get the bundle name (including spaces if any) with $*
    # if a bundle name was not not given (! -n), quit
    test ! -n "$*" && { echo No bundle name given - quitting.; exit 1; }

    echo Changing to your Bundles directory...
    # make the user's Bundles folder *only* if it doesn't exist (with -p)
    mkdir -p "./Library/Application Support/TextMate/Bundles"
    cd "./Library/Application Support/TextMate/Bundles"

    # if bundle exists, update (overwrite) it, else intall into correct folder
    if [ -d "./Library/Application Support/TextMate/Bundles/$*.tmbundle" ]
    then
    echo $* bundle already exists - updating...
    $SVN up "$*.tmbundle"
    else
    echo Checking out bundle: $* ...
    $SVN --username anon --password anon co "http://svn.textmate.org/trunk/Bundles/$*.tmbundle/"
    fi

    echo Reloading bundles in TextMate...
    osascript -e 'tell app "TextMate" to reload bundles'