4 A collection of tools meant to make developers' lives easier.
11 - MySQL, MariaDB or PostgreSQL
12 - Git v1.7.7 or greater
14 Most of the tools work on Moodle 1.9 onwards, but some CLI scripts required by MDK might not be available in all versions.
19 The commands are called using that form::
21 mdk <command> <arguments>
23 Get some help on a command using::
27 Also check the `wiki <https://github.com/FMCorz/mdk/wiki>`_.
35 You need the `pip <http://www.pip-installer.org/en/latest/installing.html>`_ to do this::
37 sudo pip install moodle-sdk
42 On Debian-based systems, you will probably need to install the following packages:
44 sudo apt-get install python-pip libmysqlclient-dev libpq-dev python-dev
50 Using `Homebrew <http://brew.sh/>`_, please refer to this `formula <https://github.com/danpoltawski/homebrew-mdk>`_.
56 1. Clone the repository
57 ~~~~~~~~~~~~~~~~~~~~~~~
62 sudo git clone git://github.com/FMCorz/mdk.git moodle-sdk
64 2. Install the dependencies
65 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
67 You will need the tool `pip <http://www.pip-installer.org/en/latest/installing.html>`_ to install the packages required by Python.
71 sudo pip install -r /opt/moodle-sdk/requirements.txt
73 On Debian-based systems, you will probably need to install the following packages:
75 sudo apt-get install python-pip libmysqlclient-dev libpq-dev python-dev
77 3. Make executable and accessible
78 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82 sudo chmod +x /opt/moodle-sdk/mdk.py
83 sudo ln -s /opt/moodle-sdk/mdk.py /usr/local/bin/mdk
88 Assuming that you are using Apache, which is set up to serve the files from /var/www, leave the default values as they are in ``mdk init``, except for your remote and the database passwords.
93 sudo ln -s ~/www /var/www/m
101 To activate bash completion::
103 sudo ln -s /opt/moodle-sdk/extra/bash_completion /etc/bash_completion.d/moodle-sdk
105 To activate goto commands (``gt`` and ``gtd``), add the following to ~/.bashrc::
107 if [ -f /opt/moodle-sdk/extra/goto_instance ]; then
108 . /opt/moodle-sdk/extra/goto_instance
109 . /opt/moodle-sdk/extra/goto_instance.bash_completion
119 Set up aliases of your Moodle commands.
123 This line defines the alias 'upall', for 'moodle update --all'
127 mdk alias add upall "update --all"
132 Backport a branch to another instance of Moodle.
136 Assuming we are in a Moodle instance, this backports the current branch to the version 2.2 and 2.3
140 mdk backport --version 22 23
142 Backports the branch MDL-12345-23 from the instance stable_23 to the instance stable_22, and pushes the new branch to your remote
146 mdk backport stable_23 --branch MDL-12345-23 --version 22 --push
151 Backup a whole instance so that it can be restored later.
155 Backup the instance named stable_master
159 mdk backup stable_master
167 Restore the second backup of the instance stable_master
171 mdk backup --restore stable_master_02
177 Get the instance ready for acceptance testing (Behat), and run the test feature(s).
183 mdk behat -r --tags=@core_completion
189 Create a new instance of Moodle. It will be named according to your config file.
193 Create a new instance of Moodle 2.1
197 mdk create --version 21
199 Create an instance of Moodle 2.2 using PostgreSQL from the integration remote, and run the installation script.
203 mdk create --version 22 --engine pgsql --integration --install
208 Set your MDK settings from the command line.
212 Show the list of your settings
218 Change the value of the setting ``dirs.storage`` to ``/var/www/repositories``
222 mdk config set dirs.storage /var/www/repositories
228 CSS related functions.
232 Compile the LESS files from Bootstrapbase
242 Perform some checks on the environment to identify possible problems, and attempt to fix them automatically.
248 Create a branch from an issue number on the tracker (MDL-12345) and sets it to track the right branch.
252 In a Moodle 2.2 instance, this will create (and checkout) a branch named MDL-12345-22 which will track upstream/MOODLE_22_STABLE.
263 Display information about the instances on the system.
273 Display the information known about the instance *stable_master*
277 mdk info stable_master
283 Run the command line installation script with all parameters set on an existing instance.
289 mdk install --engine mysqli stable_master
295 JS related functions.
299 Compile the JS modules in Atto
303 mdk js shift --plugin editor_atto
306 Generate the complete YUI API documentation
314 Get the instance ready for PHPUnit tests, and run the test(s).
320 mdk phpunit -u repository/tests/repository_test.php
326 Look for a plugin on moodle.org and downloads it into your instance.
332 mdk plugin download repository_evernote
342 To purge the cache of all the instances
352 Pulls a patch using the information from a tracker issue.
356 Assuming we type that command on a 2.3 instance, pulls the corresponding patch from the issue MDL-12345 in a testing branch
360 mdk pull --testing 12345
366 Shortcut to push a branch to your remote.
370 Push the current branch to your repository
376 Force a push of the branch MDL-12345-22 from the instance stable_22 to your remote
380 mdk push --force --branch MDL-12345-22 stable_22
386 Fetch the latest branches from the upstream remote and rebase your local branches.
390 This will rebase the branches MDL-12345-xx and MDL-56789-xx on the instances stable_22, stable_23 and stable_master. And push them to your remote if successful.
394 mdk rebase --issues 12345 56789 --version 22 23 master --push
395 mdk rebase --issues MDL-12345 MDL-56789 --push stable_22 stable_23 stable_master
401 Remove an instance, deleting every thing including the database.
407 mdk remove stable_master
413 Execute a script on an instance. The scripts are stored in the scripts directory.
417 Set the instance stable_master ready for development
421 mdk run dev stable_master
427 Gets some information about the issue on the tracker.
434 ------------------------------------------------------------------------
435 MDL-34543: New assignment module - Feedback file exists for an
436 assignment but not shown in the Feedback files picker
437 Bug - Critical - https://tracker.moodle.org/browse/MDL-34543
438 Closed (Fixed) 2012-08-17 07:25
439 -------------------------------------------------------[ V: 7 - W: 7 ]--
440 Reporter : Paul Hague (paulhague) on 2012-07-26 08:30
441 Assignee : Eric Merrill (emerrill)
442 Peer reviewer : Damyon Wiese (damyon)
443 Integrator : Dan Poltawski (poltawski)
444 Tester : Tim Barker (timb)
445 ------------------------------------------------------------------------
451 Uninstall an instance: removes config file, drops the database, deletes dataroot content, ...
457 Fetch the latest stables branches from the upstream remote and pull the changes into the local stable branch.
461 This updates the instances stable_22 and stable_23
465 mdk update stable_22 stable_23
467 This updates all your integration instances and runs the upgrade script of Moodle.
471 mdk update --integration --upgrade
477 Run the upgrade script of your instance.
481 The following runs an upgrade on your stable branches
487 This will run an update an each instance before performing the upgrade process
491 mdk upgrade --all --update
496 You can write custom scripts and execute them on your instances using the command ``mdk run``. MDK looks for the scripts in the *scripts* directories and identifies their type by reading their extension. For example, a script called 'helloworld.php' will be executed as a command line script from the root of an installation.
500 # From anywhere on the system
501 $ mdk run helloworld stable_master
503 # Is similar to typing the following command
504 $ cp /path/to/script/helloworld.php /path/to/moodle/instances/stable_master
505 $ cd /path/to/moodle/instances/stable_master
508 Scripts are very handy when it comes to performing more complexed tasks.
513 The following scripts are available with MDK:
515 * ``dev``: Changes a portion of Moodle settings to enable development mode
516 * ``enrol``: Enrols users in any existing course
517 * ``undev``: Reverts the changes made by ``dev``
518 * ``users``: Creates a set of users
519 * ``webservices``: Does all the set up of webservices for you
524 Licensed under the `GNU GPL License <http://www.gnu.org/copyleft/gpl.html>`_