Skip to content

Instantly share code, notes, and snippets.

@isyufu
Created October 4, 2016 01:59
Show Gist options
  • Save isyufu/376497d32e67fc600c5e213dbc7dd519 to your computer and use it in GitHub Desktop.
Save isyufu/376497d32e67fc600c5e213dbc7dd519 to your computer and use it in GitHub Desktop.
sbt task execute bash script, webdav upload, curl, xmllint
lazy val publishUpdate = taskKey[Unit]("Publish update files to webdavserv/dir/dir/version")
publishUpdate := {
val puf = new File("publishUpdate.sh").getCanonicalPath+" "+version.value
puf !
}
#!/usr/bin/env bash
rm target/resources.zip
cd ../dir
zip -r ../dir/target/resources.zip resources
cd ../dir/target
ver=$1
url="http://user:pswrd@webdavsrv/dir/dir/$ver"
url1="$url/resources.zip"
url2="$url/reggy.jar"
curl -v -T resources.zip "$url1"
out1=$(curl -X PROPFIND $url1)
echo ""
xmllint --xpath "//*[local-name()='href']" - <<<"$out1"; echo ""
xmllint --xpath "//*[local-name()='creationdate']" - <<<"$out1"; echo ""
xmllint --xpath "//*[local-name()='getlastmodified']" - <<<"$out1"; echo ""
xmllint --xpath "//*[local-name()='getcontentlength']" - <<<"$out1"; echo ""
curl -v -T reggy.jar "$url2"
out2=$(curl -X PROPFIND $url2)
echo ""
xmllint --xpath "//*[local-name()='href']" - <<<"$out2"; echo ""
xmllint --xpath "//*[local-name()='creationdate']" - <<<"$out2"; echo ""
xmllint --xpath "//*[local-name()='getlastmodified']" - <<<"$out2"; echo ""
xmllint --xpath "//*[local-name()='getcontentlength']" - <<<"$out2"; echo ""
echo ""
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment