use indexOf('borderRadius') != -1 instead
[mootools.git] / tag-release
blobcef0cafb9d6854942df4c2c738bb0219e32a9607
1 #!/bin/sh
3 COREFILE='Source/Core/Core.js'
4 PKGFILE='package.json'
5 TAGLENGTH=3
7 DIR=`dirname "$0"`
8 COREFILE="$DIR/$COREFILE"
9 PKGFILE="$DIR/$PKGFILE"
10 TAG=`echo "$1" | cut -d'.' -f-$TAGLENGTH`
11 SUFFIX="`echo "$2" | tr '[A-Z]' '[a-z]'`"
12 BUILD=`sh -c "cd '$DIR' && git rev-parse HEAD"`
13 CUTLENGTH=`echo "$TAGLENGTH - 1" | bc`
15 moo(){
16 echo -e "$1" >&2
17 exit 1
20 get_suffixnumber(){
21 NUMBER=`echo "$1" | sed 's/^[a-z]*[ ]*\([0-9]*\).*/\1/'`
22 [ -n "$NUMBER" ] && echo "$NUMBER" || echo "1"
25 [ -z "$1" -o "$1" == '-h' -o "$1" == '--help' ] && moo "Usage: $0 <tag> [suffix]\n\n suffix: alpha, beta or rc*"
26 [ -z "$BUILD" ] && moo 'Unable to determine build.'
28 until [ -n "`echo "$TAG." | cut -d'.' -f$TAGLENGTH`" ]; do
29 TAG="$TAG.0"
30 done
32 case "$SUFFIX" in
33 '') RELEASE=''; SUFFIX='';;
34 a*) NUMBER="`get_suffixnumber $SUFFIX`"; RELEASE=" Alpha $NUMBER"; SUFFIX="-a$NUMBER";;
35 b*) NUMBER="`get_suffixnumber $SUFFIX`"; RELEASE=" Beta $NUMBER"; SUFFIX="-b$NUMBER";;
36 rc*) NUMBER="`get_suffixnumber $SUFFIX`"; RELEASE=" Release Candidate $NUMBER"; SUFFIX="-rc$NUMBER";;
37 *) moo 'Invalid suffix specified.';;
38 esac
40 if [ "$TAG" != "$1" ]; then
41 echo -n "Did you mean $TAG$SUFFIX? (y/n): "
42 read FIXTAG
43 [ "$FIXTAG" = "y" ] || moo "Invalid tag specified, this project's tags consist of $TAGLENGTH parts."
46 sh -c "cd '$DIR' && git show-ref --quiet --tags '$TAG$SUFFIX'" && moo "Tag $TAG$SUFFIX already exists."
48 if [ -z "$SUFFIX" ]; then
49 MINOR=`echo "$TAG" | cut -d'.' -f$TAGLENGTH-`
50 [ -z "$MINOR" ] && MINOR='0'
51 NEXTTAG="`echo "$TAG" | cut -d'.' -f-$CUTLENGTH`.`echo "$MINOR + 1" | bc`-dev"
52 else
53 NEXTTAG="${TAG}-dev"
56 sed -i".$BUILD" -e "s/\(version:[ ]*\)'[0-9.]*-dev'/\1'$TAG$SUFFIX'/" -e "s/\(build:[ ]*\)'%build%'/\1'$BUILD'/" "$COREFILE" || moo "Error setting version and build for $TAG$SUFFIX in $COREFILE."
57 sed -i".$BUILD" -e "s/^\([ ]*\"version\":[ ]*\)\"[0-9.]*-dev\"/\1\"$TAG$SUFFIX\"/" "$PKGFILE" || moo "Error setting version for $TAG$SUFFIX in $PKGFILE."
58 sh -c "cd $DIR && git add '$COREFILE' '$PKGFILE' && git commit -qm 'Welcome $TAG$SUFFIX.'" || moo "Error committing $TAG$SUFFIX."
59 sh -c "cd $DIR && git tag -am '$TAG$RELEASE.' '$TAG$SUFFIX'" || moo "Error tagging $TAG$SUFFIX."
60 echo "Tagged $TAG$SUFFIX." >&2
62 mv "$COREFILE.$BUILD" "$COREFILE" || moo "Error reverting version and build in $COREFILE."
63 mv "$PKGFILE.$BUILD" "$PKGFILE" || moo "Error reverting version in $PKFILE."
64 sed -i".$BUILD" -e "s/\(version:[ ]*\)'[0-9.]*-dev'/\1'$NEXTTAG'/" "$COREFILE" || moo "Error setting version $NEXTTAG in $COREFILE."
65 sed -i".$BUILD" -e "s/^\([ ]*\"version\":[ ]*\)\"[0-9.]*-dev\"/\1\"$NEXTTAG\"/" "$PKGFILE" || moo "Error setting version for $NEXTTAG in $PKGFILE."
66 rm "$COREFILE.$BUILD" "$PKGFILE.$BUILD" || moo "Error cleaning up $COREFILE.$BUILD and/or $PKGFILE.$BUILD."
67 sh -c "cd $DIR && git add '$COREFILE' '$PKGFILE' && git commit -qm 'Hello $NEXTTAG.'" || moo "Error committing $NEXTTAG."
68 echo "Committed $NEXTTAG." >&2