WORK_DIR=`pwd`

# If we're running in dexy, take us to the project top-level.
if [[ "$WORK_DIR" == *.dexy* ]]
then
  until [ "$(basename $WORK_DIR)" == ".dexy" ]
  do
    WORK_DIR=$(dirname $WORK_DIR)
  done
fi

cd $(dirname $WORK_DIR)

sbt "project lift-documentation-helpers" \
    "run-main net.liftweb.documentation.ExtractCssSelectorExamples"

WORK_DIR=`pwd`
HTML_DIR="$WORK_DIR"

if [[ ! -z "$DEXY_ROOT" ]]
then
  cd $DEXY_ROOT

  until [ "$(basename $HTML_DIR)" == "docs" ]
  do
    HTML_DIR=$(dirname $HTML_DIR)
  done
fi

sbt -Dsbt.log.noformat=true "project lift-documentation-helpers" \
    "run-main net.liftweb.documentation.ExtractCssSelectorExamples \"$HTML_DIR\""

Fix dexy invocation of selector example extractor.
Fix dexy invocation of selector example extractor.

We now want to be passed the directory that the built HTML
is in, and we also have to compute it.

Additionally, we make use of the DEXY_ROOT environment
variable that dexy sets for us to know the project’s root
directory for proper invocation of sbt (we were computing this
in a somewhat brittle way before).
