#!/bin/sh

# script/setup: Set up application for the first time after cloning, or set it
# back to the initial first unused state.

set -e

if [ ! -f ".env" ]; then
  echo "==> Creating .env file"
  cp .env-example .env
fi

if [ "$1" == "docker" ]; then
  script/bootstrap docker
  docker-compose up
else
  cd "$(dirname "$0")/.."

  script/bootstrap

  echo "==> Setting up database..."
  bin/hanami db setup

  echo "==> App is now ready to go!"
fi
