Offline Rails API layout using RDoc’s RDOCOPT

UPDATE March 29, 2009: This was all solved using:

template="jamis" rake doc:rails

Found on the blog by JamisBuck is the RDoc layout used online at api.rubyonrails.org. Simply acquire the file jamis.rb (posted here if you can’t find it elsewhere) and you’re covered with your Ruby Rdoc utilizing the instructions to append --template=jamis

But what about Rails? rake doc:rails doesn’t like the --template=jamis argument.

RDOCOPT="-S -f html -T jamis" — Then run  rake doc:rails and your offline local API copy will look just like the online version.

Sure there may be other ways of accomplishing this, but this got the job done and will get the job done next time I want to build the latest Rails API. If you’re interested in a more permanent solution, look at setting up variables in your .gemrc file.

3 thoughts on “Offline Rails API layout using RDoc’s RDOCOPT”

  1. Less than a month later it’s not working? I’ve tried SET and EXPORT and even with RDOCOPT set, the jamis.rb template isn’t working. Now, this is on a new install of OS X and Rails 2.3.2, but I don’t think that has anything to do with it … (I should try it on the MBP17) but there is this error when I freeze:

    ~/Sites/delete_me$ rake rails:freeze:gems
    (in /Users/mbp15/Sites/delete_me)
    Freezing to the gems for Rails 2.3.2
    rm -rf vendor/rails
    mkdir -p vendor/rails
    cd vendor/rails
    WARNING:  Installing to ~/.gem since /usr/local/lib/ruby/gems/1.8 and
    	  /usr/local/bin aren't both writable.
    Unpacked gem: '/Users/mbp15/Sites/delete_me/vendor/rails/activesupport-2.3.2'
    mv activesupport-2.3.2 activesupport
    Unpacked gem: '/Users/mbp15/Sites/delete_me/vendor/rails/activerecord-2.3.2'
    mv activerecord-2.3.2 activerecord
    Unpacked gem: '/Users/mbp15/Sites/delete_me/vendor/rails/actionpack-2.3.2'
    mv actionpack-2.3.2 actionpack
    Unpacked gem: '/Users/mbp15/Sites/delete_me/vendor/rails/actionmailer-2.3.2'
    mv actionmailer-2.3.2 actionmailer
    Unpacked gem: '/Users/mbp15/Sites/delete_me/vendor/rails/activeresource-2.3.2'
    mv activeresource-2.3.2 activeresource
    Unpacked gem: '/Users/mbp15/Sites/delete_me/vendor/rails/rails-2.3.2'
    cd -
    ~/Sites/delete_me$ rake doc:rails

    I’ll follow up when I solve this.

  2. To reiterate from buckblog:
    To use it, copy it into the “rdoc/generators/template/html” directory of your Ruby installation (i.e., on my machine)

    /usr/local/lib/ruby/1.8/rdoc/generators/template/html

    Then, when you run rdoc, just pass

    --template=jamis

    and you should be good to go.

    This was listed for location, the way to run it is solved above.
    For Rails:

    rails sample_project
    cd sample_project
    
    rake rails:freeze:gems
    
    rake doc:rails
    
    rake rails:unfreeze

Leave a Reply

Your email address will not be published. Required fields are marked *