From 1d8787bbccd0f220a02215461da3addae871ee73 Mon Sep 17 00:00:00 2001 From: pozil Date: Tue, 20 Jun 2023 15:51:16 +0200 Subject: [PATCH] build: setup scripts --- bin/install-scratch.bat | 40 ++++++++++++++++++++++++++++++++++++++++ bin/install-scratch.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 bin/install-scratch.bat create mode 100755 bin/install-scratch.sh diff --git a/bin/install-scratch.bat b/bin/install-scratch.bat new file mode 100644 index 0000000..8836856 --- /dev/null +++ b/bin/install-scratch.bat @@ -0,0 +1,40 @@ +@echo OFF +cd %CD%/.. + +rem Set parameters +set ORG_ALIAS=dw-recipes + +@echo: +echo Installing DataWeave Apex Recipes scratch org (%ORG_ALIAS%) +@echo: + +rem Install script +echo Cleaning previous scratch org... +cmd.exe /c sf org delete scratch -p -o %ORG_ALIAS% 2>NUL +@echo: + +echo Creating scratch org... +cmd.exe /c sf org create scratch -f config/project-scratch-def.json -a %ORG_ALIAS% -d -y 30 +call :checkForError +@echo: + +echo Pushing source... +cmd.exe /c sf project deploy start +call :checkForError +@echo: + +rem Report install success if no error +@echo: +if ["%errorlevel%"]==["0"] ( + echo Installation completed. +) + +:: ======== FN ====== +GOTO :EOF + +rem Display error if the install has failed +:checkForError +if NOT ["%errorlevel%"]==["0"] ( + echo Installation failed. + exit /b %errorlevel% +) \ No newline at end of file diff --git a/bin/install-scratch.sh b/bin/install-scratch.sh new file mode 100755 index 0000000..7c5f2a9 --- /dev/null +++ b/bin/install-scratch.sh @@ -0,0 +1,35 @@ +#!/bin/bash +SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd $SCRIPT_PATH/.. + +# Set parameters +ORG_ALIAS="dw-recipes" + +echo "" +echo "Installing DataWeave Apex Recipes scratch org ($ORG_ALIAS)" +echo "" + +# Install script +echo "Cleaning previous scratch org..." +sf org delete scratch -p -o $ORG_ALIAS &> /dev/null +echo "" + +echo "Creating scratch org..." && \ +sf org create scratch -f config/project-scratch-def.json -a $ORG_ALIAS -d -y 30 && \ +echo "" && \ + +echo "Pushing source..." && \ +sf project deploy start && \ +echo "" + +EXIT_CODE="$?" +echo "" + +# Check exit code +echo "" +if [ "$EXIT_CODE" -eq 0 ]; then + echo "Installation completed." +else + echo "Installation failed." +fi +exit $EXIT_CODE