Last active
August 29, 2015 13:56
-
-
Save cnosuke/9091813 to your computer and use it in GitHub Desktop.
論文をLaTeXでパパーンと書き出すためのRakefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file = ENV['file'] | |
out_dir = ENV['out_dir'] || './out' | |
time_format = ENV['time_format'] || "%Y-%m-%d_%H-%M-%S" | |
task :platex do | |
cmd = "platex #{file}.tex" | |
abort unless system(cmd) | |
end | |
task :dvipdfmx do | |
cmd = "dvipdfmx #{file}.dvi" | |
abort unless system(cmd) | |
end | |
task :mk_out_dir do | |
cmd = "mkdir -p #{out_dir}" | |
abort unless system(cmd) | |
end | |
task cp_to_out_dir: [:mk_out_dir] do | |
cmd = "cp #{file}.pdf #{out_dir}/#{file}_#{Time.now.strftime(time_format)}.pdf" | |
abort unless system(cmd) | |
end | |
task all: [:platex, :dvipdfmx, :cp_to_out_dir] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rake all file=ウルトラ論文 out_dir='publish' time_format='%Y%m%d'
みたいな感じで使う。
これすると、
./publish/ウルトラ論文_20140219.pdf
みたいな感じにファイルが書き出されるout_dir
とtime_format
は省略可能