From 41d5efeeecaa48b8fc08b83ec45efaabcf1ca48c Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Wed, 12 Sep 2018 09:09:49 -0700 Subject: [PATCH] chmod script Summary: Fixes chmod and mac os script error and also tests if jq is installed Reviewed By: passy Differential Revision: D9789391 fbshipit-source-id: 11319539d4f511294f216860497bf0e67ee1af08 --- scripts/bump-version.sh | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) mode change 100644 => 100755 scripts/bump-version.sh diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh old mode 100644 new mode 100755 index 9554fb0d2..10d5fb996 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -6,14 +6,17 @@ case "$(uname)" in Darwin*) darwin=true ;; esac -if $darwin; then - sedi="sed -i ''" -else - sedi="sed -i" +if ! jq --version > /dev/null; then + echo -e "jq is not installed! Should the script install it for you? (y/n) \\c" + read -r REPLY + if [ "$REPLY" = "y" ]; then + brew install jq + else + exit 1 + fi fi -echo "Checking for any uncommited changes..." - +echo "Checking for any uncommitted changes..." CHANGES=$(hg st) echo "$CHANGES" @@ -42,12 +45,19 @@ echo "Updating version $VERSION in podspecs, podfiles and in getting started doc # Update Podspec files and podfiles with correct version echo "Updating $SONARKIT_PODSPEC_PATH" -$sedi "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONARKIT_PODSPEC_PATH" +if $darwin; then +sed -i '' "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONARKIT_PODSPEC_PATH" echo "Updating $SONAR_PODSPEC_PATH" -$sedi "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONAR_PODSPEC_PATH" +sed -i '' "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONAR_PODSPEC_PATH" echo "Updating $SONAR_GETTING_STARTED_DOC" -$sedi "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONAR_GETTING_STARTED_DOC" - +sed -i '' "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONAR_GETTING_STARTED_DOC" +else + sed -i "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONARKIT_PODSPEC_PATH" + echo "Updating $SONAR_PODSPEC_PATH" + sed -i "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONAR_PODSPEC_PATH" + echo "Updating $SONAR_GETTING_STARTED_DOC" + sed -i "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/" "$SONAR_GETTING_STARTED_DOC" +fi # Copy Podfiles mkdir "$SPECS_DIR/SonarKit/$VERSION" # New Specs dir for SonarKit podspec mkdir "$SPECS_DIR/Sonar/$VERSION" # New Specs dir for Sonar podspec