Class: UberDoc::DoxygenTask
- Defined in:
- lib/uberdoc/tasks/doxygen_task.rb
Constant Summary collapse
- DOC_PREF_FILE_NAME =
"UberDocMe"- DOC_OUTPUT_DIR =
"Docs"- DOXYGEN_BIN =
"doxygen"- DOXYGEN_REDIRECT_KEY =
"OUTPUT_DIRECTORY"- BASE_DOXYFILE =
UberDoc::Util::template_file_path("Doxyfile.Base")
Class Method Summary collapse
Instance Method Summary collapse
-
#generate_documentation(directory) ⇒ Object
Generates documentation for a single directory.
-
#generate_project(docfile) ⇒ Object
Generates Doxyfile variants from the template create the docset or HTML doc.
-
#perform ⇒ Object
generate_documentation.
Methods inherited from Task
Constructor Details
This class inherits a constructor from UberDoc::Task
Class Method Details
.should_run?(options) ⇒ Boolean
7 8 9 |
# File 'lib/uberdoc/tasks/doxygen_task.rb', line 7 def self.should_run?() .source_directories.count > 0 end |
Instance Method Details
#generate_documentation(directory) ⇒ Object
Generates documentation for a single directory
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/uberdoc/tasks/doxygen_task.rb', line 81 def generate_documentation(directory) puts "Generating Documentation for '#{directory}'" FileUtils.rm_rf DOC_OUTPUT_DIR FileUtils.mkdir_p DOC_OUTPUT_DIR Dir["#{directory}/**/#{DOC_PREF_FILE_NAME}"].each do |file| generate_project(file) end end |
#generate_project(docfile) ⇒ Object
Generates Doxyfile variants from the template create the docset or HTML doc
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/uberdoc/tasks/doxygen_task.rb', line 20 def generate_project(docfile) project_name = File.basename(File.dirname(docfile)) project_dir = File.dirname(docfile) puts "Found #{project_name}" absolute_out_dir = File.join(File.absolute_path(DOC_OUTPUT_DIR), project_name) FileUtils.mkdir_p absolute_out_dir # Generate the composite Doxyfile base_doxyfile = File.open(BASE_DOXYFILE, 'rb') { |file| file.read } doxyfile_addition = File.open(docfile, 'rb') { |file| file.read } composite_doxyfile_contents = base_doxyfile + doxyfile_addition + "\n#{DOXYGEN_REDIRECT_KEY} = #{absolute_out_dir}\n" composite_doxyfile_path = File.join(absolute_out_dir, "Doxyfile") File.open(composite_doxyfile_path, 'w') {|f| f.write(composite_doxyfile_contents) } if @options.docset puts "Generating docset for #{project_name}" # Change into the directory and invoke doxygen FileUtils.cd(project_dir) do UberDoc::Util::execute_command("#{DOXYGEN_BIN} #{composite_doxyfile_path}", @options.verbose) end # Change into the HTML directory and make the docset html_output_directory = File.join(absolute_out_dir, "html") FileUtils.cd(html_output_directory) do UberDoc::Util::execute_command("make", @options.verbose) end # Find the docset file in the directory and move it one level up docset_directory = File.join(absolute_out_dir, "docset") FileUtils.mkdir_p(docset_directory) Dir["#{html_output_directory}/**/*.docset"].each do |docset| FileUtils.mv(docset, docset_directory) end end # Generate the docset again but this time with treeview composite_doxyfile_contents += "\nGENERATE_TREEVIEW = YES\n" File.open(composite_doxyfile_path, 'w') {|f| f.write(composite_doxyfile_contents) } puts "Generating HTML Documentation for #{project_name}" # Change again into the directory and invoke doxygen FileUtils.cd(project_dir) do UberDoc::Util::execute_command("#{DOXYGEN_BIN} #{composite_doxyfile_path}", @options.verbose) end end |
#perform ⇒ Object
generate_documentation
92 93 94 95 96 |
# File 'lib/uberdoc/tasks/doxygen_task.rb', line 92 def perform @options.source_directories.each do |dir| generate_documentation(dir) end end |