Skip to content

vagrant

John Erling Blad edited this page Sep 23, 2019 · 4 revisions

Vagrant

Minimal setup

This extension uses Mediawiki-Vagrant, and a complete setup can be made quite easily.

  1. Make sure you have Vagrant, etc, prepare a development directory, and move to that directory.

  2. Clone Mediawiki

    git clone --recursive https://gerrit.wikimedia.org/r/mediawiki/vagrant .
    
  3. Add role unless #535661 has been merged. (You need git-review to do this.)

     git review -d 535661
    
  4. Run setup.

     ./setup.sh
    
  5. Enable the role for Expect. This pulls inn the role for Scribunto, which pulls in additional roles.

     vagrant roles enable expect
    
  6. Start the instance.

     vagrant up
    
  7. Done.

This should create a working environment with phpmd, phpcs, and phpunit. An actual call would be composer unit. See scripts in composer.json for all calls.

Problems

At [6.] there might be a problem during git clone. This can be usually be solved by a vagrant reload, and then a git submodule update, like so

vagrant reload --provision
git submodule update --init --recursive

Extended setup

Luarocks and ldoc

It is necessary to install luarocks and a few libs to recreate the generated docs.

  1. Install luarocks. This will pull in several additional packages, the most important is lua5.1.

     sudo apt install luarocks
    
  2. Install ldoc. This will pull in several additional packages, like penlight, markdown, and luafilesystem.

     sudo luarocks install ldoc
    
  3. Done.

This should make a working ldoc. An actual call would be composer ldoc.

Import of pages

A few pages for testing can be imported in the new instance.

  1. Open a terminal at the new Vagrant instance

     vagrant ssh
    
  2. Go to the Expect folder and import the pages.

     cd /vagrant/mediawiki/extensions/Expect
     composer import
    
  3. Go to the mediawiki root, rebuild recent changes, and rebuild site stats.

     cd /vagrant/mediawiki
     php maintenance/rebuildrecentchanges.php
     php maintenance/initSiteStats.php --update
    
  4. Done

Manual verification

A few manual checks to verify proper operation.

Run composer import to load the examples.

Open the page “Module:Export-expect” for editing, and scroll down to the console. Typing the example code you should get the result described in the comment.

= type( p )            -- 'table'
= mw.dumpObject( p )   -- this is the actual table

Open the page “Module:Hello-world” for editing, and scroll down to the console. Typing the example code you should get the result described in the comment.

= p._hello('Foo')      -- 'Hi there Foo!'
= p._hello('User:Foo') -- throws an error

An alternative is to inspect the page “hello-world”, given that the test pages are imported.

Clone this wiki locally