Extension:Katsa

From mediawiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
Katsa
Release status: experimental
'Beware of Spies' (cropped).jpg
Implementation API
Description Provides spies for Scribunto.
Author(s)
Compatibility policy Master maintains backwards compatibility.
MediaWiki 1.36 Not formally tested
MediaWiki 1.34 Not formally tested
MediaWiki 1.32 Not formally tested
Database changes No
License GNU General Public License 2.0 or later
Download
README, LDoc
Translate the Katsa extension

Check usage and version matrix.

Katsa provides a framework for spies.

Installation[edit]

Katsa depends on modules from the Scribunto extension.

  • Download and place the file(s) in a directory called Katsa in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Katsa' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage[edit]

The workflow for spies is to define a graph, and then call on that graph. The definition is done once, but the graph can be reused several times.

local spy = require 'spy'
local carp = spy.newCarp()
local cluck = spy.newCluck()
local croak = spy.newCroak()
local confess = spy.newConfess()

local h = {}

function h.carp()
	carp 'carp carp carp'             -- this will log a one-liner in the console
	cluck 'cluck cluck cluck'         -- this will log a full stack trace
	croak 'croak croak croak'         -- should just bug out and print a one-liner (but Scribuntos implementation of error() is weird)
	confess "confess confess confess" -- bug out and print a full stack trace
end

return h

For further help, see the generated LDoc documentation.

Development[edit]

For recreating the Vagrant-based development environment, see Katsa: Topics/Vagrant.

See also[edit]