Monday, April 6, 2015

Build Monitoring Widgets with Ruby and BitBar

BitBar-small


Ruby developers are used to finding incredibly useful open source projects packaged as gems. In this tutorial, we'll take a look at BitBar, an open source project that isn't built in Ruby, but when combined with a small bit of Ruby can be incredibly powerful.


While the original project is no longer actively maintained, an updated fork of the project can be found here: http://ift.tt/1aaBo0t


BitBar provides Mac OS X users an easy way to create a menu bar item from the standard output of a script. I'll show you how to create a simple site ping monitor, and then we'll create a Twitter follower counter.


Installing BitBar


To install BitBar, visit the GitHub repository at http://ift.tt/1aaBo0t. Download the zip file (the button to download is in the righthand sidebar). Inside the archived folder, you will find a "Releases" folder, which holds the BitBar.app file. Put this in your Applications directory. Opening this application launches BitBar.


How BitBar Works: File Structure


BitBar is a simple application that runs all shell scripts in a given directory on an interval that is determined by the filename. Of course, you should be very careful when adding scripts to BitBar, especially if you are adding a low interval time.


To run a given file every 5 minutes, the naming structure would look something like this:


[bash] my_script.5m.sh [/bash]

Continue reading %Build Monitoring Widgets with Ruby and BitBar%




by Jonathan Cutrell via SitePoint

No comments:

Post a Comment