FogBugz “Active Project” notification tool

At Turboweb we’ve recently subscribed to a 5-user on-demand license for an awesome case tracking system called FogBugz.  For us it means that we have controlled workflow of cases (bugs, features, enquiries etc.) along with awesome estimation reporting and time tracking.  FogBugz was built with development teams in mind and it’s a very nice tool.

Anyway, one of the things it has is a nice API which you can use to interrogate the product (read and write) and this got me thinking about how I could use the API to remind me what I should currently be working on.  Thus was created the “FogBugz Notification Tool”.

This script does the following:

  1. Connects to your FogBugz installation
  2. Runs a query to see what things have been worked on today
  3. If there are any items that don’t have an end date, then it’s the case that’s currently being worked on
  4. Get the details of the case
  5. Use notify-send to pop up a notification bubble showing case number, title, estimated time and time remaining.

FogBugz Active Case Notification

I have found this most effective if I put it in my crontab to run every 5 minutes.

Requirements:

  • Ubuntu Linux (or any version of Linux that supports the “notify-send” command)
  • PHP5 CLI (simply because this script is written with PHP)
  • The “libnotify-bin” package (this provides the “notify-send” command, try “sudo apt-get install libnotify-bin”)

The script requires a little configuration for your circumstances, but this is easily done by editing the defined constants in the script:

	// Adjust these defines to suit your installation
	define( 'FBBASEURL', 'https://mywebsite.fogbugz.com/' );
	define( 'FBUSERNAME', 'my@email.address.com' );
	define( 'FBPASSWORD', 'mypassword' );

And to add it to your crontab, simply add this line (note the */5 means every time the current number of minutes in the hour is evenly divisible by 5)

*/5 * * * * DISPLAY=:0.0 /usr/bin/php /home/bob/fogbugz-notify.php

Of course, adjust the path appropriately.

Changing the location of your working copy with Subversion

svnSubversion is a popular version control system that will allow you to keep track of any changes to any files (normally text files or source code). If you’re a developer and you’re not using a version control system it’s kind of like being dragged behind a Jeep instead of driving it, except you don’t realise that’s what’s happening.

Anyway, when using Subversion you “check out” from the repository your own “working copy” of the code. This is where you then make your changes before either reverting them (throwing them out) or committing them (storing them in the repository as the latest version).

There may be situations where the location of the repository (which is usually specified as a URI) may change, and you would prefer to keep your working directory intact rather than having to check out a fresh copy from the new URI.

This is easy enough to do with the “switch” command, like so:

  1. Start a shell and change into the working directory that you’re using, e.g. cd /home/bob/projects/myproject
  2. Issue the svn switch command, with the –relocate option, followed by the old URI and the new new URI, e.g. svn switch –relocate http://hostname.com/svn/myproject http://newhostname.com/svn/myproject

In my particular case I had checked out a working copy from a subversion repository available on my LAN at my workplace, but then when working remotely I could not update or commit files.  The repository is accessible remotely however via HTTPS.  Even though it’s the same physical repository, the URI that I access it by had changed so my command was:

svn switch --relocate http://ace/svn/myproject https://work/svn/myproject

To find the URI of your current working directory, use the “svn info” command and look for the Repository Root:

bob@bob-laptop:/var/www/myproject$ svn info
Path: .
URL: https://work/svn/myproject
Repository Root: https://work/svn/myproject
Repository UUID: a13b7e41-fee6-4c75-a229-83425febcc85
Revision: 498
Node Kind: directory
Schedule: normal
Last Changed Author: bob
Last Changed Rev: 498
Last Changed Date: 2009-11-30 14:01:35 +1300 (Mon, 30 Nov 2009)

WordPress Themes