-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathRakefile
More file actions
38 lines (29 loc) · 841 Bytes
/
Rakefile
File metadata and controls
38 lines (29 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'fileutils'
task :default => [:build]
IN_DIR = 'input'
OUT_DIR = 'pdf'
BUILD_DIR = 'build'
PDFLATEX_BIN = %x{which pdflatex}.chomp
task :build => [:clean, :compile, :publish]
task :clean do
FileUtils.rm_r Dir["#{BUILD_DIR}/*"]
end
task :compile do
FileUtils.mkdir BUILD_DIR if !Dir.exists?(BUILD_DIR)
Dir["#{IN_DIR}/**/*.tex"].each do |file|
sh "#{PDFLATEX_BIN} -output-dir=#{BUILD_DIR} #{file}"
end
end
task :publish do
FileUtils.mkdir OUT_DIR if !Dir.exists?(OUT_DIR)
Dir["#{BUILD_DIR}/**/*.pdf"].each do |pdf|
FileUtils.mv(pdf, OUT_DIR)
end
end
task :single, [:file] => :clean do |t,args|
FileUtils.mkdir BUILD_DIR if !Dir.exists?(BUILD_DIR)
Dir["#{IN_DIR}/**/#{args[:file]}.tex"].each do |file|
sh "#{PDFLATEX_BIN} -output-dir=#{BUILD_DIR} #{file}"
end
Rake::Task[:publish].invoke
end