#!/usr/bin/env bash
#
# Assembler
#

# Parameters
BASENAME="`basename $0 | sed -e 's/\(.\)/\U\1/'`"
DIRNAME="`dirname $0`"
BASEDIR="$DIRNAME/.."
SITE="site"
BOOK="book"
NOTEBOOK="notebook"
BUILD="build"

# Cleanup the previous build folder
rm -rf $BUILD

# Check if there's a site folder
if [ -e "$SITE" ]; then
  cp -a $SITE $BUILD

  if [ -e "$BOOK" ]; then
    mv $BOOK $BUILD/book
  fi
else
  if [ -e "$BOOK" ]; then
    mv $BOOK $BUILD
  fi
fi

# Check if there's a notebook
if [ -e "$NOTEBOOK" ]; then
  mv $NOTEBOOK $BUILD/notes
fi