1. Feb 17th, 2008

    Gem RDoc on Leopard

    Cover your eyes, you’re about to see some blatant XML abuse. With your eyes closed, create the file /Library/LaunchDaemons/ruby.gem.server.plist and place this into the file:

     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
      <key>Label</key><string>ruby.gem.server</string>
      <key>ProgramArguments</key><array><string>/usr/bin/gem</string><string>server</string></array>
      <key>KeepAlive</key><true/>
      <key>RunAtLoad</key><true/>
    </dict>
    </plist>

    Save and open your eyes.  From the command line, change ownership on the file, and load to launchd:

    $ chown root:wheel  /Library/LaunchDaemons/ruby.gem.server.plist
    $ launchctl
    launchd% load /Library/LaunchDaemons/ruby.gem.server.plist
    launchd% exit

    Open your browser to http://localhost:8808/. Bask in the glory.

    Update: Or you can just use Lingon which reduces all of this to a few clicks, no need for XML or chown heroics (thanks Matt).

    1. Feb 17th, 2008

      Matt

      Lingon (http://lingon.sourceforge.net/) is a great help when dealing with launchd. At least you don’t have to hold your nose or screw your eyes tightly shut.

    2. Feb 17th, 2008

      Pat Maddox

      Or you could type “gem server”

    3. Feb 17th, 2008

      Assaf

      Matt, thanks, good tip.

      Pat, I could and I did, but the whole point of this inferious machines is to automate this for us, and unfortunately I’m in the “reboot early, reboot often” hell.

    4. Feb 18th, 2008

      Muhabbet

      Matt, thanks, good tip.

    5. Mar 31st, 2008

      meekish

      Have you discovered a way to have launchd automatically restart the gem server when a gem is installed/updated? As far as I can tell, launchd supports automatically restarting a process when a single file changes, but afaik no single file changes every time a gem is updated or installed.

    6. Mar 31st, 2008

      Assaf

      meekish, I still don’t have a way to get gem server to restart when installing a new gem, other than killing it myself. If you find anything, let me know.

    Your comment, here ⇓