Back to the main page.

Bug 816 - improve the tweets of the svn changes

Status CLOSED FIXED
Reported 2011-07-13 14:45:00 +0200
Modified 2011-07-20 15:20:30 +0200
Product: FieldTrip
Component: documentation
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Eelke Spaak
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2011-07-13 14:45:16 +0200

... as discussed during the meeting Below is the shell script that runs as svn post commit hook, i.e. it is executed on the svn server after each commit. I think you should be able to execute it yourself when logged in on the svn server with ssh. It is located in /home/svnroot/fieldtrip/hooks. Note that the extra software that is available on the svn server is limited (on purpose), but php appears to be available. ------------------- #!/bin/sh # uncomment the following line to prevent this script from executing # exit 0 REPOS="$1" REV="$2" # there is a maximum of 140 characters per tweet COMMENT=`svnlook log -r${REV} ${REPOS}` AUTHOR=`svnlook author -r${REV} ${REPOS}` STATUS=${AUTHOR}\(${REV}\)": "${COMMENT} STATUS=`echo $STATUS | dd count=140 bs=1 2> /dev/null` # this is the old twitter interface, which stopped working in 2010 #/usr/bin/curl --basic --user fieldtriptoolbx --data status="${STATUS}" https://twitter.com/statuses/update.xml # this is the new twitter interface $REPOS/hooks/twitter/ttytter -keyf=$REPOS/hooks/twitter/fieldtriptoolbx.key -status="${STATUS}" -silent


Eelke Spaak - 2011-07-13 15:17:45 +0200

The post-commit-twitter script now executes: php /home/eelspa/fttweetcommit/tweetcommit.php "${AUTHOR}" "${REV}" "${COMMENT}" and the tweetcommit.php performs the actual tweet, including a bit.ly URL to Google Code. Unfortunately, as of now, the Google Code repository does not know about the latest revisions until the day after. So, all the links will be invalid until google code is synced with the local SVN. Nothing to do about this at the moment; Google Code needs to be synced instantaneously for this to work. A sidenote: I was actually pleasantly surprised by how easy it was to call a PHP-script from the command line on the SVN server. So, if PHP can help in improving the syncing between SVN and google code, I can probably make it happen.


Robert Oostenveld - 2011-07-13 22:46:58 +0200

There was a permission problem due to roboos (doing the commit) not being allowed to execute eelspa's php code in his homedir. To fix this I moved the fttwitter code from ~eelspa into the repository directory and made a small change to the post-commit-twitter script (to use $REPOS). The automatic updates of googlecode are not yet happening. The consequence was that twitter was up to date, but googlecode not. I increased the svnsync ferquency in the cron job to once per hour. overall it is very nice!