forked from corimf/build-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
corimf-show-plugin-versions
executable file
·104 lines (93 loc) · 2.85 KB
/
corimf-show-plugin-versions
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/sh -e
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
##############################################################################
# This is a script to show the versions of all the plugins. This is only for
# display, it does not do any checking/verification to see if the plugin
# version is correct. The intent is to manually compare this to the blog post
# on cordova.apache.org that it is as expected.
if [ "$1" = "" ]
then
echo "Loading the settings from corimf-settings..."
source corimf-settings
else
echo "Loading the settings from $1"
source "$1"
fi
echo "NEW_TAG=$NEW_TAG"
/bin/echo -n "Hit ENTER to continue: "
read ANSWER
check_rc() {
SAVE_RC=$?
if [ $SAVE_RC != 0 ]
then
echo "Failed."
exit $RC
elif [ "$DONE" = 1 ]
then
echo "Success."
else
echo "Incomplete."
exit 1
fi
}
trap check_rc EXIT
TEMPFILE=$(mktemp tmp-showver-XXXXXX)
test ! -z "$TEMPFILE"
TEMPDIR=$(mktemp -d tmp-showver-XXXXXX)
test ! -z "$TEMPDIR"
echo "Displaying plugin versions (from plugin.xml) from repo at $NEW_TAG:"
for DIR in $PLUGINS
do
if [ -d $DIR ]
then
/bin/echo -n "$DIR: "
test -d $DIR
cd $DIR
# check that tag exists, or else the whole script stops
EXISTS=`git tag | grep "$NEW_TAG"` || true
if [ -z "$EXISTS" ]
then
echo "WARNING: No tag $NEW_TAG for $DIR"
continue
fi
git show $NEW_TAG:plugin.xml > $TEMPFILE
xmllint --shell $TEMPFILE << EOD | grep content | cut -f2 -d=
setns defns=http://apache.org/cordova/ns/plugins/1.0
xpath /defns:plugin/@version
EOD
rm $TEMPFILE
cd ..
else
# it is a zip file of the pre-packaged source
ZIPFILE=$DIR-$NEW_TAG.zip
/bin/echo -n "zip file $ZIPFILE: "
test -f $ZIPFILE
unzip -q $ZIPFILE $DIR/plugin.xml -d $TEMPDIR
xmllint --shell $TEMPDIR/$DIR/plugin.xml << EOD | grep content | cut -f2 -d=
setns defns=http://apache.org/cordova/ns/plugins/1.0
xpath /defns:plugin/@version
EOD
rm $TEMPDIR/$DIR/plugin.xml
fi
done
rm $TEMPFILE
rm -rf $TEMPDIR
DONE=1