Originally published at: http://www.sitepoint.com/build-monitoring-widgets-ruby-bitbar/
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: https://github.com/kamenevn/bitbar
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 https://github.com/kamenevn/bitbar. 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:
my_script.5m.sh