arrow-left arrow-right brightness-2 chevron-left chevron-right facebook-box facebook loader magnify menu-down rss-box star twitter-box twitter white-balance-sunny window-close
Display notifications when Jekyll-based operations complete
1 min read

Display notifications when Jekyll-based operations complete

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 Rakefile:

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.

You've successfully subscribed to Justin Blanton.
Success! Your account is fully activated, you now have access to all content.