From 9c3defc56ad028b71265985def42ab09dd4004d4 Mon Sep 17 00:00:00 2001 From: Andrei Markin Date: Fri, 24 Nov 2023 19:01:59 +0400 Subject: [PATCH] Improve identifying min gaarf version need for ARP Change-Id: I8224c85ca30a90a3492aab8eba100ed9b8b92ea1 --- app/scripts/shell_utils/functions.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/app/scripts/shell_utils/functions.sh b/app/scripts/shell_utils/functions.sh index b27517d..b46378d 100644 --- a/app/scripts/shell_utils/functions.sh +++ b/app/scripts/shell_utils/functions.sh @@ -98,7 +98,7 @@ prompt_running() { fi } -parse_yaml () { +parse_yaml() { local yaml_file="$1" local prefix="$2" while read line; do @@ -118,17 +118,26 @@ check_gaarf_version() { minor_version="${version_array[1]}" patch_version="${version_array[2]}" - if [[ $major_version -ge 1 && $minor_version -ge 11 && $patch_version -ge 5 ]]; then - echo "google-ads-api-report-fetcher is up-to-date" - else - echo "You are using an old version of google-ads-api-report-fetcher library" - echo "Please update it by running the following command:" - echo -e "${COLOR}pip install -U google-ads-api-report-fetcher${NC}" - exit 1 + if [[ $major_version -lt 1 ]]; then + require_newer_gaarf + fi + if [[ $minor_version -lt 11 ]]; then + require_newer_gaarf + fi + if [[ $minor_version -eq 11 && $patch_version < 5 ]]; then + require_newer_gaarf fi + echo "google-ads-api-report-fetcher is up-to-date" fi } +require_newer_gaarf() { + echo "You are using an old version of google-ads-api-report-fetcher library" + echo "Please update it by running the following command:" + echo -e "${COLOR}pip install -U google-ads-api-report-fetcher${NC}" + exit 1 +} + infer_answer_from_config() { config=$1 section=$2