Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3fcd228

Browse files
committed
chore: add script for updating bower repos
1 parent 8383ecf commit 3fcd228

File tree

4 files changed

+139
-0
lines changed

4 files changed

+139
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ angular.xcodeproj
1717
libpeerconnection.log
1818
npm-debug.log
1919
/tmp/
20+
/scripts/bower/bower-*

scripts/bower/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Angular Bower Script
2+
3+
Script for updating the Angular bower repos from a code.angularjs.org package
4+
5+
Requires `node` (for parsing `bower.json`) and `wget` (for fetching the `angular.zip` from `code.angularjs.org`)
6+
7+
8+
## Instructions
9+
10+
You need to run `./init.sh` the first time you use this script to clone all the repos.
11+
12+
For subsequent updates:
13+
14+
```shell
15+
./publish.sh NEW_VERSION
16+
```
17+
18+
Where `NEW_VERSION` is a version number like `1.2.3`.
19+
20+
21+
## License
22+
MIT
23+

scripts/bower/init.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
#
4+
# init all of the bower repos
5+
#
6+
7+
set -e # fail if any command fails
8+
9+
REPOS=(
10+
angular \
11+
angular-animate \
12+
angular-cookies \
13+
angular-i18n \
14+
angular-loader \
15+
angular-mocks \
16+
angular-route \
17+
angular-resource \
18+
angular-sanitize \
19+
angular-scenario \
20+
angular-touch \
21+
)
22+
23+
cd `dirname $0`
24+
25+
for repo in "${REPOS[@]}"
26+
do
27+
git clone [email protected]:angular/bower-$repo.git
28+
done

scripts/bower/publish.sh

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
3+
#
4+
# update all the things
5+
#
6+
7+
set -e # fail if any command fails
8+
9+
cd `dirname $0`
10+
11+
NEW_VERSION=$1
12+
13+
ZIP_FILE=angular-$NEW_VERSION.zip
14+
ZIP_FILE_URL=http://code.angularjs.org/$NEW_VERSION/angular-$NEW_VERSION.zip
15+
ZIP_DIR=angular-$NEW_VERSION
16+
17+
REPOS=(
18+
angular \
19+
angular-animate \
20+
angular-cookies \
21+
angular-i18n \
22+
angular-loader \
23+
angular-mocks \
24+
angular-route \
25+
angular-resource \
26+
angular-sanitize \
27+
angular-scenario \
28+
angular-touch \
29+
)
30+
31+
32+
#
33+
# download and unzip the file
34+
#
35+
36+
#wget $ZIP_FILE_URL
37+
unzip $ZIP_FILE
38+
39+
40+
#
41+
# move the files from the zip
42+
#
43+
44+
for repo in "${REPOS[@]}"
45+
do
46+
if [ -f $ZIP_DIR/$repo.js ] # ignore i18l
47+
then
48+
cd bower-$repo
49+
git checkout master
50+
git reset --hard HEAD
51+
cd ..
52+
mv $ZIP_DIR/$repo.* bower-$repo/
53+
fi
54+
done
55+
56+
# move i18n files
57+
mv $ZIP_DIR/i18n/*.js bower-angular-i18n/
58+
59+
# move csp.css
60+
mv $ZIP_DIR/angular-csp.css bower-angular
61+
62+
63+
#
64+
# get the old version number
65+
#
66+
67+
OLD_VERSION=$(node -e "console.log(require('./bower-angular/bower').version)" | sed -e 's/\r//g')
68+
echo $OLD_VERSION
69+
echo $NEW_VERSION
70+
71+
#
72+
# update bower.json
73+
# tag each repo
74+
#
75+
76+
for repo in "${REPOS[@]}"
77+
do
78+
cd bower-$repo
79+
pwd
80+
sed -i '' -e "s/$OLD_VERSION/$NEW_VERSION/g" bower.json
81+
git add -A
82+
git commit -m "v$NEW_VERSION"
83+
git tag v$NEW_VERSION
84+
git push origin master
85+
git push origin v$NEW_VERSION
86+
cd ..
87+
done

0 commit comments

Comments
 (0)