#!/usr/bin/fish
# Aim at deploying on local httpd server

# Check existence of deployment target
if not set -q WEBLAND_WEB_DEPLOY_PATH
	exit 1
end

set destinationPath $WEBLAND_WEB_DEPLOY_PATH

if not test -e $destinationPath
	exit 2
end

# Check existence of source
if not set gitTopLevel (git rev-parse --show-toplevel)
	exit 3
end

set sourcePath $gitTopLevel/web/

if not test -e $sourcePath
	exit 4
end

# Deploy
rsync --perms --recursive --verbose --delete-after $sourcePath $destinationPath

exit 0