[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 #!/usr/bin/env bash 2 3 # This script generates a commit that updates our distribution copy of OOjs UI 4 5 if [ -z "$1" ] 6 then 7 # Missing required parameter 8 echo >&2 "Usage: $0 path/to/repo/for/oojs-ui" 9 exit 1 10 fi 11 12 TARGET_REPO=$(cd "$(dirname $0)/../.."; pwd) 13 TARGET_DIR=resources/lib/oojs-ui 14 UI_REPO=$1 15 16 function oojsuihash() { 17 grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \ 18 | head -n 1 \ 19 | grep -Eo '\([a-z0-9]+\)' \ 20 | sed 's/^(//' \ 21 | sed 's/)$//' 22 } 23 24 function oojsuitag() { 25 grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \ 26 | head -n 1 \ 27 | grep -Eo '\bv[0-9a-z.-]+\b' 28 } 29 30 function oojsuiversion() { 31 grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \ 32 | head -n 1 \ 33 | grep -Eo '\bv[0-9a-z.-]+\b.*$' 34 } 35 36 # Prepare working tree 37 cd "$TARGET_REPO" && 38 git reset $TARGET_DIR && git checkout $TARGET_DIR && git fetch origin && 39 git checkout -B upstream-oojsui origin/master || exit 1 40 41 cd $UI_REPO || exit 1 42 43 # Read the old version and check for changes 44 OLDHASH=$(oojsuihash) 45 if [ -z "$OLDHASH" ] 46 then 47 OLDTAG=$(oojsuitag) 48 fi 49 if [ "$OLDHASH" == "" ] 50 then 51 OLDHASH=$(git rev-parse "$OLDTAG") 52 if [ $? != 0 ] 53 then 54 echo "Could not find OOjs UI version" 55 cd - 56 exit 1 57 fi 58 fi 59 if [ "$(git rev-parse $OLDHASH)" == "$(git rev-parse HEAD)" ] 60 then 61 echo "No changes (already at $OLDHASH)" 62 cd - 63 exit 0 64 fi 65 66 # Build the distribution 67 npm install && grunt git-build || exit 1 68 69 # Get the list of changes 70 NEWCHANGES=$(git log $OLDHASH.. --oneline --no-merges --reverse --color=never) 71 NEWCHANGESDISPLAY=$(git log $OLDHASH.. --oneline --no-merges --reverse --color=always) 72 73 # Copy files 74 # - Exclude the default non-svg stylesheet 75 rsync --recursive --delete --force --exclude 'oojs-ui.css' --exclude 'oojs-ui*.rtl.css' ./dist/ "$TARGET_REPO/$TARGET_DIR" || exit 1 76 77 # Read the new version 78 NEWVERSION=$(oojsuiversion) 79 80 # Generate commit 81 cd "$TARGET_REPO" 82 COMMITMSG=$(cat <<END 83 Update OOjs UI to $NEWVERSION 84 85 New changes: 86 $NEWCHANGES 87 END 88 ) 89 git add -u $TARGET_DIR && git add $TARGET_DIR && git commit -m "$COMMITMSG" 90 cat >&2 <<END 91 92 93 Created commit with changes: 94 $NEWCHANGESDISPLAY 95 END
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |