handouts/build.sc
changeset 981 14e5ae1fb541
equal deleted inserted replaced
980:0c491eff5b01 981:14e5ae1fb541
       
     1 #!/usr/bin/env amm
       
     2 
       
     3 
       
     4 /*
       
     5 val files = Seq("hw01.tex",
       
     6 	        "hw02.tex",
       
     7 	        "hw03.tex",
       
     8 	        "hw04.tex",
       
     9 	        "hw05.tex",
       
    10                 "hw06.tex",
       
    11 	        "hw07.tex",
       
    12 	        "hw08.tex",
       
    13 	        "hw09.tex")
       
    14 
       
    15 val pdf_files = files.map(s => s.stripSuffix("tex") ++ "pdf")
       
    16 
       
    17 
       
    18 @main
       
    19 def make() = {
       
    20   for (f <- files) {
       
    21     println(s"Processing $f ...")
       
    22     os.proc("lualatex", f).call(stdout = os.Inherit, stdin = os.Inherit)
       
    23   }
       
    24 }
       
    25 
       
    26 @main
       
    27 def make_sols() = {
       
    28   for (f <- files) {
       
    29     val old_pdf = f.stripSuffix(".tex") ++ ".pdf"
       
    30     val new_pdf = f.stripSuffix(".tex") ++ "-sol.pdf"
       
    31     println(s"Processing $f -> $new_pdf ...")
       
    32     os.proc("lualatex", f, "sol").call(stdout = os.Inherit, stdin = os.Inherit)
       
    33     os.move.over(os.pwd / old_pdf, os.pwd / new_pdf)
       
    34   }
       
    35 }
       
    36 
       
    37 @main
       
    38 def all() = {
       
    39   make_sols()
       
    40   make()
       
    41 }
       
    42 
       
    43 @main
       
    44 def hg() = {
       
    45   println(os.proc("hg", "commit", "-m texupdate", files ++ pdf_files).call())
       
    46   println(os.proc("hg", "push").call())
       
    47 }
       
    48 
       
    49 */
       
    50  
       
    51 // extensions of files to be deleted
       
    52 val todelete =
       
    53   List("fdb_latexmk",
       
    54        "log",
       
    55        "aux",
       
    56        "xdv",
       
    57        "out", 
       
    58        "fls")
       
    59 
       
    60 
       
    61 @main
       
    62 def clean() = {
       
    63   for (f <- os.list.stream(os.pwd) if todelete.contains(f.ext)) {
       
    64     println(s"Delete: ${f.last}")
       
    65     os.remove(f)
       
    66   }
       
    67 }
       
    68