DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:dev

dev Plugin

Compatible with DokuWiki

  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" yes
  • 2018-04-22 "Greebo" unknown
  • 2017-02-19 "Frusterick Manners" unknown

plugin The DokuWiki Developer's Tool

Last updated on
2022-03-15
Provides
CLI
Repository
Source

This command line plugin helps plugin and template developers dealing with the boilerplate required. It can be used to create and extend existing extensions. All required plugin skeletons are auto-downloaded from the DokuWiki plugin wizard.

The plugin also provides utility mechanism often needed when developing or refactoring a plugin.

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Usage

The plugin is called via bin/plugin.php. It has to be called from within the extension's top level directory. Eg. if you want to use it to mange the foo plugin, it has to be called from within lib/plugins/foo. If you want to manage a template named foo, you need to be in lib/tpl/foo.

php ../../../bin/plugin.php dev

The plugin comes with a whole bunch of commands.

init

Use this to initialize a completely new extension. It will interactively ask for the required info and will create the plugin.info.txt or template.info.txt as well as a README and LICENSE file.

This has to be called from a completely empty directory! The plugin will initialize a new git repository.

php ../../../bin/plugin.php dev init

addTest

Use this command to add a Unit Test. You can give a class name as parameter, or leave it off to simple add the standard GeneralTest.

php ../../../bin/plugin.php dev addTest
php ../../../bin/plugin.php dev addTest Something

addConf

This created the configuration files (eg. the conf/ folder) to make your extension configurable via the Configuration Manager.

addLang

This adds the English default files for localizing your extension (eg. the lang/en folder).

php ../../../bin/plugin.php dev addLang

addComponent

Using this command, you can add a new component to your extension. It requires a parameter to specify the type of component you want (auth, admin, syntax, action, renderer, helper, remote or cli). A optional second parameter allows you to specify a component name.

# create a syntax.php:
php ../../../bin/plugin.php dev addComponent syntax
# create a helper/foobar.php
php ../../../bin/plugin.php dev addComponent helper foobar

deletedFiles

This creates the deleted.files File for your extension based on previous commits.

php ../../../bin/plugin.php dev deletedFiles

rmObsolete

This command will check your extension for files that are no longer needed and deletes them.

php ../../../bin/plugin.php dev rmObsolete

downloadSvg

This command will download and clean up an SVG file from several known repositories. The file is cleaned up as recommended for embedding.

php ../../../bin/plugin.php dev downloadSvg mdi:account icons/user.svg

If the downloaded file will not be embedded directly into HTML, the SVG namespace needs to be kept. You can achieve this with the keep-ns option:

php ../../../bin/plugin.php dev downloadSvg --keep-ns mdi:account icons/user.svg

The following repositories are supported:

Prefix Repository
mdi Material Design Icons (default when no prefix is given)
fab Font Awesome Brands
fas Font Awesome Solid
fa Font Awesome Regular
twbs Twitter Bootstrap Icons

cleanSvg

This command cleans up one or more given SVG files according to the settings recommended for embedding.

php ../../../bin/plugin.php dev cleanSvg icons/user.svg

If the file will not be embedded directly into HTML, the SVG namespace needs to be kept. You can achieve this with the keep-ns option:

php ../../../bin/plugin.php dev cleanSvg --keep-ns icons/user.svg

Note: this does not replace a proper SVG minimizer. It will probably only work for icons previously sourced from repositories mentioned above.

cleanLang

This command tries to figure out what language strings are actually used by your plugin and removes all unused strings form all your language files.

Language code detection might fail when the keys are dynamically built within your code, or calls span multiple lines. Use with caution and execute on a clean, committed repository only. Manually check for correctness afterwards!

php ../../../bin/plugin.php dev cleanLang
plugin/dev.txt · Last modified: 2022-07-30 00:17 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki