Module: Rubbr::Builder
- Extended by:
- Cli
- Defined in:
- lib/rubbr/builder.rb,
lib/rubbr/builder/ps.rb,
lib/rubbr/builder/dvi.rb,
lib/rubbr/builder/tex.rb
Overview
Handles the business of building latex (and bibtex if needed) source files into binary formats as dvi, ps, and pdf. The latex and bibtex utilites need to be run a certain number of times so that things like table of contents, references, citations, etc become proper. This module tries to solve this issue by running the needed utilities only as many times as needed.
Defined Under Namespace
Class Method Summary collapse
-
.build ⇒ Object
Build to the spesified format.
- .build_in_a_loop ⇒ Object
- .do_build ⇒ Object
Methods included from Cli
color?, disable_stderr, disable_stdinn, disable_stdout, error, executable?, notice, valid_executable, warning
Class Method Details
.build ⇒ Object
Build to the spesified format.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rubbr/builder.rb', line 15 def self.build if Rubbr::Change.d? do_build elsif Rubbr.[:force] notice "No changes in #{Rubbr.[:build_dir]} since last build, building anyway (--force)" do_build else notice "No changes in #{Rubbr.[:build_dir]} since last build" true end end |
.build_in_a_loop ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rubbr/builder.rb', line 27 def self.build_in_a_loop delay = Rubbr.[:loop_delay] delay = 0.5 if delay == 0.0 notice "Entering build loop. Press Ctrl-C to break out." forced_first_time = Rubbr.[:force] while true if Rubbr::Change.d? || forced_first_time notice "Change detected, building" forced_first_time = false do_build end sleep delay end end |
.do_build ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rubbr/builder.rb', line 48 def self.do_build if Rubbr.[:engine] == :pdflatex Rubbr::Builder::Tex.build else case Rubbr.[:format] when :dvi Rubbr::Builder::Tex.build when :ps Rubbr::Builder::Tex.build Rubbr::Builder::Dvi.build else Rubbr::Builder::Tex.build Rubbr::Builder::Dvi.build Rubbr::Builder::Ps.build end end true rescue Rubbr::Runner::GotErrors notice "There were errors, processing stopped." false end |