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

View File

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