Update site script and remove %site symbolic link

Refactored and cleaned up site build script. Use cabal to run executable
instead of through the link %site. Added options for running
cabal commands clean, configure, and build via options clear, configure,
and make respectively. These different names were used as to not reuse
ones already in use by the hakyll generated site binary.

Update deploy code in src/site.hs as there is no need to remove empty
files anymore as they are no longer generated.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
Collin J. Doering 2015-08-15 05:43:50 -04:00
parent 98d564f061
commit 5719cc5dc9
3 changed files with 34 additions and 23 deletions

1
%site
View File

@ -1 +0,0 @@
dist/build/blog-rekahsoft-ca/blog-rekahsoft-ca

52
site
View File

@ -1,23 +1,37 @@
#!/bin/bash
if [ "$1" == "test" ]; then
if [ "$2" == "-s" ] || [ "$2" == "--run-selenium" ]; then
if ! type selenium &> /dev/null; then
echo "Failed to run Selenium. It must not be installed or not accessible on \$PATH!"
exit 1
CABAL="/usr/bin/cabal"
CONFIGURE_SITE="configure --enable-tests"
BUILD_SITE="build"
RUN_SITE="run --verbose=0 blog-rekahsoft-ca"
TEST_SITE="test --show-details=always --test-option=--color"
case "$1" in
test)
if [ "$2" == "-s" ] || [ "$2" == "--run-selenium" ]; then
if ! type selenium &> /dev/null; then
echo "Failed to run Selenium. It must not be installed or not accessible on \$PATH!"
exit 1
fi
echo "Running Selenium..."
selenium 2> /dev/null &
sleep 3s
fi
echo "Running Selenium..."
selenium 2> /dev/null &
sleep 3s
fi
# Remove empty files under directory _site
echo "Removing empty files..."
find _site -type f -empty -exec rm -v {} \;
# Test site
cabal test --show-details=always --test-option=--color
else
exec "./%site" "$@"
fi
# Test site
$CABAL $TEST_SITE
;;
clear)
$CABAL clean
;;
configure)
$CABAL $CONFIGURE_SITE
;;
make)
$CABAL $BUILD_SITE
;;
*)
$CABAL $RUN_SITE "--" "$@"
;;
esac

View File

@ -91,9 +91,7 @@ pandocWriterOptions = defaultHakyllWriterOptions
myConfig :: Configuration
myConfig = defaultConfiguration
{ deployCommand = "echo 'Removing empty files...' && " ++
"find _site -type f -empty -exec rm -v {} \\; && " ++
"echo '\nDeploying website...' && " ++
{ deployCommand = "echo '\nDeploying website...' && " ++
"rsync -rpogtzcv --delete -e ssh _site/ collin@rekahsoft.ca:~/public_html/blog/"
, previewPort = 3000
}