From 420ea04dbc1d1f3d5ec6f2910d47e4c4616cdd83 Mon Sep 17 00:00:00 2001 From: Kristen McWilliam <9575627+Merrit@users.noreply.github.com> Date: Mon, 22 Feb 2021 11:42:52 -0500 Subject: [PATCH] Improve linux build script --- packaging/build-linux.sh | 44 +++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/packaging/build-linux.sh b/packaging/build-linux.sh index c60e3a7b..14ff9453 100755 --- a/packaging/build-linux.sh +++ b/packaging/build-linux.sh @@ -1,17 +1,41 @@ #!/bin/bash -function version_check { - echo "Did you update the version number in globals.dart, README, etc?" - while true; do - read -p "$* [y/n]: " yn - case $yn in - [Yy]*) echo "Great! Starting build.."; break;; - [Nn]*) echo "Update version first."; exit;; - esac - done +echo -e "Nyrna build script for Linux \n" + +# Generic callable confirm function. +confirm() { + # call with a prompt string or use a default + read -r -p "${1:-Are you sure? [y/N]} " response + case "$response" in + [yY][eE][sS]|[yY]) + true + ;; + *) + false + ;; + esac } -version_check + +# Confirm tests were run. +if confirm "Did you run tests? [y/N]"; then + echo +else + echo "Run tests first." && exit +fi + + +# Confirm version number has been updated. +if confirm "Did you update version number? [y/N]"; then + echo +else + echo "Update version number first." && exit +fi + + +# Build +echo -e "Starting build.. \n" + cd ..