-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
63 lines (51 loc) · 1.53 KB
/
Rakefile
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Rakefile for wtsnjp/texlive-ja
require 'rake/clean'
require 'pathname'
# basics
PKG_NAME = "texlive-ja"
REF_REV = "r70587"
# directories
REPO_ROOT = Pathname.pwd
TMP_DIR = REPO_ROOT / "tmp"
BUILD_DIR = TMP_DIR / "build"
TARGET_DIR = TMP_DIR / PKG_NAME
SVN_ROOT = Pathname(Dir.home) / "repos/tug.org/texlive"
TEXLIVE_EN = "Master/texmf-dist/doc/texlive/texlive-en"
# cleaning
CLEAN.include([
"*.aux", "*.dvi", "*.log", "*.synctex.gz", "*.toc", "*.out", "tmp"
])
CLOBBER.include(["*.pdf", "*.zip"])
# deault
task default: :archive
desc "Build the document without the tombow"
task :build do
# initialize the build dir
rm_rf BUILD_DIR
mkdir_p BUILD_DIR
# generate the main source (without the tombow option)
main_tex = BUILD_DIR / "#{PKG_NAME}.tex"
sh "sed s/,tombow// #{PKG_NAME}.tex > #{main_tex}"
# build the document
cd BUILD_DIR
sh "TEXINPUTS='#{BUILD_DIR}:#{REPO_ROOT}//:' llmk #{PKG_NAME}.tex"
end
desc "Create an archive for TeX Live"
task :archive => :build do
# initialize the target
rm_rf TARGET_DIR
mkdir_p TARGET_DIR
# copy files to the target dir
pkg_contents = ["img", "#{PKG_NAME}.sty"].map{|c| REPO_ROOT / c}
pkg_contents += ["#{PKG_NAME}.tex", "#{PKG_NAME}.pdf"].map{|c| BUILD_DIR / c}
cp_r pkg_contents, TARGET_DIR
# create zip archive
cd TMP_DIR
sh "zip -q -r #{PKG_NAME}.zip #{PKG_NAME}"
mv "#{PKG_NAME}.zip", REPO_ROOT
end
desc "Show the diff from the last referenced texlive-en"
task :diff do
cd SVN_ROOT
sh "svn diff -r #{REF_REV}:HEAD #{TEXLIVE_EN}/{texlive-en.tex,tex-live.sty}"
end