3 # FIXME this script is duplicated from update-oojs.sh - factor this out
5 # This script generates a commit that updates the oojs-ui distribution
6 # ./bin/update-oojs-ui.sh path/to/repo/for/oojs-ui
8 function oojsuihash
() {
9 grep "OOjs UI v" resources
/lib
/oojs-ui
/oojs-ui.js \
11 |
grep -Eo '\([a-z0-9]+\)' \
16 function oojsuitag
() {
17 grep "OOjs UI v" resources
/lib
/oojs-ui
/oojs-ui.js \
19 |
grep -Eo '\bv[0-9a-z.-]+\b'
22 function oojsuiversion
() {
23 grep "OOjs UI v" resources
/lib
/oojs-ui
/oojs-ui.js \
25 |
grep -Eo '\bv[0-9a-z.-]+\b.*$'
28 # cd to the MW root directory
29 cd $
(cd $
(dirname $0)/..
/..
/..
; pwd)
33 echo >&2 "Usage: update-oojs-ui.sh path/to/repo/for/oojs-ui"
37 # Undo any changes in the oojs-ui directory
38 git
reset -- resources
/lib
/oojs-ui
/
39 git checkout
-- resources
/lib
/oojs-ui
/
42 # Create a branch of MW if needed, and reset it to master
43 git checkout
-B update-oojsui origin
/master
45 # Get the old oojs-ui version
46 OLDVERSION
=$
(oojsuihash
)
47 if [ "x$OLDVERSION" == "x" ]
52 # cd to the oojs-ui directory
54 if [ "x$OLDVERSION" == "x" ]
57 OLDVERSION
=$
(git rev-parse
$TAG)
60 echo Could not
find OOjs UI version
65 if [ "$(git rev-parse $OLDVERSION)" == "$(git rev-parse HEAD)" ]
67 echo "No changes (already at $OLDVERSION)"
71 # Build the distribution
74 # Get the list of changes
75 NEWCHANGES
=$
(git log
$OLDVERSION..
--oneline --no-merges --reverse --color=never
)
76 NEWCHANGESDISPLAY
=$
(git log
$OLDVERSION..
--oneline --no-merges --reverse --color=always
)
77 # cd back to the VisualEditor directory
80 # Copy files from dist/ to resources/lib/oojs-ui
81 cp -a $1/dist
/{oojs-ui.js
,oojs-ui.svg.css
,oojs-ui-apex.css
,oojs-ui-agora.css
,images
,i18n
} resources
/lib
/oojs-ui
/
82 # Figure out what the new version is
83 NEWVERSION
=$
(oojsuiversion
)
84 # Generate commit summary
86 Update OOjs UI to $NEWVERSION
93 git commit resources
/lib
/oojs-ui
/ -m "$COMMITMSG"
97 Created commit with changes: