928
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1 |
#!/usr/bin/env amm
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
val files = Seq("hw01.tex",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
"hw02.tex",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
5 |
"hw03.tex",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
"hw04.tex",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
"hw05.tex",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
8 |
"hw06.tex",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
9 |
"hw07.tex",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
10 |
"hw08.tex",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
11 |
"hw09.tex")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
12 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
13 |
val pdf_files = files.map(s => s.stripSuffix("tex") ++ "pdf")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
14 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
15 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
@main
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
17 |
def make() = {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
18 |
for (f <- files) {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
19 |
println(s"Processing $f ...")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
20 |
os.proc("lualatex", f).call(stdout = os.Inherit, stdin = os.Inherit)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
21 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
22 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
23 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
24 |
@main
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
25 |
def make_sols() = {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
26 |
for (f <- files) {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
27 |
val old_pdf = f.stripSuffix(".tex") ++ ".pdf"
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
28 |
val new_pdf = f.stripSuffix(".tex") ++ "-sol.pdf"
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
29 |
println(s"Processing $f -> $new_pdf ...")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
30 |
os.proc("lualatex", f, "sol").call(stdout = os.Inherit, stdin = os.Inherit)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
31 |
os.move.over(os.pwd / old_pdf, os.pwd / new_pdf)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
32 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
33 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
34 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
35 |
@main
|
937
|
36 |
def all() = {
|
|
37 |
make_sols()
|
|
38 |
make()
|
|
39 |
}
|
|
40 |
|
|
41 |
@main
|
928
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
42 |
def hg() = {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
43 |
println(os.proc("hg", "commit", "-m texupdate", files ++ pdf_files).call())
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
44 |
println(os.proc("hg", "push").call())
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
45 |
}
|