#!/bin/bash

working_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# curl and php are required
if [ "$( which curl )" == "" ] || [ "$( which php )" == "" ]; then
    echo "curl and php are required!"
    exit 1
fi

cd ${working_dir}
generator="couscous.phar"

# download the generator if it's not already downloaded
if [ ! -f ${generator} ]; then
    curl -OS http://couscous.io/${generator}
fi

# run the preview
php ${generator} preview
