DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:dev

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:dev [2021-11-30 16:33] andiplugin:dev [2024-03-18 23:50] (current) – version upped andi
Line 6: Line 6:
 email      : andi@splitbrain.org  email      : andi@splitbrain.org 
 type       : cli type       : cli
-lastupdate : 2021-07-23 +lastupdate : 2024-03-18 
-compatible : hogfather+compatible : Jack Jackrum
 depends    :  depends    : 
 conflicts  conflicts 
Line 13: Line 13:
 tags       : development, plugins, templates, extensions tags       : development, plugins, templates, extensions
  
-downloadurl: https://github.com/splitbrain/dokuwiki-plugin-dev/zipball/master +downloadurl: https://github.com/dokuwiki/dokuwiki-plugin-dev/zipball/master 
-bugtracker : https://github.com/splitbrain/dokuwiki-plugin-dev/issues +bugtracker : https://github.com/dokuwiki/dokuwiki-plugin-dev/issues 
-sourcerepo : https://github.com/splitbrain/dokuwiki-plugin-dev/+sourcerepo : https://github.com/dokuwiki/dokuwiki-plugin-dev/
 donationurl: https://donate.dokuwiki.org/dev donationurl: https://donate.dokuwiki.org/dev
  
Line 21: Line 21:
 ---- ----
  
-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 [[https://pluginwiz.dokuwiki.org/|DokuWiki plugin wizard]].+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 used plugin skeletons are the same as used by the [[https://pluginwiz.dokuwiki.org/|DokuWiki plugin wizard]]
 + 
 +The plugin also provides utility mechanisms often needed when developing or refactoring a plugin.
  
  
 ===== Installation ===== ===== Installation =====
  
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.+Download and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 ===== Usage ===== ===== Usage =====
  
-The plugin is called via [[cli#plugin.php|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''.+The plugin is called via [[cli#plugin.php|bin/plugin.php]]. **It has to be called from within the extension's top level directory.** Eg. if you want to use it to manage 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   php ../../../bin/plugin.php dev
Line 41: Line 43:
 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. 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.+The plugin will initialize a new git repository.
  
   php ../../../bin/plugin.php dev init   php ../../../bin/plugin.php dev init
 +
 +
 +You can run this command in the directory of an existing extension. The plugin will ignore all existing basic files and add any missing ones.
  
 ==== addTest ==== ==== addTest ====
  
-Use this command to add a [[devel:unittesting|Unit Test]]. You can give a class name as parameter, or leave it off to simple add the standard GeneralTest.+Use this command to add a [[devel:unittesting|Unit Test]]. You can give a class name as parameter, or leave it off to simply add the standard GeneralTest and Github workflow.
  
   php ../../../bin/plugin.php dev addTest   php ../../../bin/plugin.php dev addTest
Line 88: Line 93:
  
   php ../../../bin/plugin.php dev downloadSvg mdi:account icons/user.svg   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: The following repositories are supported:
Line 100: Line 109:
 ==== cleanSvg ==== ==== cleanSvg ====
  
-This command cleans up given SVG file according to the settings [[devel:svg|recommended for embedding]].+This command cleans up one or more given SVG files according to the settings [[devel:svg|recommended for embedding]].
  
   php ../../../bin/plugin.php dev cleanSvg icons/user.svg   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 [[#getSvg|above]]. Note: this does not replace a proper SVG minimizer. It will probably only work for icons previously sourced from repositories mentioned [[#getSvg|above]].
 +
 +==== cleanLang ====
 +
 +This command tries to figure out what language strings are actually used by your plugin and removes all unused strings from 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
 +
 +==== test ====
 +
 +This will run all [[devel:unittesting|unit tests]] defined for the extension.
 +
 +  php ../../../bin/plugin.php dev test
 +
 +==== check ====
 +
 +This will run PHP CodeSniffer to verify the extensions code adheres to our [[devel:coding_style|Coding Style Standards]].
 +
 +  php ../../../bin/plugin.php dev check
 +
 +You can optionally pass files to check, if you don't want to check all files.
 +
 +  php ../../../bin/plugin.php dev check syntax.php admin.php
 +
 +==== fix ====
 +
 +This command runs Rector and the PHP CodeSniffer Beautifier to automatically refactor deprecated code and fix coding style violations. It's highly recommended to make sure your current code is checked into git before running this.
 +
 +  php ../../../bin/plugin.php dev fix
 +
 +You can optionally pass files to fix, if you don't want to fix all files.
 +
 +  php ../../../bin/plugin.php dev fix syntax.php admin.php
 +
  
plugin/dev.1638286383.txt.gz · Last modified: 2021-11-30 16:33 by andi

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