Skip to content

Instantly share code, notes, and snippets.

@robharper
Created June 5, 2012 15:51
Show Gist options
  • Save robharper/2875876 to your computer and use it in GitHub Desktop.
Save robharper/2875876 to your computer and use it in GitHub Desktop.
Rocco (Docco) rake-pipeline filter
require "rocco"
#
# Run rocco to generate documentation on provided files
#
class RoccoFilter < Rake::Pipeline::Filter
def initialize(options={}, &block)
super(&block)
@sources = options.delete(:sources)
@options = options
end
def generate_output(inputs, output)
inputs.each do |input|
rocco = Rocco.new(input.fullpath, @sources, @options) do
input.read
end
output.write rocco.to_html
end
end
end
@robharper
Copy link
Author

This simple filter ingests source files and runs them through Rocco, the Docco Ruby port. Options can be passed directly to Rocco and additional html files may be linked via the :sources options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment