I’ve been really getting into developing my KickTweet project and set up a Twitter account for it at http://twitter.com/KickTweet. I wanted to feed in my subversion commits so I did some searching.
What I found was twitvn a monstrous (50-ish ‘real lines) Python script that sends commits to Twitter. I find that ridiculous. So here is my version, it drops right into the post-commit script and could be reduced to 2-3 active lines.
1 2 3 4 5 6 | #!/bin/bash REPOS="$1" REV="$2" TWEET="SVN Log (r$REV): $(svnlook log $REPOS -r $REV)" curl -u KickTweet:mySecretPassword -d status="${TWEET:0:139}" http://twitter.com/statuses/update.xml |
Note that the use of the ‘${TWEET:0:139}’ is a definite bashism, and not portable.
Update (2008-09-22)
Little tidbit to add into the script right before the curl call. If you want ellipses on commit messages over 140 characters, use this version.
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/bash REPOS="$1" REV="$2" TWEET="SVN Log (r$REV): $(svnlook log $REPOS -r $REV)" if [ "${#TWEET}" -gt 140 ]; then TWEET="${TWEET:0:137}..." fi curl -u KickTweet:mySecretPassword -d status="${TWEET:0:139}" http://twitter.com/statuses/update.xml |