Class: Rubbr::Runner::Base
Instance Attribute Summary collapse
-
#errors ⇒ Object
Contains a list of possible errors after a run.
-
#executable ⇒ Object
The executable to be run.
-
#input_file ⇒ Object
The file to be run trough the latex process.
-
#verboser_warnings ⇒ Object
Contains a list of possible verboser warnings after a run.
-
#warnings ⇒ Object
Contains a list of possible warnings after a run.
Instance Method Summary collapse
- #feedback ⇒ Object
-
#initialize(input_file, executable) ⇒ Base
constructor
A new instance of Base.
- #run ⇒ Object
Methods included from Cli
#color?, #disable_stderr, #disable_stdinn, #disable_stdout, #error, #executable?, #notice, #valid_executable, #warning
Constructor Details
#initialize(input_file, executable) ⇒ Base
Returns a new instance of Base.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rubbr/runner.rb', line 27 def initialize(input_file, executable) @input_file = input_file @executable = valid_executable executable @verboser_warnings = [] @errors = [] if File.exists? @input_file run else error "Running of #@executable aborted. " + "Input file: #@input_file not found" end end |
Instance Attribute Details
#errors ⇒ Object
Contains a list of possible errors after a run.
25 26 27 |
# File 'lib/rubbr/runner.rb', line 25 def errors @errors end |
#executable ⇒ Object
The executable to be run.
16 17 18 |
# File 'lib/rubbr/runner.rb', line 16 def executable @executable end |
#input_file ⇒ Object
The file to be run trough the latex process.
13 14 15 |
# File 'lib/rubbr/runner.rb', line 13 def input_file @input_file end |
#verboser_warnings ⇒ Object
Contains a list of possible verboser warnings after a run.
22 23 24 |
# File 'lib/rubbr/runner.rb', line 22 def verboser_warnings @verboser_warnings end |
#warnings ⇒ Object
Contains a list of possible warnings after a run.
19 20 21 |
# File 'lib/rubbr/runner.rb', line 19 def warnings @warnings end |
Instance Method Details
#feedback ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/rubbr/runner.rb', line 68 def feedback unless @warnings.empty? notice "Warnings from #@executable:" @warnings.each do || warning end end unless @verboser_warnings.empty? notice "Verboser warnings from #@executable:" @verboser_warnings.each do || warning end end unless @errors.empty? notice "Errors from #@executable:" @errors.each do || error end raise GotErrors end end |
#run ⇒ Object
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 |
# File 'lib/rubbr/runner.rb', line 41 def run disable_stdinn do # No input in case of error correction dialogue = /^(Overfull|Underfull|No file|Package \w+ Warning:|LaTeX Warning:)/ = /^(Overfull \\hbox|Underfull \\hbox)/ run = `#@executable #@input_file` lines = run.split("\n") @warnings = run.grep().sort if Rubbr.[:verboser] lines.each_with_index do |line, i| if line =~ @verboser_warnings << line @verboser_warnings << lines[i+1] end end end while lines.shift if lines.first =~ /^!/ # LaTeX Error, processing halted 3.times { @errors << lines.shift } end end end end |