Running the gem doc server at startup on OS/X

18
Jun/10
0

I’ve been traveling a fair bit lately, and have occasionally had spotty Internet access. So my access to documentation for gems and whatnot has been limited.

It would be nice to have all of my gem documentation available locally. But I’m lazy. I don’t want to be typing “gem server” all the time.

So here’s what you do. Locate your appropriate gem command with “which gem”; I’m using rvm to run Ruby 1.9.1, so my answer is: /Users/jgn/.rvm/rubies/ruby-1.9.1-p376/bin/gem

Then create a gemserver.plist file like so, replacing the path to my gem with the path to yours:


<?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>localhost.gem.server</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Users/jgn/.rvm/rubies/ruby-1.9.1-p376/bin/gem</string>
		<string>server</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>

Now copy to /Library/LaunchDaemons

The next type you reboot, you’ll have your gem docs at http://localhost:8808/

Filed under: Ruby, Technology
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.