@@ -11,8 +11,12 @@ ARG_DEFS=(
1111)
1212
1313function init {
14- TMP_DIR=$( resolveDir ../../tmp)
14+ BASE_DIR=$( resolveDir ../..)
15+ TMP_DIR=$BASE_DIR /tmp
1516 REPO_DIR=$TMP_DIR /angularjs.org
17+ BRANCH_PATTERN=$( readJsonProp " $BASE_DIR /package.json" " branchVersion" )
18+ BUILD_DIR=$BASE_DIR /build
19+ NEW_VERSION=$( cat $BUILD_DIR /version.txt)
1620}
1721
1822function prepare {
@@ -24,18 +28,24 @@ function prepare {
2428 #
2529 echo " -- Updating angularjs.org"
2630 cd $REPO_DIR
27- VERSION_REGEX=" [a-z0-9\- \.\+]+"
31+ VERSION_REGEX=" [- a-z0-9\.\+]+"
2832
29- replaceInFile " index.html " " (ajax\/libs\/angularjs\/) $VERSION_REGEX " " \1 $CDN_VERSION "
30- replaceInFile " index.html " " (<span class= \" version \" >[^<]*<span>) $VERSION_REGEX " " \1 $CDN_VERSION "
31- replaceInFile " index.html" " (code.angularjs.org \/)$VERSION_REGEX " " \1$CDN_VERSION "
33+ # Replace the version in the script links that reference the Google CDN
34+ # e.g. <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.1/angular.js"></script>
35+ replaceInFile " index.html" " (http:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs \/)$VERSION_REGEX " " \1$CDN_VERSION "
3236
33- replaceInFile " js/homepage.js" " ($scope .CURRENT_STABLE_VERSION[ ]*=[ ]*')$VERSION_REGEX " " \1$CDN_VERSION "
34- replaceInFile " js/homepage.js" " ($scope .CURRENT_UNSTABLE_VERSION[ ]*=[ ]*')$VERSION_REGEX " " \1$CDN_VERSION "
37+ # Replace the version in the script links that reference code.angularjs.org
38+ # e.g. <script src="http://code.angularjs.org/1.3.0-beta.1/i18n/angular-locale_sk.js"></script>
39+ replaceInFile " index.html" " (code\.angularjs\.org\/)$VERSION_REGEX " " \1$CDN_VERSION "
3540
41+ # Replace the version of the branch that we are updating
42+ echo $BRANCH_PATTERN
43+ echo $NEW_VERSION
44+ replaceInFile " js/download-data.js" " branch:[ ]+'($BRANCH_PATTERN )',[ ]+version:[ ]+'$VERSION_REGEX '" " branch: '\1', version: '$NEW_VERSION '"
45+
3646 git add index.html
37- git add js/homepage .js
38- git commit -m " update(version): update angular version to $CDN_VERSION "
47+ git add js/download-data .js
48+ git commit -m " update(version): update angular version to $NEW_VERSION for branch $BRANCH_PATTERN "
3949}
4050
4151function publish {
0 commit comments