@@ -11,8 +11,12 @@ ARG_DEFS=(
11
11
)
12
12
13
13
function init {
14
- TMP_DIR=$( resolveDir ../../tmp)
14
+ BASE_DIR=$( resolveDir ../..)
15
+ TMP_DIR=$BASE_DIR /tmp
15
16
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)
16
20
}
17
21
18
22
function prepare {
@@ -24,18 +28,24 @@ function prepare {
24
28
#
25
29
echo " -- Updating angularjs.org"
26
30
cd $REPO_DIR
27
- VERSION_REGEX=" [a-z0-9\- \.\+]+"
31
+ VERSION_REGEX=" [- a-z0-9\.\+]+"
28
32
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 "
32
36
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 "
35
40
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
+
36
46
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 "
39
49
}
40
50
41
51
function publish {
0 commit comments