Skip to content

Commit f500bb0

Browse files
committed
Improve script for Ubuntu
1 parent 7c79cc3 commit f500bb0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/update-bower-version.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,17 @@ set -e
99

1010
echo "diff2html updating bower version..."
1111

12-
RELEASE_VERSION=$(cat package.json | grep "version" | head -1 | gsed -e 's/ "version": "\(.*\)",/\1/')
12+
if [[ "$OSTYPE" == "linux-gnu" ]]; then
13+
SED_BIN=sed
14+
elif [[ "$OSTYPE" == "darwin"* ]]; then
15+
SED_BIN=gsed
16+
else
17+
echo "Cannot run this script in ${OSTYPE}"
18+
exit 1
19+
fi
1320

14-
gsed -i 's/.*"version".*/ "version": "'${RELEASE_VERSION}'",/' bower.json
21+
RELEASE_VERSION=$(cat package.json | grep "version" | head -1 | $SED_BIN -e 's/ "version": "\(.*\)",/\1/')
22+
23+
$SED_BIN -i 's/.*"version".*/ "version": "'${RELEASE_VERSION}'",/' bower.json
1524

1625
echo "diff2html updated bower version successfully!"

0 commit comments

Comments
 (0)