From 40abb405e96d5d4da44a1b97dd991641259f6198 Mon Sep 17 00:00:00 2001 From: MetaPrime Date: Tue, 9 May 2017 11:59:16 -0700 Subject: [PATCH] Improve deployment script (add file hash as sanity check). --- deploy.bat | 2 +- deploy.ps1 | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 deploy.ps1 diff --git a/deploy.bat b/deploy.bat index acf93888..388ece44 100644 --- a/deploy.bat +++ b/deploy.bat @@ -1,2 +1,2 @@ @echo off -xcopy /s/e/y target\*.jar %~dp0\ripme.jar \ No newline at end of file +powershell -c ".\deploy.ps1 -source (Join-Path target (Get-Item -Path .\target\* -Filter *.jar)[0].Name) -dest ripme.jar" diff --git a/deploy.ps1 b/deploy.ps1 new file mode 100644 index 00000000..9124c241 --- /dev/null +++ b/deploy.ps1 @@ -0,0 +1,16 @@ +Param ( + [Parameter(Mandatory=$True)] + [string]$source, + [Parameter(Mandatory=$True)] + [string]$dest +) + +Copy-Item -Path $source -Destination $dest + +$sourceHash = (Get-FileHash $source -algorithm MD5).Hash +$destHash = (Get-FileHash $dest -algorithm MD5).Hash +if ($sourceHash -eq $destHash) { + Write-Output 'Deployed successfully.' +} else { + Write-Output 'Hash Mismatch: did you close ripme before deploying?' +}