Wrap site tool to allow testing option
Instead of having a symbolic link from ./site to the executable in dist/build/blog-rekahsoft-ca/blog-rekahsoft-ca, a separate test running script ./site-test and a Makefile (which is redundant), have a single shell script that wraps the blog-rekahsoft-ca executable and adds a test option along with a switch to start selenium (-s|--run-selenium). Updated README accordingly and removed unnecessary Makefile, and site-test. Moved the symbolic link ./site to ./%site. Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
parent
1bc0beefab
commit
026237b911
33
Makefile
33
Makefile
|
@ -1,33 +0,0 @@
|
||||||
# Makefile for blog-rekahsoft-ca
|
|
||||||
|
|
||||||
.PHONY: all configure clean build site deploy preDeploy test server
|
|
||||||
|
|
||||||
all: clean build test
|
|
||||||
|
|
||||||
configure:
|
|
||||||
cabal configure --enable-tests
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -Rf _site _cache
|
|
||||||
cabal clean
|
|
||||||
|
|
||||||
build: configure
|
|
||||||
cabal build
|
|
||||||
|
|
||||||
site: build
|
|
||||||
./site rebuild
|
|
||||||
|
|
||||||
deploy: site preDeploy test
|
|
||||||
@echo "Deploying website..."
|
|
||||||
@rsync -rpogtzcv --delete -e ssh _site/ collin@rekahsoft.ca:~/public_html/blog/
|
|
||||||
|
|
||||||
preDeploy: _site
|
|
||||||
@echo "Removing empty files..."
|
|
||||||
@find _site -type f -empty -exec rm -v {} \;
|
|
||||||
@echo "\n"
|
|
||||||
|
|
||||||
test: site preDeploy
|
|
||||||
cabal test --show-details=always --test-option=--color
|
|
||||||
|
|
||||||
server: build site
|
|
||||||
./site server
|
|
|
@ -60,8 +60,11 @@ To the run the tests that accompany this site, one must have [Selenium][] instal
|
||||||
instances running on port 4444. Then one must run the following:`
|
instances running on port 4444. Then one must run the following:`
|
||||||
|
|
||||||
$ cabal configure --enable-tests
|
$ cabal configure --enable-tests
|
||||||
$ cabal install --only-dependencies
|
$ cabal install --enable-tests --only-dependencies
|
||||||
$ cabal test
|
$ ./site test -s
|
||||||
|
|
||||||
|
The `-s` or `--run-selenium` option to `site test` starts a selenium server before running the
|
||||||
|
tests. Another way to run the tests is using cabal directly by running `cabal test`.
|
||||||
|
|
||||||
## Issues <a name="issues"></a>
|
## Issues <a name="issues"></a>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/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
|
||||||
|
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
|
Loading…
Reference in New Issue