I love rubydoc.info, but I was curious how hard it might be to run a local copy. The site is powered by the YARD gem.
You can use YARD to generate documentation for your installed gems, even if you
use --no-rdoc when running gem install (or have included it in your .gemrc,
as I have). This can be done by running yard server --gems and browsing to
http://localhost:8808/.
I already run Pow on my MacBook, so I set up the yard server command to
run in the background via OSX LaunchAgents:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
1
| |
and then used the following to connect it up with Pow and visit it in my browser:
1 2 | |
This uses Pow’s port forwarding functionality rather than the more common Rack app usage. There was probably a way to implement this with a Rackup file but the last time I investigated this, I was not able to find a Rack configuration to run YARD’s gem docs server.
Next, I set up a custom search in Alfred 2 that allows me to look at the docs for any gem by pressint Alt+Space, then typing “gemd <gem name>”:

If you have Alfred 2 installed, you can click here to add this search to your custom searches automatically.
