Automatic generate plugin infos such README.md, plugin.php, plugin.xml, ... from composer.json
This project is licensed under the GPL-3.0-only license
First add the following to your composer.json
file:
"require": {
"srag/generateplugininfoshelper": ">=1.0.0"
},
And run a composer install
.
If you deliver your plugin, the plugin has it's own copy of this library and the user doesn't need to install the library.
Tip: Because of multiple autoloaders of plugins, it could be, that different versions of this library exists and suddenly your plugin use an older or a newer version of an other plugin!
So I recommand to use srag/librariesnamespacechanger in your plugin.
Generate plugin.php
and plugin.xml
and LuceneObjectDefinition.xml
for ILIAS plugins from composer.json
Complete your composer.json
with
...
"version": "x.y.z",
...
"extra": {
"ilias_plugin": {
"id": "x",
"name" => "X",
"ilias_min_version": "x.y.z",
"ilias_max_version": "x.y.z",
"learning_progress": true | false,
"lucene_search": true | false,
"supports_export": true | false,
"supports_cli_setup": true | false,
"slot": "x/y/z"
"events": [
{
"id": "X/Y",
"type": "listen|raise"
}
]
}
},
...
"authors": [
{
"name": "...",
"email": "...",
"homepage": "...",
"role": "Developer"
}
],
...
...
"pre-autoload-dump": [
...,
"srag\\GeneratePluginInfosHelper\\x\\GeneratePluginPhpAndXml::generatePluginPhpAndXml"
]
...
composer du
...
"generate-plugin-php-and-xml": [
...,
"srag\\GeneratePluginInfosHelper\\x\\GeneratePluginPhpAndXml::generatePluginPhpAndXml"
]
...
composer generate-plugin-php-and-xml
...
use srag\GeneratePluginInfosHelper\x\GeneratePluginPhpAndXml;
...
GeneratePluginPhpAndXml::getInstance()->doGeneratePluginPhpAndXml(string $project_root, ?string $version = null, ?array $extra_ilias_plugin = null, bool $autogenerated_comment = false, bool $log = false)
...
Auto update version in composer.json
and CHANGELOG.md
- If the latest version in
CHANGELOG.md
is newer than the version incomposer.json
- It just sets the version in
CHANGELOG.md
to the version incomposer.json
and skip updating version
- It just sets the version in
- If the version in
composer.json
is missing- It just sets the version to
1.0.0
and skip updating version
- It just sets the version to
- If available a
x
version inCHANGELOG.md
, it will be replaced with the new version- Otherwise a new version is added to
CHANGELOG.md
(WithTODO
)
- Otherwise a new version is added to
...
"update-version": [
...,
"srag\\GeneratePluginInfosHelper\\x\\UpdateVersion::updateVersion"
]
...
composer update-version [update_type] [todo_changelog]
...
use srag\GeneratePluginInfosHelper\x\UpdateVersion;
...
UpdateVersion::getInstance()->doGeneratePluginReadme(string $project_root, int $update_type = UpdateVersion::UPDATE_TYPE_PATCH|UpdateVersion::UPDATE_TYPE_MINOR|UpdateVersion::UPDATE_TYPE_MAJOR, ?string $todo_changelog = null, bool $log = false)
...
- PHP >=7.2