Renamed script & optimised

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/59216734
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/59216734
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/59216734

Branch: refs/heads/master
Commit: 59216734945a6667fc440c108b175350a4f3ff7c
Parents: 2a70855
Author: Duncan Godwin <duncan.god...@cloudsoftcorp.com>
Authored: Mon Mar 7 15:28:55 2016 +0000
Committer: Duncan Godwin <duncan.god...@cloudsoftcorp.com>
Committed: Mon Mar 7 15:28:55 2016 +0000

----------------------------------------------------------------------
 _build/build-pdf.sh | 29 +++++++++++++++++++++++++++++
 _build/build.sh     |  8 ++++----
 _build/buildPDF.sh  | 32 --------------------------------
 3 files changed, 33 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/59216734/_build/build-pdf.sh
----------------------------------------------------------------------
diff --git a/_build/build-pdf.sh b/_build/build-pdf.sh
new file mode 100755
index 0000000..175458e
--- /dev/null
+++ b/_build/build-pdf.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+#
+# this generates A PDF from a HTML file
+
+if [ ! -x _build/build.sh ] ; then
+  echo "ERROR: script must be run in root of docs dir"
+  exit 1
+fi
+
+if [ "$#" -lt 2 ] ; then
+       echo "Usage: build-pdf.sh <source html> <target PDF> [user-style-sheet]"
+       exit 1
+fi
+
+if ! command -v wkhtmltopdf >/dev/null 2>&1; then
+       echo "ERROR: script requires wkhtmltopdf but it's not installed."
+       exit 1
+fi
+       
+# run the PDF build with wkhtmltopdf
+wkhtmltopdf ${3:+--user-style-sheet $3} --page-size Letter --margin-top 0.75in 
--margin-right 0.75in --margin-bottom 0.75in --margin-left 0.75in --encoding 
UTF-8 $1 $2
+
+if [ $? -eq 1 ] ; then
+       echo "Note that ContentNotFoundError is usually because of the invalid 
relational path of a local resource such as an image"
+elif [ $? -eq 0 ] ; then
+       echo "PDF Built successfully."
+else 
+       exit $?
+fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/59216734/_build/build.sh
----------------------------------------------------------------------
diff --git a/_build/build.sh b/_build/build.sh
index 6bc7d45..f7a9848 100755
--- a/_build/build.sh
+++ b/_build/build.sh
@@ -191,12 +191,12 @@ function build_pdf() {
   PDF_STARTED_LOG="_pdf/pdf_gen_started.log"
   
   if [ "$SKIP_PDF_MANUAL" != "true" ]; then
-    _build/buildPDF.sh "_site/zoneMergeManual.html" "_pdf/UserManual.pdf" 2>&1 
| tee $PDF_MANUAL_LOG
-    _build/buildPDF.sh "_site/zoneMergeManual.html" 
"_pdf/UserManual_printable.pdf" "./style/css/printable.css" 2>&1 | tee 
$PDF_MANUAL_LOG
+    _build/build-pdf.sh "_site/zoneMergeManual.html" "_pdf/UserManual.pdf" 
2>&1 | tee $PDF_MANUAL_LOG
+    _build/build-pdf.sh "_site/zoneMergeManual.html" 
"_pdf/UserManual_printable.pdf" "./style/css/printable.css" 2>&1 | tee 
$PDF_MANUAL_LOG
   fi
   if [ "$SKIP_PDF_STARTED" != "true" ]; then
-    _build/buildPDF.sh "_site/zoneMergeStarted.html" "_pdf/GettingStarted.pdf" 
2>&1 | tee $PDF_STARTED_LOG
-    _build/buildPDF.sh "_site/zoneMergeStarted.html" 
"_pdf/GettingStarted_printable.pdf" "./style/css/printable.css" 2>&1 | tee 
$PDF_STARTED_LOG
+    _build/build-pdf.sh "_site/zoneMergeStarted.html" 
"_pdf/GettingStarted.pdf" 2>&1 | tee $PDF_STARTED_LOG
+    _build/build-pdf.sh "_site/zoneMergeStarted.html" 
"_pdf/GettingStarted_printable.pdf" "./style/css/printable.css" 2>&1 | tee 
$PDF_STARTED_LOG
   fi
 }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/59216734/_build/buildPDF.sh
----------------------------------------------------------------------
diff --git a/_build/buildPDF.sh b/_build/buildPDF.sh
deleted file mode 100755
index ad9d95a..0000000
--- a/_build/buildPDF.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-#
-# this generates A PDF from a HTML file
-
-if [ ! -x _build/build.sh ] ; then
-  echo "ERROR: script must be run in root of docs dir"
-  exit 1
-fi
-
-if [ "$#" -lt 2 ] ; then
-       echo "Usage: buildPDF.sh <source html> <target PDF> [user-style-sheet]"
-       exit 1
-fi
-
-if ! command -v wkhtmltopdf >/dev/null 2>&1; then
-       echo "ERROR: script requires wkhtmltopdf but it's not installed."
-       exit 1
-fi
-       
-# run the PDF build with wkhtmltopdf
-if [ -z "$3" ] ; then
-       wkhtmltopdf --page-size Letter --margin-top 0.75in --margin-right 
0.75in --margin-bottom 0.75in --margin-left 0.75in --encoding UTF-8 $1 $2
-else
-       wkhtmltopdf --user-style-sheet $3 --page-size Letter --margin-top 
0.75in --margin-right 0.75in --margin-bottom 0.75in --margin-left 0.75in 
--encoding UTF-8 $1 $2
-fi
-if [ $? -eq 1 ] ; then
-       echo "Note that ContentNotFoundError is usually because of the invalid 
relational path of a local resource such as an image"
-elif [ $? -eq 0 ] ; then
-       echo "PDF Built successfully."
-else 
-       exit $?
-fi
\ No newline at end of file

Reply via email to