]> Shamusworld >> Repos - ardour-manual-diverged/commitdiff
Updated the doit bash script to create folders and optionnally copy the resulting...
authorEd Ward <edwsaintesprit@hotmail.com>
Tue, 10 Jan 2017 08:45:01 +0000 (09:45 +0100)
committerEd Ward <edwsaintesprit@hotmail.com>
Tue, 10 Jan 2017 08:45:01 +0000 (09:45 +0100)
doit

diff --git a/doit b/doit
index a4860052d75596e658196f91503cb5b674fe500b..b441d3996c145bcb23145a02f15bdaf02c0a4a1f 100755 (executable)
--- a/doit
+++ b/doit
@@ -3,7 +3,37 @@
 # Simple shell script to do all the steps that need doing
 #
 
+# if a parameter exists, that's where the website is copied after generation
+if [ -n "$1" ]
+then
+  DIRHTML=$(echo "$1"|sed 's/\/$//g'); #strips the trailing slash if need be
+else
+  DIRHTML="";
+fi
+
+# create the required folders if need be, or empties them
+if [ ! -d "_site" ]; then
+  mkdir _site
+else
+       rm -rf _site/*
+fi
+
+if [ ! -d "_manual" ]; then
+  mkdir _manual
+else
+  rm -rf _manual/*
+fi
+
 rm -rf _build/* && \
 ./munge && \
-./build.rb
+ruby2.2 ./build.rb 
+chmod -R a+rx _site
+
+# if a target directory exists, copy the site there
+if [ ! -z "$DIRHTML" ]
+then
+  rm -rf "$DIRHTML/*"
+  cp -R _site/* "$DIRHTML/"
+fi
+