From 4327e85796e343961fa105673a813db091813f8c Mon Sep 17 00:00:00 2001 From: Emily Eisenberg Date: Fri, 6 Jan 2017 19:32:22 -0800 Subject: [PATCH] Make the release script compatible with both mac and linux Curse you BSD and GNU sed being so different! Test Plan: - Run `sed -i.bak -e 's|boo|blah|' blah` on both a linux and mac computer @kevinb --- release.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/release.sh b/release.sh index 53ed43e..d4979bb 100755 --- a/release.sh +++ b/release.sh @@ -35,9 +35,12 @@ git checkout --detach make setup dist git add dist/ -# Edit package.json and bower.json to the right version -sed -i "" -E 's|"version": "[^"]+",|"version": "'$VERSION'",|' package.json -sed -i "" -E 's|"version": "[^"]+",|"version": "'$VERSION'",|' bower.json +# Edit package.json and bower.json to the right version (see +# http://stackoverflow.com/a/22084103 for why we need the .bak file to make +# this mac & linux compatible) +sed -i.bak 's|"version": "[^"]+",|"version": "'$VERSION'",|' package.json +sed -i.bak -E 's|"version": "[^"]+",|"version": "'$VERSION'",|' bower.json +rm -f package.json.bak bower.json.bak # Make the commit and tag, and push them. git add package.json bower.json @@ -53,8 +56,9 @@ if [ ! -z "$NEXT_VERSION" ]; then git checkout master # Edit package.json and bower.json to the right version - sed -i "" -E 's|"version": "[^"]+",|"version": "'$NEXT_VERSION'-pre",|' package.json - sed -i "" -E 's|"version": "[^"]+",|"version": "'$NEXT_VERSION'-pre",|' bower.json + sed -i.bak -e 's|"version": "[^"]+",|"version": "'$NEXT_VERSION'-pre",|' package.json + sed -i.bak -e 's|"version": "[^"]+",|"version": "'$NEXT_VERSION'-pre",|' bower.json + rm -f package.json.bak bower.json.bak git add package.json bower.json git commit -n -m "Bump master to v$NEXT_VERSION-pre"