The GetBundle TextMate bundle

October 15th, 2007

If you haven't seen GetBundle, I recommend you give it a look. It makes it easier to browse and install the available bundles (based on what's in the MacroMates repo).

I noticed a couple of issues. If you have bundles checked out from another repo, or you have any bundles checked out with a recent version of Subversion (GetBundle includes its own svn binary), you may have issues.

Here is a modified version of the Update Installed Bundles command that (I think) plays nice in both these situations. I've posted to textmate-dev so hopefully will find out soon enough if it works as I think it does.

    APP_PATH=$(ps -xwwp $PPID -o command|grep -o '.*.app')

    SVN=${TM_SVN:-"${TM_BUNDLE_SUPPORT}/bin/svn"}

    REV=$(< "$TM_SUPPORT_PATH/version")
    SVN_OPTS="--no-auth-cache --non-interactive"

    cd ~/Library/Application\ Support/TextMate/Pristine\ Copy/Bundles
    if [[ $? == 0 ]]; then 
      for f in *.tmbundle; do
        REPO_URL=`$SVN info $f | grep '^URL: http://macromates.com/svn/Bundles/trunk/Bundles/'`
        if [ "$?" = 0 ]; then
          # macromates.com mail bundle repo
          "$SVN" up -r$REV $SVN_OPTS "$f"
        else
          # somebody else's repo, ignore revision
          "$SVN" up $SVN_OPTS "$f"
        fi 
      done \
       2> >(CocoaDialog progressbar --indeterminate --title 'Updating all your Bundles' \
                                    --text 'This could take a while...')

      osascript -e 'tell app "TextMate" to reload bundles'
      CocoaDialog bubble --title 'All Bundles Updated' --text 'You can use them now' \
                         --icon-file "${APP_PATH}/Contents/Resources/Textmate.icns"
    else
      CocoaDialog bubble --title 'No Bundles to update' --text 'Use \"Install Bundles\".' \
                         --icon-file "${APP_PATH}/Contents/Resources/Textmate.icns"
    fi

Leave a Reply