Skip to content
Snippets Groups Projects
Commit ab3e7b57 authored by Matti Harjula's avatar Matti Harjula
Browse files

Small fixes to the new version number extraction script.

parent e271fc86
No related branches found
No related tags found
No related merge requests found
...@@ -59,18 +59,18 @@ if ($unrecognized) { ...@@ -59,18 +59,18 @@ if ($unrecognized) {
} }
if ($options['help']) { if ($options['help']) {
echo "This script extracts version numbers from various sources in the code echo "This script extracts version numbers from various sources in the code.
the numbers it provides are as follows: The numbers it provides are as follows:
- 'pluginversion', the version number, the date one, of the plugin from version.php. - 'pluginversion', the version number, the date one, of the plugin from version.php.
- 'pluginname', the version number, the human one, of the plugin from version.php. - 'pluginname', the version number, the human one, of the plugin from version.php.
- 'stackmaxima', the version nubmer at the end of stackmaxima.mac. - 'stackmaxima', the version number at the end of stackmaxima.mac.
- 'maximas', the supported Maximas from settings.php. - 'maximas', the supported Maximas from settings.php.
- 'requiredmoodle', the minimum Moodle version. - 'requiredmoodle', the minimum Moodle version from version.php.
With the additional option --only one can query for only one of these. With the additional option '--only' one can query for only one of these.
e.g. '--only=pluginname'. By default outputs all in the order used in that table in e.g. '--only=pluginname'. By default outputs selected ones in the order used in that
the docs. table in the docs.
"; ";
exit(0); exit(0);
} }
...@@ -85,10 +85,11 @@ if (!preg_match('~stackmaximaversion:(\d{10})~', ...@@ -85,10 +85,11 @@ if (!preg_match('~stackmaximaversion:(\d{10})~',
$stackmaxima = $matches[1]; $stackmaxima = $matches[1];
$pluginversion = $plugin->version; $pluginversion = $plugin->version;
$requiredmoodle = $plugin->requires; $requiredmoodle = $plugin->requires;
$pluginname = explode(' ', $plugin->release)[0]; $pluginname = explode(' ', trim($plugin->release))[0];
$maximas = implode(', ', $settings->maximaversions); $maximas = implode(', ', $settings->maximaversions);
if ($stackmaxima != $pluginversion) { if ($stackmaxima != $pluginversion) {
echo "$stackmaxima != $pluginversion\n";
throw new coding_exception('Maxima libraries version number not matching plugin version number.'); throw new coding_exception('Maxima libraries version number not matching plugin version number.');
} }
...@@ -97,7 +98,7 @@ switch($options['only']) { ...@@ -97,7 +98,7 @@ switch($options['only']) {
echo "$pluginname | $pluginversion | $maximas\n"; echo "$pluginname | $pluginversion | $maximas\n";
break; break;
case 'stackmaxima': case 'stackmaxima':
echo "stackmaxima\n"; echo "$stackmaxima\n";
break; break;
case 'maximas': case 'maximas':
echo "$maximas\n"; echo "$maximas\n";
...@@ -111,4 +112,11 @@ switch($options['only']) { ...@@ -111,4 +112,11 @@ switch($options['only']) {
case 'requiredmoodle': case 'requiredmoodle':
echo "$requiredmoodle\n"; echo "$requiredmoodle\n";
break; break;
default:
echo "Unknown option for '--only', the options are:
- 'pluginversion', the version number, the date one, of the plugin from version.php.
- 'pluginname', the version number, the human one, of the plugin from version.php.
- 'stackmaxima', the version number at the end of stackmaxima.mac.
- 'maximas', the supported Maximas from settings.php.
- 'requiredmoodle', the minimum Moodle version from version.php.\n\n";
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment