[CORD-3176]

Have API docs generation die if virtualenv not installed

Change-Id: Ia2f5890b5659aec5049368c162635e52fbd68b67
diff --git a/docs/Makefile b/docs/Makefile
index 536170d..08c6179 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -3,11 +3,13 @@
 swagger: swagger_clean swagger_docs swagger_serve_spec
 
 venv-xosdocs:
-	bash venv-xosdocs.sh
+	./venv-xosdocs.sh
 
 swagger_docs: venv-xosdocs
 	bash -c 'source $(DOCSDIR)venv-xosdocs/bin/activate && python $(DOCSDIR)scripts/swagger_docs.py'
 
+clean: swagger_clean venv_clean
+
 swagger_clean:
 	rm -rf swagger/specs/*
 
diff --git a/docs/venv-xosdocs.sh b/docs/venv-xosdocs.sh
index 963b1d8..74bc278 100755
--- a/docs/venv-xosdocs.sh
+++ b/docs/venv-xosdocs.sh
@@ -14,24 +14,25 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+set -e -o pipefail
+
 BASEDIR=$(pwd)
 VENVDIR=venv-xosdocs
 
 # create venv if it's not yet there
 if [ ! -d "$BASEDIR/$VENVDIR" ]; then
-    echo "Setting up virtualenv for XOS Swagger Docs"
-    virtualenv -q $BASEDIR/$VENVDIR --no-site-packages
-    pip install --upgrade pip
-    echo "Virtualenv created."
+  echo "Setting up virtualenv for XOS Swagger Docs"
+  virtualenv -q $BASEDIR/$VENVDIR --no-site-packages
+  pip install --upgrade pip
+  echo "Virtualenv created."
 fi
 
 # activate the virtual env
 if [ ! $VIRTUAL_ENV ]; then
-    source $BASEDIR/$VENVDIR/bin/activate
-    echo "Virtualenv activated."
+  source $BASEDIR/$VENVDIR/bin/activate
+  echo "Virtualenv activated."
 fi
 
 # install pip packages
 pip install -e $BASEDIR/$VENVDIR/../../lib/xos-genx
 pip install plyxproto jinja2 pattern astunparse pyyaml colorama
-