Extension:Cookiecutter-mediawiki-extension

From mediawiki.org
This is not an extension but an extension generator (with optional feature selection).
MediaWiki extensions manual
cookiecutter-mediawiki-extension
Release status: stable
Implementation Example
Description A extension generator using the popular Python cookiecutter project.
Author(s) JonasGroger and others (JonasGrogertalk)
MediaWiki 1.26+
PHP 5.6+
License GNU General Public License 2.0 or later
Download
README

A Cookiecutter template for MediaWiki extensions.

Features[edit]

  • Comes with all features of the BoilerPlate extension.
  • Makefile support (make help, make install, make update, make test)

Features (future)[edit]

  • License support
  • Tests using PHPUnit

Optional Integrations[edit]

These features can be enabled during initial project setup.

  • Set the extension type
  • Add an example special page Special:HelloWorld
  • Add an example parser hook {{#something: }}
  • Integration with Gerrit

Constraints[edit]

  • Cannot create MediaWiki skins. See cookiecutter-mediawiki-skin for that. (In theory, you can select the skin option, but it doesn't do anything special for skins right now. A separate repository is better imho.)

Usage[edit]

Let's pretend you want to create a MediaWiki extension called SomeExtension. Rather than cloning the BoilerPlate extension, and then changing every occurrence of BoilerPlate by hand, use cookiecutter to do all the work.

First, get cookiecutter. Trust me, it's awesome:

   $ pip install cookiecutter

Now run it against this repo:

   $ cookiecutter https://github.com/JonasGroeger/cookiecutter-mediawiki-extension.git

You'll be prompted for some questions, answer them, then it will create a custom MediaWiki extension for you.

Note: If you want to conform with all naming conventions (PHP, JS/CSS, Composer) you should watch closely when filling out the project template parameters. The default values are conforming with all conventions.

It prompts you for questions. Answer them:

   $ cookiecutter https://github.com/JonasGroeger/cookiecutter-mediawiki-extension.git
   Cloning into 'cookiecutter-mediawiki-extension'...
   remote: Counting objects: 151, done.
   remote: Compressing objects: 100% (102/102), done.
   remote: Total 151 (delta 57), reused 140 (delta 46), pack-reused 0
   Receiving objects: 100% (151/151), 28.13 KiB | 0 bytes/s, done.
   Resolving deltas: 100% (57/57), done.
   Checking connectivity... done.
   repo_name [ExtensionName]: SomeExtension
   description [A short description of the extension.]: This will be an extension that adds a parser hook.
   jscss_prefix [extensionName]: someExtension
   composer_vendor_name [vendorname]: jonasgroeger
   composer_package_name [some-extension]: 
   version [0.1.0]: 
   author_name [Your Name]: Jonas Gröger
   url [1]: https://github.com/JonasGroeger/SomeExtension
   i18n_prefix [someextension]:  
   license [GPL v2]: 
   Select extension_type:
   1 - api
   2 - antispam
   3 - datavalues
   4 - media
   5 - parserhook
   6 - semantic
   7 - skin
   8 - specialpage
   9 - variable
   10 - other
   Choose from 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 [1]: 5
   integration_add_example_parser_hook [y]: y
   integration_add_example_special_page [y]: y
   integration_add_gerrit [y]: y

Enter the project and take a look around:

   $ cd SomeExtension/
   $ ls

Create a GitHub repo and push it there:

   $ git init
   $ git add .
   $ git commit -m "Initial commit: MediaWiki extension SomeExtension"
   $ git remote add origin git@github.com:JonasGroeger/SomeExtension.git
   $ git push -u origin master

Now take a look at your repo. Don't forget to carefully look at the generated README.md. Awesome, right?

Support This Project[edit]

This project is maintained by volunteers. Support their work by contributing or spreading the word.

Not Exactly What You Want?[edit]

This is what I want. It might not be what you want. Don't worry, you have options:

Fork This[edit]

If you have differences in your preferred setup, I encourage you to fork this to create your own version. Once you have your fork working, let me know and I'll add it to a Similar Cookiecutter Templates list here. It's up to you whether or not to rename your fork.

If you do rename your fork, I encourage you to submit it to the following places:

Or Submit a Pull Request[edit]

I also accept pull requests on this, if they're small, atomic, and if they make my own project development experience better.

See Also[edit]