Improved script files
This commit is contained in:
parent
c05d39b4a4
commit
69d2702081
6 changed files with 32 additions and 32 deletions
|
@ -5,8 +5,8 @@ source "${BASEDIR}/resolve_commands.sh"
|
|||
cd "$BASEDIR/../"
|
||||
|
||||
function generate_link() {
|
||||
if [ ! -L $2 ] || [ "${BASH_ARGV[0]}" == "force" ]; then
|
||||
if [ -e $2 ] || [ -L $2 ]; then
|
||||
if [[ ! -L $2 ]] || [[ "${BASH_ARGV[0]}" == "force" ]]; then
|
||||
if [[ -e $2 ]] || [[ -L $2 ]]; then
|
||||
rm $2
|
||||
fi
|
||||
ln -rs $1 $2
|
||||
|
@ -42,9 +42,9 @@ echo "Generated shared declarations"
|
|||
|
||||
#Now build the merged declaration for the shared project
|
||||
#Link the declaration files (All interface declarations should be equal!)
|
||||
if [ ! -d shared/declarations ]; then
|
||||
if [[ ! -d shared/declarations ]]; then
|
||||
mkdir shared/declarations
|
||||
if [ $? -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to create directory shared/declarations"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -8,26 +8,26 @@ TMP_DIR_NAME="tmp"
|
|||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR/../"
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
if [[ "$#" -ne 3 ]]; then
|
||||
echo "Illegal number of parameters (url | channel | required version)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d client-api/environment/ui-files/ ]; then
|
||||
if [[ ! -d client&&pi/environment/ui-files/ ]]; then
|
||||
echo "Missing UI Files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${teaclient_deploy_secret}" == "" ]; then
|
||||
if [[ "${teaclient_deploy_secret}" == "" ]]; then
|
||||
echo "Missing deploy secret!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e "${TMP_FILE_NAME}" ]; then
|
||||
if [[ -e "${TMP_FILE_NAME}" ]]; then
|
||||
echo "Temp file already exists!"
|
||||
echo "Deleting it!"
|
||||
rm ${TMP_FILE_NAME}
|
||||
if [ $? -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to delete file"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -39,9 +39,9 @@ echo "Git hash ${GIT_HASH} on version ${APPLICATION_VERSION} on channel $2"
|
|||
|
||||
#Packaging the app
|
||||
cd client-api/environment/ui-files/
|
||||
if [ -e ${TMP_DIR_NAME} ]; then
|
||||
if [[ -e ${TMP_DIR_NAME} ]]; then
|
||||
rm -r ${TMP_DIR_NAME}
|
||||
if [ $? -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to remove temporary directory!"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -52,7 +52,7 @@ for file in $(find ${TMP_DIR_NAME} -name '*.php'); do
|
|||
echo "Evaluating php file $file"
|
||||
RESULT=$(php "${file}" 2> /dev/null)
|
||||
CODE=$?
|
||||
if [ ${CODE} -ne 0 ]; then
|
||||
if [[ ${CODE} -ne 0 ]]; then
|
||||
echo "Failed to evaluate php file $file!"
|
||||
echo "Return code $CODE"
|
||||
exit 1
|
||||
|
@ -63,7 +63,7 @@ done
|
|||
|
||||
cd ${TMP_DIR_NAME}
|
||||
tar chvzf ${TMP_FILE_NAME} *
|
||||
if [ $? -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to pack file"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -87,9 +87,9 @@ RESP=$(curl \
|
|||
echo "$RESP"
|
||||
SUCCESS=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['success'])")
|
||||
|
||||
if [ ! "${SUCCESS}" == "True" ]; then
|
||||
if [[ ! "${SUCCESS}" == "True" ]]; then
|
||||
ERROR=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['error'])" 2>/dev/null)
|
||||
if [ $? -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]]; then
|
||||
ERROR=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['msg'])" 2>/dev/null)
|
||||
fi
|
||||
echo "Failed to deploy build!"
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
response=$(git diff-index HEAD -- . ':!asm/libraries/' ':!package-lock.json' ':!vendor/')
|
||||
if [ "$response" != "" ]; then
|
||||
if [ "$1" == "sort-tag" ]; then
|
||||
if [[ "$response" != "" ]]; then
|
||||
if [[ "$1" == "sort-tag" ]]; then
|
||||
echo "0000000"
|
||||
fi
|
||||
if [ "$1" == "name" ]; then
|
||||
if [[ "$1" == "name" ]]; then
|
||||
echo "custom build"
|
||||
fi
|
||||
if [ "$1" == "file-name" ]; then
|
||||
if [[ "$1" == "file-name" ]]; then
|
||||
echo "custom"
|
||||
fi
|
||||
exit 1
|
||||
else
|
||||
if [ "$1" == "sort-tag" ]; then
|
||||
if [[ "$1" == "sort-tag" ]]; then
|
||||
echo "$(git rev-parse --short HEAD)"
|
||||
fi
|
||||
if [ "$1" == "name" ]; then
|
||||
if [[ "$1" == "name" ]]; then
|
||||
echo "$(git rev-parse --short HEAD)"
|
||||
fi
|
||||
if [ "$1" == "file-name" ]; then
|
||||
if [[ "$1" == "file-name" ]]; then
|
||||
echo "$(git rev-parse --short HEAD)"
|
||||
fi
|
||||
exit 0
|
||||
|
|
|
@ -13,11 +13,11 @@ function execute_npm_command() {
|
|||
command_variable="command_$command_name"
|
||||
#echo "Variable names $command_variable"
|
||||
|
||||
if [ "${!command_variable}" == "" ]; then
|
||||
if [[ "${!command_variable}" == "" ]]; then
|
||||
node_bin=$(npm bin)
|
||||
#echo "Node root ${node_bin}"
|
||||
|
||||
if [ ! -e "${node_bin}/${command_name}" ]; then
|
||||
if [[ ! -e "${node_bin}/${command_name}" ]]; then
|
||||
echo "Could not find \"$command_name\" command"
|
||||
echo "May type npm install"
|
||||
exit 1
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source `dirname $0`/resolve_commands.sh
|
||||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR/../"
|
||||
source ./scripts/resolve_commands.sh
|
||||
|
||||
if [[ "$1" == "development" ]] || [[ "$1" == "dev" ]]; then
|
||||
source_path="web/environment/development"
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR/../"
|
||||
|
||||
if [ "$1" == "development" ] || [ "$1" == "dev" ]; then
|
||||
if [[ "$1" == "development" ]] || [[ "$1" == "dev" ]]; then
|
||||
source_path="web/environment/development"
|
||||
type="development"
|
||||
elif [ "$1" == "release" ] || [ "$1" == "rel" ]; then
|
||||
elif [[ "$1" == "release" ]] || [[ "$1" == "rel" ]]; then
|
||||
source_path="web/environment/release"
|
||||
type="release"
|
||||
else
|
||||
if [ $# -lt 1 ]; then
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Invalid argument count!"
|
||||
else
|
||||
echo "Invalid option $1"
|
||||
|
@ -19,14 +19,14 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$source_path" ]; then
|
||||
if [[ ! -d "$source_path" ]]; then
|
||||
echo "Could not find environment! ($source_path)"
|
||||
echo "Please generate it first!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
response=$(git diff-index HEAD -- . ':!asm/libraries/' ':!package-lock.json' ':!vendor/')
|
||||
if [ "$response" != "" ]; then
|
||||
if [[ "$response" != "" ]]; then
|
||||
echo "You're using a private modified build!"
|
||||
echo "Cant assign git hash!"
|
||||
NAME="TeaWeb.zip"
|
||||
|
@ -34,7 +34,7 @@ else
|
|||
NAME="TeaWeb-$(git rev-parse --short HEAD).zip"
|
||||
fi
|
||||
|
||||
if [ -e ${NAME} ]; then
|
||||
if [[ -e ${NAME} ]]; then
|
||||
echo "Found old file. Deleting it."
|
||||
rm -r ${NAME}
|
||||
fi
|
||||
|
@ -43,7 +43,7 @@ current_path=$(pwd)
|
|||
cd "$source_path"
|
||||
zip -9 -r ${NAME} *
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to package environment!"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue