in src/main/scripts/GeneratePdfDocuments.scala [29:50]
def debug(message: String) = LOG_FILE.println(message)
def info(message: String) = log.info(message)
def warn(message: String) = log.warn(message)
def createPdf(input: File) {
info("- converting " + input)
val pdf = new File(input.getParent, input.getName.take(input.getName.length-5))
val process = new ProcessBuilder("prince", input.getCanonicalPath, "-o", pdf.getCanonicalPath)
.redirectErrorStream(true)
.start
process.waitFor
Source.fromInputStream(process.getInputStream).getLines.foreach(debug)
pdf.exists match {
case false if PDF_REQUIRED =>
throw new RuntimeException("PDF generation required but failed to convert %".format(input))
case false if !PDF_REQUIRED =>
warn(" conversion to PDF failed - check %s for more information".format(LOG_FILE))
case true =>
helper.attachArtifact(project.getWrapped, "pdf", pdf.getName.split("\\.").head, pdf)
}
}