From 41c02f10ed4c09830fd4eeb5ca0d2d73625024c0 Mon Sep 17 00:00:00 2001 From: Andy Joslin Date: Wed, 9 Apr 2014 09:46:07 -0600 Subject: [PATCH] chore(build): fix update-angular script --- bower.json | 6 +++--- scripts/update-angular.sh | 19 +++++++++++++------ scripts/utils.inc | 3 +-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/bower.json b/bower.json index 36c0c6f39b..6029cb2a8e 100644 --- a/bower.json +++ b/bower.json @@ -48,9 +48,9 @@ "js/ionic.js" ], "dependencies": { - "angular": "^1.2.12", - "angular-animate": "^1.2.12", - "angular-sanitize": "^1.2.12", + "angular": "~1.2.12", + "angular-animate": "~1.2.12", + "angular-sanitize": "~1.2.12", "angular-ui-router": "0.2.7" } } diff --git a/scripts/update-angular.sh b/scripts/update-angular.sh index df5f964b23..549b7dd0f0 100755 --- a/scripts/update-angular.sh +++ b/scripts/update-angular.sh @@ -4,16 +4,23 @@ ARG_DEFS=( "--version=(.*)" ) function run { + PROJECT_DIR=$SCRIPT_DIR/../ - cd $SCRIPT_DIR/..//config/lib/js/angular/ + cd $SCRIPT_DIR/../config/lib/js/angular/ rm -rf *.js - wget http://code.angularjs.org/$VERSION/angular{,-animate,-mocks,-resource,-scenario,-animate.min,-resource.min,.min,-sanitize,-sanitize.min}.js - cd $SCRIPT_DIR/../ + wget http://code.angularjs.org/$VERSION/angular{,-sanitize,-animate,-resource}{.min.js,.js} - replaceJsonProp "bower.json" "angular" $VERSION - replaceJsonProp "bower.json" "angular-animate" $VERSION - replaceJsonProp "bower.json" "angular-sanitize" $VERSION + # # no min versions of mocks and scenario + wget http://code.angularjs.org/$VERSION/angular{-scenario,-mocks}.js + + cd $PROJECT_DIR + + echo "Setting bower.json angular versions to ~$VERSION" + + replaceJsonProp "bower.json" "angular" "~$VERSION" + replaceJsonProp "bower.json" "angular-animate" "~$VERSION" + replaceJsonProp "bower.json" "angular-sanitize" "~$VERSION" } source $(dirname $0)/utils.inc diff --git a/scripts/utils.inc b/scripts/utils.inc index 1728839e93..97a5f1bdc5 100644 --- a/scripts/utils.inc +++ b/scripts/utils.inc @@ -206,8 +206,7 @@ function readJsonProp { # - note: propertyRegex will be automatically placed into a # capturing group! -> all other groups start at index 2! function replaceJsonProp { - local VALUE=$(readJsonProp $1 $2) - replaceInFile $1 $VALUE $3 + replaceInFile $1 "\"$2\": \".*?\"" "\"$2\": \"$3\"" } # replaceInFile(file, findPattern, replacePattern)