post-railsconf 07



RailsConf just ended. I've got a big refactoring of RAV in the works, but until I wrap that up I'll post this to hold things over:

mongrel panel screenshot

It may be hypocritical of me to keep harping on how it's best to avoid reliance on the mouse as much as you can, but I grudgingly admit that sometimes it is handy to be able to launch mongrel quickly with it. Below is the code for mongrel_panel.rb:

#!/usr/bin/env ruby

# Mongrel Panel
# Copyright (C) 2007 Phil Hagelberg

require 'gtk2'
require 'gtktrayicon'


mongrel = Gtk: :"mongrel")

$started = File.exist? RAILS_ROOT + '/log/'
button = Gtk: :"",  true)
button.image = Gtk: :"#{File.dirname(__FILE__)}/mong#{ \
    '_mono' unless $started}.png")
button.relief = Gtk: : RELIEF_NONE

button.signal_connect('clicked') do
  if $started
    button.image = Gtk: :"#{File.dirname(__FILE__)}/mong_mono.png")
    `mongrel_rails stop -c #{RAILS_ROOT}`
    $started = false
    button.image = Gtk: :"#{File.dirname(__FILE__)}/mong.png")
    `mongrel_rails start -c #{RAILS_ROOT} -d`
    $started = true


I feel like I keep harping on this, but man... GUI code is weird and unintuitive for me. Probably just a matter of familiarizing myself with the conventions, but still. On Ubuntu/Debian: sudo apt-get install libgnome2-ruby libgtk-trayicon-ruby1.8 then grab it.

Usage: RAILS_ROOT=~/projects/foo mongrel_panel.rb & or run it from your rails root.

This is nothing really, but it might be a nice base to adapt for other similar dæmons, I suppose. Let me know if you find it useful.

« older | 2007-10-13T07:00:01Z | newer »