#!/bin/sh

set -e

if [ ! -d "./revealjs" ]; then
   git clone https://github.com/hakimel/reveal.js.git revealjs
fi

cd revealjs

# Get version 2.4.0 
git checkout master
git pull
git checkout 2.4.0
VERSION=`git rev-parse HEAD`

# record the version
echo "$VERSION" > ../revealjs-version

# copy files
TARGET_DIR=../../session/resources/presentation/revealjs
mkdir -p $TARGET_DIR
mkdir -p $TARGET_DIR/css/theme
mkdir -p $TARGET_DIR/css/print
mkdir -p $TARGET_DIR/js
mkdir -p $TARGET_DIR/lib/js

cp LICENSE $TARGET_DIR/LICENSE
cp css/reveal.css $TARGET_DIR/css
cp css/reveal.min.css $TARGET_DIR/css
cp css/theme/simple.css $TARGET_DIR/css/theme
cp css/print/*.css $TARGET_DIR/css/print
cp lib/js/*.js $TARGET_DIR/lib/js
cp js/reveal.js $TARGET_DIR/js
cp js/reveal.min.js $TARGET_DIR/js

# return to tools dir
cd ..
