#!/bin/bash -e

RTFMd_BASE_PATH="/"
RTFMd_WIKI=$(pwd)

export RTFMd_WIKI RTFMd_BASE_PATH

if [[ -n $1 ]]; then
  RTFMd_WIKI=$1; shift
fi

if [[ -n $1 ]]; then
  RTFMd_BASE_PATH=$1; shift
fi

bundle check 2>&- || { bundle install --local && bundle check; }
exec bundle exec thin start -R config/rtfmd.ru
