Offline Documentation For Ruby, Rails and Your Project's Gems - Tkalin
Offline Documentation For Ruby, Rails and Your Project's Gems - Tkalin
com
http://www.tkalin.com/blog_posts/offline-documentation-for-ruby-rails-and-your-project-s-gems 1/4
tkalin dot com
Ivan Tkalin's blogging about ruby, javascript and ubuntu linux
Blog
About
Contact me
Sign in
Offline documentation for Ruby, Rails and your project's gems
May 24, 2012
I am going to work for a couple weeks on my Ruby on Rails project without broadband internet
connection, so decided to research, how to get browseable and nice looking offline copies of Ruby's,
Rails' and some other gems' (like RSpec and Capybara) documentation.
Here I'll show, where to get and how to build offline copies of:
1. Ruby Core and Std-lib html documentation (offline copy of http://ruby-doc.org/)
2. Rails API html documentation (offline copy of http://api.rubyonrails.org/)
3. Rails guides html (offline copy of http://guides.rubyonrails.org/)
4. Your Rails project's gems documentation using YARD (similar to http://rubydoc.info/, but for
gems from your Gemfile only)
NOTE: My examples are for Ruby 1.9.3 and Rails 3.2.3, but they can be easily adopted to any version
of Ruby/Rails.
Ruby 1.9.3 Core and Std-lib offline documentation
This is very easy. Just download and extract archives from the official downloads page, then open
index.html in browser and you're done.
Rails API offline documentation
We will generate RDoc html documentation from Rails' sources. So we will get sources from github:
git clone git://github.com/rails/rails.git
Checkout desired version (3.2.3) and install gems:
cd rails
git checkout v3.2.3 -b 3.2.3
bundle
And run rake task, that will build RDoc HTML files for us:
rake rdoc
Resulting HTML files can be found and browsed at ./doc/rdoc directory. Just open index.html file
in the browser and you're done.
8/2/2014 Offline documentation for Ruby, Rails and your project's gems | tkalin.com
http://www.tkalin.com/blog_posts/offline-documentation-for-ruby-rails-and-your-project-s-gems 2/4
Rails Guides offline
Assuming that we already have rails sources and checked out desired version from previous step, we
can now generate rails guides html:
cd railties/guides
ruby rails_guides.rb
Resulting HTML files can be found and browsed at ./railties/guides/output directory. Just open
index.html file in the browser and you're done.
Offline documentation for gems used in your Rails project
We well use YARD - RDoc compatible Ruby documentation tool:
gem install YARD
YARD has a lot of features, but we are interested in it's ability to be launched as a local documentation
server for gems from our Rails app's Gemfile
cd YOUR_RAILS_APP
yard server -G Gemfile
Now we can open http://0.0.0.0:8808 in the browser and see something similar to http://rubydoc.info/
but for gems from our Gemfile.
That's it.
8/2/2014 Offline documentation for Ruby, Rails and your project's gems | tkalin.com
http://www.tkalin.com/blog_posts/offline-documentation-for-ruby-rails-and-your-project-s-gems 3/4
Quick PostgreSQL server optimization for
development (or integration server)
1 comment 9 months ago
Alexander wow, I've speeded up my
rspec tests by 25%. Thanks for the arctile!
Rails 4: Disable assets caching for
development/test environments
1 comment 5 months ago
Eric Hurst Thanks for posting this.
Completely forgot about that cache.
ALSO ON TKALIN DOT COM
2 Comments tkalin dot com Login
Sort by Oldest Share
Join the discussion
Reply
shin okada 8 months ago
Dash at http://kapeli.com/dash is another way for offline doc.
Reply
Manuel Meurer 4 months ago
Check out http://rubydocs.org for online and offline Ruby and Rails docs. Disclaimer: I
built it. :)
WHAT'S THIS?
Subscribe Add Disqus to your site
Favorite
Share
Share
About
Twitter
Github
LinkedIn
MoiKrug
StackOverflow
Recent blog posts
Rails 4: Disable assets caching for development/test environments
Quick PostgreSQL server optimization for development (or integration server)
Installing Adobe Air and Elance Tracker on Ubuntu 13.10 (Saucy Salamander) 64 bit
Protecting staging/testing site area
Multiple file upload with Rails 3.2, paperclip, html5 and no javascript
Offline documentation for Ruby, Rails and your project's gems
Testing authorization using RSpec parametrized shared examples
Using console vim as vim:// protocol handler in Ubuntu
Broadcasting your rhythmbox in ubuntu 11.10
Calling GNOME/KDE default application from NERDTree
8/2/2014 Offline documentation for Ruby, Rails and your project's gems | tkalin.com
http://www.tkalin.com/blog_posts/offline-documentation-for-ruby-rails-and-your-project-s-gems 4/4
2012 Ivan Tkalin