Class: RosettAi::Documentation::ReferenceCompiler
- Inherits:
-
Object
- Object
- RosettAi::Documentation::ReferenceCompiler
- Defined in:
- lib/rosett_ai/documentation/reference_compiler.rb
Overview
Compiles the LaTeX technical reference document.
Runs the full pdflatex → biber → makeindex → pdflatex toolchain to produce doc/reference/rosett-ai-technical-reference.pdf from the LaTeX sources in doc/reference/src/.
Design reference: conf/design/documentation.yml
Constant Summary collapse
- REQUIRED_TOOLS =
Returns External tools required for documentation compilation.
['pdflatex', 'biber', 'makeindex'].freeze
- OUTPUT_NAME =
Returns Filename for compiled reference documentation.
'rosett-ai-technical-reference.pdf'- BUILD_ARTIFACTS =
Returns Files produced during reference documentation build.
['aux', 'bbl', 'bcf', 'blg', 'idx', 'ilg', 'ind', 'lof', 'log', 'lot', 'out', 'ptc', 'run.xml', 'toc'].freeze
Instance Method Summary collapse
- #available? ⇒ Boolean
- #compile! ⇒ Object
-
#initialize(root: nil) ⇒ ReferenceCompiler
constructor
A new instance of ReferenceCompiler.
-
#missing_tools ⇒ Array<String>
Return external tools required but not installed.
-
#output_path ⇒ Pathname
Return the compiled documentation output path.
-
#source_dir ⇒ Pathname
Return the man page source directory.
- #stale? ⇒ Boolean
Constructor Details
#initialize(root: nil) ⇒ ReferenceCompiler
Returns a new instance of ReferenceCompiler.
27 28 29 |
# File 'lib/rosett_ai/documentation/reference_compiler.rb', line 27 def initialize(root: nil) @root = root || RosettAi.root end |
Instance Method Details
#available? ⇒ Boolean
31 32 33 |
# File 'lib/rosett_ai/documentation/reference_compiler.rb', line 31 def available? REQUIRED_TOOLS.all? { |tool| tool_on_path?(tool) } end |
#compile! ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rosett_ai/documentation/reference_compiler.rb', line 49 def compile! raise RosettAi::DocumentationError, "Missing LaTeX tools: #{missing_tools.join(', ')}" unless available? raise RosettAi::DocumentationError, "Source directory not found: #{source_dir}" unless source_dir.exist? Dir.chdir(source_dir) do run_pdflatex! run_biber! run_makeindex 3.times { run_pdflatex! } end install_pdf! clean_artifacts! end |
#missing_tools ⇒ Array<String>
Return external tools required but not installed.
37 38 39 |
# File 'lib/rosett_ai/documentation/reference_compiler.rb', line 37 def missing_tools REQUIRED_TOOLS.reject { |tool| tool_on_path?(tool) } end |
#output_path ⇒ Pathname
Return the compiled documentation output path.
66 67 68 |
# File 'lib/rosett_ai/documentation/reference_compiler.rb', line 66 def output_path @root.join('doc', 'reference', OUTPUT_NAME) end |
#source_dir ⇒ Pathname
Return the man page source directory.
72 73 74 |
# File 'lib/rosett_ai/documentation/reference_compiler.rb', line 72 def source_dir @root.join('doc', 'reference', 'src') end |
#stale? ⇒ Boolean
41 42 43 44 45 46 47 |
# File 'lib/rosett_ai/documentation/reference_compiler.rb', line 41 def stale? pdf = output_path return true unless pdf.exist? pdf_mtime = pdf.mtime source_files.any? { |f| f.mtime > pdf_mtime } end |