Skip to content

Instantly share code, notes, and snippets.

@lacco
Created November 22, 2009 16:25
Show Gist options
  • Save lacco/240625 to your computer and use it in GitHub Desktop.
Save lacco/240625 to your computer and use it in GitHub Desktop.
namespace :yard do
desc "Generate yard documentation of controllers and models"
task :doc do
`yardoc app/models/**/*.rb app/controllers/**/*.rb config/routes.rb --output yardoc --protected`
puts "Generated doc to yardoc/index.html"
end
desc "Generate UML graph (requires dot, download Graphviz from http://www.graphviz.org/)"
task :graph do
#TODO use --db to specify specific yardoc db, but this doesn't seem to work with current version of yard-graph
`yardoc app/models/**/*.rb --no-output --protected`
`yard-graph --full | dot -T pdf -o yardoc/diagram.pdf`
puts "Generated diagram to yardoc/diagram.pdf"
end
desc "Generate yard documentation of controllers and annotated models"
task :annotated_doc do
if ENV["FORCE_ANNOTATION"] != "true"
print "Are you sure to run 'annotate' on all your code? Be sure that you have no uncommitted local changes! Continue? [yN] "
return if STDIN.gets.strip !~ /y/i
end
puts "Annotating models ..."
`annotate`
puts "Generating documentation ...."
Rake::Task["yard:doc"].invoke
puts "Remove annotations ..."
`annotate -d`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment