Rake to Zenity Script
Zenity is a program that allows you to make simple GUI interfaces using the command line. I’ve been wanting to experiment with Zentiy so I wrote a script that gives rake tasks a GUI. This example creates something that is borderline useless but the implementation is less trivial than most examples that I’ve seen on websites. Here is what we’re going for:

And then after making a selection:

The program loops over these two interfaces until the user cancels, closes the screen, or doesn’t select anything. This is all accomplished in 54 lines of code which I don’t believe would be possible using normal GTK bindings.
Some Highlights From the Script:
Here are the two commands that create the basic GUI interfaces. You can just run these in Bash to see the results.
ZENITY_SELECTOR_GUI_CMD = %(zenity --list --radiolist --width=500 --height=300 --title="Deployment GUI" --column="" --column="Command" --column="Description")
ZENITY_INFO_BOX_GUI_CMD = %(zenity --text-info --width=700 --height=500)The script grabs the description of the rake commands using “rake -T command”.
# Retrives a description of a command using rake
def get_command_description(command)
status = Open4::popen4("rake -T #{command}") do |pid, stdin, stdout, stderr|
return stdout.read.match(/#\s.+/)
end
endThe code can be modified to use any rake commands that are available by modifying a couple of constants:
COMMANDS = %w(deploy start restart stop link_index grab_tail)
NAME_SPACE = 'vlad:'The full script:
rake_zenity
Again, I’m not sure that this script is really useful; there’s nothing wrong with using the command line to run rake tasks. Also NetBeans (which I use) already has a GUI for running rake tasks.

Still it’s easy to imagine how Zenity could easily be used to create wizards for a program or create a less intimidating script for end users to run. The late, great Automatix used Zenity and looking in Synaptic I see that Ubuntu’s Eclipse and Gedit packages depend on Zenity.