chore(build): fix update-angular script

This commit is contained in:
Andy Joslin
2014-04-09 09:46:07 -06:00
parent 08da6f753c
commit 41c02f10ed
3 changed files with 17 additions and 11 deletions

View File

@@ -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"
}
}

View File

@@ -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

View File

@@ -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)