From 558c52b95587b3d5f601091c7448e45f6a939877 Mon Sep 17 00:00:00 2001 From: kridai Date: Tue, 8 Feb 2022 13:17:44 +0530 Subject: [PATCH] feat: support different versions for brew install (#29) * chore: updated update-formula script --- .github/scripts/update-formula.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/scripts/update-formula.sh b/.github/scripts/update-formula.sh index 048abed..4e0c4ea 100644 --- a/.github/scripts/update-formula.sh +++ b/.github/scripts/update-formula.sh @@ -5,6 +5,14 @@ sha=$3 if [ "$version" == '' ] || [ "$sha" == '' ]; then exit fi +#fetch the current version +current_version=$(grep -w "version " Formula/$formula.rb | awk '{print $2}' | tr -d \") +echo "Current version $current_version" +if [ "$version" != "$current_version" ]; then + cp Formula/$formula.rb Formula/$formula@$current_version.rb + class_name=$(echo $formula | sed -e "s/\b./\u&/g")AT$(echo $current_version | tr -dc '[:alnum:]\n\r' | sed 's/[[:alpha:]]/\U&/') + sed -i.bak "s/^class [^ ]*/class $class_name/" Formula/$formula@$current_version.rb +fi formula_path="Formula/$formula.rb" sed -E -i.bak "s/twilio-v$version_pattern/twilio-v$version/g" "$formula_path" sed -i.bak "s/version .*/version \"$version\"/" "$formula_path"