forked from mapbox/mapbox.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bower.sh
executable file
·85 lines (66 loc) · 1.64 KB
/
bower.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
# Script for updating the Mapboxjs bower repo from current local build.
echo "#################################"
echo "#### Update bower ###############"
echo "#################################"
ARG_DEFS=(
"--action=(prepare|publish)"
)
function init {
SCRIPT_DIR=$(resolveDir .)
mkdir -p $SCRIPT_DIR/tmp
TMP_DIR=$(resolveDir ./tmp)
BUILD_DIR=$(resolveDir ./dist)
NEW_VERSION=$(git describe --tags | sed 's/^v//')
ORG=mapbox
REPO=mapbox.js-bower
}
function prepare {
#
# prepare tmp folder
#
if [ -d $TMP_DIR/$REPO ]
then
rm -rf $TMP_DIR/$REPO
fi
#
# clone repo
#
echo "-- Cloning $REPO"
git clone [email protected]:$ORG/$REPO.git $TMP_DIR/$REPO
#
# clean up cloned files
#
rm -f $TMP_DIR/$REPO/*.js
rm -f $TMP_DIR/$REPO/*.css
rm -rf rm $TMP_DIR/$REPO/images
# move js files from the build
cp $BUILD_DIR/*.js $TMP_DIR/$REPO/
cp $BUILD_DIR/*.js.map $TMP_DIR/$REPO/
# move css files from the build
cp $BUILD_DIR/*.css $TMP_DIR/$REPO/
# move images folder from the build
cp -R $BUILD_DIR/images $TMP_DIR/$REPO/
cp -R bower.json $TMP_DIR/$REPO/bower.json
cp -R LICENSE.md $TMP_DIR/$REPO/LICENSE.md
#
# update bower.json
# tag repo
#
echo "-- Updating version in $REPO to $NEW_VERSION"
cd $TMP_DIR/$REPO
replaceJsonProp "bower.json" "version" ".*" "$NEW_VERSION"
git add -A
echo "-- Committing and tagging $REPO"
git commit -m "v$NEW_VERSION"
git tag v$NEW_VERSION
cd $SCRIPT_DIR
}
function publish {
echo "-- Pushing $REPO"
cd $TMP_DIR/$REPO
git push origin master
git push origin v$NEW_VERSION
cd $SCRIPT_DIR
}
source $(dirname $0)/bower-utils.inc