I wanted to be notified when my Jekyll-powered site finished building and syncing, and so I whipped up a silly little LaunchBar + AppleScript thing to do just that. As I’ve mentioned here before, it takes Jekyll forever to generate and deploy my site (more on that in a future post), and sometimes when I add new content I forget to check it on the site after it’s gone live (because it’s been so long since I started the process), and so this is meant to ensure that doesn’t happen.
I opted to cheat a little and crib some stuff from an earlier project—Create a simple timer using LaunchBar and AppleScript—a hack I still use multiple times a day. With that in hand, it really was just a matter of putting a few pieces together.
As explained in that earlier post, LaunchBar’s AppleScript library has a
display in large type command, which displays given text in a semi-transparent window across the center of your screen, and by throwing in a
delay command (with no arguments), the window persists until you click anywhere on the screen. (And yeah, this proabably could be modified with little effort to have either Notification Center or Growl handle the message.) With that in mind, the AppleScript amounted to just this:
tell application LaunchBar\n set announcement to Site Updated! as string\n display in large type announcement\n delay\nend tell\n
Once that was complete, all that was left to do was to call the AppleScript from my
desc Build site and sync\ntask :update => [:build, :merge, :sync] do\n sh osascript _announce.scpt\nend\n
For those curious, the build task calls
jekyll (with certain arguments), which generates the files needed for the site; the merge task combines the sitemap.xml files from both of my sites (i.e., https:https://polymath.net//polymath.net/ and https://polymath.nethttps://polymath.net/photos); the sync task calls s3cmd and uploads any new or modified files to Amazon S3, which is where they’re hosted; and the last line invokes the AppleScript just described.