Project

doc_to_pdf

0.0
No commit activity in last 3 years
No release in over 3 years
Turn documentation stored in doc folder in your rails app in a pdf file using wkhtmltopdf
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

DocToPdf

Gem Version Code Climate Coverage Status Build Status Dependency Status

GEM to export rdoc in a pdf file using wkhtmltopdf libary

Instalation

Add this line to your application's Gemfile:

gem 'doc_to_pdf'

if you like it works only in your dev env, include in your dev group in Gemfile:

group :development do
   gem 'doc_to_pdf'
end

And then execute:

$ bundle

Or install it yourself as:

$ gem install doc_to_pdf

Usage

First create rdoc documetation with rdoc as you actually do:

#all your app
rdoc

#only app/ folder
rake doc:app

The gem include a rake task under doc namespace

rake doc:pdf

If you like to change the default name "doc.pdf" call the programm with file param:

$ rake doc:pdf file=myNewFile
Loading pages (1/5)
Resolving links (2/5)
Counting pages (3/5)
Printing pages (5/5)
Done

Imgur

In my case the menu based in the left is more than 4 pages, and the links doesn't work.

Also it offer an option to clean the "innecessary" html, only pass the param clean=true (default is false)

$ rake doc:pdf clean=true
clean html, this could take a while.
Loading pages (1/5)
Resolving links (2/5)
Counting pages (3/5)
Printing pages (5/5)
Done

WARNING: This option change your html files

Imgur

Now it looks cleanner :D

The pdf file is saved in your application root

PDF Layout

All the pages include the number of the page, the format is page/total i.e (12/100)

Table of content Imgur

Class Documentation Imgur

Recomendations

  • use annotate to comment your models and routes files, please take a look
  • I created a css for prettier in order to cusmotize more like gituh, the file is in this gist, if you like to use it replace the custom css. improvements:
  • Code highlight
  • Text formating
  • Fresh colors

How the css looks?

Imgur

Tested with

OS
  • Mac OS - Mountain Lion

  • Ubuntu - 12.04

Ruby env

  • Ruby 1.9.3 - 2.0

  • Rails 3.2.13

Binaries

  • wkhtmltopdf 0.0.9

Requirements GEMS

  • Nokogiri 1.6
  • Colorige

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request