0

Is there any Rails way to browse the documentation generated in local doc/ folder with the command rake doc:app?

I know I could configure Apache to serve the files in the doc folder but I would be surprised if Rails didn't provide a way to do that too.

fkoessler
  • 6,932
  • 11
  • 60
  • 92

1 Answers1

0

The reason Rails doesn't provide a way to serve it is because it's just static HTML - you can open it in your browser directly (eg. firefox doc/app/index.html), without the need for a server.

If you wanted, you could add your own Rake task for this in lib/tasks/browserdoc.rake:

namespace :doc do
    desc "Browse application documentation"
    task :open do
        `firefox doc/app/index.html`
    end
end

Some systems have browser-agnostic shortcuts you could use instead of hard-coding the browser name; open on Mac OSX will open an HTML file in your current browser, as will sensible-browser on most modern Linux systems.

Alex P
  • 5,942
  • 2
  • 23
  • 30
  • 1
    Fair enough. For the record, I symlinked the `doc` folder into `/var/www/` so that Apache knew it had to serve the pages: `sudo ln -s ~/www/yourownpoet/doc /var/www/yopdoc` – fkoessler Jul 07 '14 at 11:13