5.11.2012

Portable TextWrangler (kinda)

Terminal is great, but sometimes I'm too lazy to use vi and editing lots of shell scripts is waaaayyyyy more efficient with TextWrangler. I use this small dropbox hack so I can sync my stationery and settings across multiple macs.
#!/bin/bash
#+ Portable TextWrangler

#* Formatted date & time string.
FORMATTED_DATE=`/bin/date "+%Y-%m-%d%H%M%S"`

#+ Remove it from /Applications (optional, just so you can replace it with a ln to your dropbox)
sudo /bin/mv -f /Applications/TextWrangler.app ~/.Trash/
#* Add a link in /Applications to your DropBox copy
sudo /bin/ln -Fs ~/DropBox/TextWrangler.app /Applications/TextWrangler.app

#* Archive existing folder
/bin/mv -f ~/Library/Application\ Support/TextWrangler{,.$FORMATTED_DATE}
#+ Create cloud app support folder
/bin/mkdir -p ~/DropBox/TextWrangler
#+ Link cloud app support folder to your local workstation (this contains your stationery etc etc)
sudo /bin/ln -Fs ~/DropBox/TextWrangler ~/Library/Application\ Support/TextWrangler

#+ Create cloud app support folder for your preferences
/bin/mkdir -p ~/DropBox/TextWrangler/Preferences
#* Placeholder so your prefs go to the cloud
/usr/bin/defaults write ~/DropBox/TextWrangler/Preferences/com.barebones.textwrangler Placeholder true
#* Link cloud pref to your local workstation
sudo /bin/ln -Fs ~/DropBox/TextWrangler/Preferences/com.barebones.textwrangler.plist ~/Library/Preferences/com.barebones.textwrangler.plist

exit 0