mirror of
https://github.com/movahhedi/blueberry-pma-theme.git
synced 2026-08-24 10:04:43 -05:00
Add basic theme check script
For now it mostly verifieds that info.inc.php matches theme.json, but more checks can be added later. It is also used to display theme information when releasing. Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
@@ -14,3 +14,4 @@ sudo: false
|
||||
|
||||
script:
|
||||
- find . -name '*.php' -print0 | xargs -0 -r -n1 php -l
|
||||
- ./lint-theme.sh --all
|
||||
|
||||
+4
-1
@@ -17,6 +17,10 @@ if [ $# -eq 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
THEME="${1%/}"
|
||||
|
||||
./lint-theme.sh $THEME
|
||||
|
||||
cat <<END
|
||||
|
||||
Please ensure that you have updated data/themes.py in the website code before running this script.
|
||||
@@ -29,7 +33,6 @@ if [ "$do_release" != 'y' ]; then
|
||||
exit 100
|
||||
fi
|
||||
|
||||
THEME="${1%/}"
|
||||
if [ ! -d "$THEME" ] ; then
|
||||
echo "Directory $THEME does not exist!"
|
||||
exit 2
|
||||
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
# Simple script to check for common errors in themes
|
||||
|
||||
do_lint() {
|
||||
echo "== Linting $1 =="
|
||||
|
||||
if [ ! -d $1 ] ; then
|
||||
echo " * Does not exist!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
cd $1
|
||||
|
||||
VERSION=
|
||||
if [ -f info.inc.php ] ; then
|
||||
if grep -q theme_full_version info.inc.php ; then
|
||||
VERSION=`php -r "include './info.inc.php'; echo \\\$theme_full_version;"`
|
||||
echo " * Version from info.inc.php: $VERSION"
|
||||
else
|
||||
echo " * Old theme, no version available!"
|
||||
fi
|
||||
else
|
||||
echo " * Missing info.inc.php!"
|
||||
fi
|
||||
|
||||
if [ ! -f theme.json ] ; then
|
||||
echo " * Missing theme.json, skipping further checks!"
|
||||
cd ..
|
||||
return 0
|
||||
fi
|
||||
JVERSION=`php -r "echo json_decode(file_get_contents('theme.json'), true)['version'];"`
|
||||
echo " * Version from theme.json: $JVERSION"
|
||||
if [ -n "$VERSION" -a "$JVERSION" != "$VERSION" ] ; then
|
||||
echo " * Versions do not match: theme.json ($JVERSION), info.inc.php ($VERSION)"
|
||||
cd ..
|
||||
return 1
|
||||
fi
|
||||
VERSION=$JVERSION
|
||||
echo " * Supported phpMyAdmin versions: `php -r "echo implode(', ', json_decode(file_get_contents('theme.json'), true)['supports']);"`"
|
||||
|
||||
cd ..
|
||||
}
|
||||
|
||||
if [ -z "$1" ] ; then
|
||||
echo "Usage: lint-theme.sh [--all|THEMEDIR]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$1" = "x--all" ] ; then
|
||||
for dir in `find . -mindepth 1 -maxdepth 1 -type d` ; do
|
||||
do_lint $dir
|
||||
if [ $? -ne 0 ] ; then
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
else
|
||||
do_lint $1
|
||||
exit $?
|
||||
fi
|
||||
Reference in New Issue
Block a user