Class: Texas::Build::Task::PublishPDF
- Inherits:
-
Base
- Object
- Base
- Texas::Build::Task::PublishPDF
show all
- Defined in:
- lib/texas/build/task/publish_pdf.rb
Instance Attribute Summary
Attributes inherited from Base
#build
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#build_path ⇒ Object
10
11
12
|
# File 'lib/texas/build/task/publish_pdf.rb', line 10
def build_path
build.__path__
end
|
#copy_pdf_file_to_dest_dir ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/texas/build/task/publish_pdf.rb', line 23
def copy_pdf_file_to_dest_dir
tmp_file = File.join(build_path, "#{File.basename(master_file, '.tex')}.pdf")
FileUtils.mkdir_p File.dirname(dest_file)
FileUtils.copy tmp_file, dest_file
verbose {
file = File.join(build_path, "master.log")
output = `grep "Output written on" #{file}`
numbers = output.scan(/\((\d+?) pages\, (\d+?) bytes\)\./).flatten
@page_count = numbers.first.to_i
"Written PDF in #{dest_file.gsub(root, '')} (#{@page_count} pages)".green
}
end
|
#dest_file ⇒ Object
14
15
16
|
# File 'lib/texas/build/task/publish_pdf.rb', line 14
def dest_file
build.dest_file
end
|
#master_file ⇒ Object
6
7
8
|
# File 'lib/texas/build/task/publish_pdf.rb', line 6
def master_file
build.master_file
end
|
#run ⇒ Object
18
19
20
21
|
# File 'lib/texas/build/task/publish_pdf.rb', line 18
def run
run_pdflatex
copy_pdf_file_to_dest_dir
end
|
#run_pdflatex ⇒ Object
36
37
38
39
40
41
|
# File 'lib/texas/build/task/publish_pdf.rb', line 36
def run_pdflatex
verbose { "Running pdflatex in #{build_path} ..." }
Dir.chdir build_path
`pdflatex #{File.basename(master_file)}`
`pdflatex #{File.basename(master_file)}`
end
|