User:Frédéric Massart: Difference between revisions
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
== Typical workflows using MDK == | == Typical workflows using MDK == | ||
To discover what MDK can do for you, here are a few common tasks | To discover what MDK can do for you, here are a few common tasks. | ||
=== Installing a new instance === | === Installing a new instance === | ||
mdk create -i -v 24 -e pgsql | We need to create a new instance of Moodle 2.4 and install it on PostgreSQL. We also want the instance to be ready for development by editing the config settings. And creating a bunch of users. | ||
mdk create -i -v 24 -e pgsql -r dev users | |||
This is the equivalent to doing: | This is the equivalent to doing: | ||
Line 24: | Line 26: | ||
php admin/cli/install.php --wwwroot="http://localhost/stable_24" --dataroot=/dir/to/stable_24/moodledata --dbtype=pgsql --dbname=stable24 --dbuser=root --dbpass=root --dbhost=localhost --fullname="Stable 24 PostgreSQL" --shortname=stable_24 --adminuser=admin --adminpass=test --allow-unstable --agree-license --non-interactive | php admin/cli/install.php --wwwroot="http://localhost/stable_24" --dataroot=/dir/to/stable_24/moodledata --dbtype=pgsql --dbname=stable24 --dbuser=root --dbpass=root --dbhost=localhost --fullname="Stable 24 PostgreSQL" --shortname=stable_24 --adminuser=admin --adminpass=test --allow-unstable --agree-license --non-interactive | ||
vim config.php | vim config.php | ||
# | # Add the following settings: | ||
# - $CFG->sessioncookiepath: /stable_24/ | |||
# - $CFG->debug: DEBUG_DEVELOPER | |||
# - $CFG->debugdisplay: 1 | |||
# - $CFG->passwordpolicy: 0 | |||
# - $CFG->perfdebug: 15 | |||
# - $CFG->debugpageinfo: 1 | |||
# - $CFG->allowthemechangeonurl: 1 | |||
# - $CFG->cachejs: 0 | |||
# - $CFG->yuicomboloading: 0 | |||
# Include FirePHP Core | |||
# Login to Moodle | |||
# Create 10 students, 3 teachers and 3 managers. | |||
=== Fixing an issue === | === Fixing an issue === | ||
Line 45: | Line 59: | ||
=== Peer reviewing a patch === | === Peer reviewing a patch === | ||
Here | Here we want to pull a patch from the tracker issue into a new testing branch, and then run the PHPUnit tests. | ||
mdk pull 12345 -t | mdk pull 12345 -t | ||
Line 66: | Line 80: | ||
=== Upgrading the instances === | === Upgrading the instances === | ||
We upgrade our instances as a new weekly release has just been released. | |||
mdk upgrade -u --all | mdk upgrade -u --all |
Revision as of 01:11, 22 February 2013
Moodle Development Kit
Every developer creates simple tools to avoid repeating cumbersome and/or boring tasks, and that is precisely why MDK has been created: to pack all those useful tools in a portable way accross systems. Initially developed in Bash, the project moved to Python to avoid dealing with inconsistencies between Unix platforms, and eventually to support Windows.
Key aspect
The most important aspect of MDK is that it works with Moodle instances. An instance of Moodle is a directory in which you have checked out a particular version and are using a specific database engine. This means that if you want to be working on Moodle 2.3 and 2.4 using both MySQL and PostgreSQL, you will have 4 directories. This choice was made because it is the safest, the clearest, and the most straightforward!
Typical workflows using MDK
To discover what MDK can do for you, here are a few common tasks.
Installing a new instance
We need to create a new instance of Moodle 2.4 and install it on PostgreSQL. We also want the instance to be ready for development by editing the config settings. And creating a bunch of users.
mdk create -i -v 24 -e pgsql -r dev users
This is the equivalent to doing:
mkdir /dir/to/stable_24/moodle mkdir /dir/to/stable_24/moodledata ln -s /dir/to/stable_24/moodle /var/www/stable_24 git clone git://git.moodle.org/moodle.git /dir/to/moodle cd /dir/to/moodle php admin/cli/install.php --wwwroot="http://localhost/stable_24" --dataroot=/dir/to/stable_24/moodledata --dbtype=pgsql --dbname=stable24 --dbuser=root --dbpass=root --dbhost=localhost --fullname="Stable 24 PostgreSQL" --shortname=stable_24 --adminuser=admin --adminpass=test --allow-unstable --agree-license --non-interactive vim config.php # Add the following settings: # - $CFG->sessioncookiepath: /stable_24/ # - $CFG->debug: DEBUG_DEVELOPER # - $CFG->debugdisplay: 1 # - $CFG->passwordpolicy: 0 # - $CFG->perfdebug: 15 # - $CFG->debugpageinfo: 1 # - $CFG->allowthemechangeonurl: 1 # - $CFG->cachejs: 0 # - $CFG->yuicomboloading: 0 # Include FirePHP Core # Login to Moodle # Create 10 students, 3 teachers and 3 managers.
Fixing an issue
mdk fix 12345 # Commiting your patch mdk push -t
This is the equivalent to doing:
git branch --track MDL-12345-24 origin/MOODLE_24_STABLE git checkout MDL-12345-24 # Commiting your patch git push github MDL-12345-24 # Editing the tracker issue to add # - Git repository URL # - Git branch for 2.4 # - Git compare URL for 2.4
Peer reviewing a patch
Here we want to pull a patch from the tracker issue into a new testing branch, and then run the PHPUnit tests.
mdk pull 12345 -t mdk phpunit -r
This is the equivalent to doing:
cd /dir/to/stable_24/moodle git branch --tracker MDL-12345-24-test MOODLE_24_STABLE git checkout MDL-12345-24-test git pull git://github.org/Someone/moodle.git MDL-12345-24 # And now the PHPUnit part mkdir /dir/to/stable_24/moodledata_phpu vim config.php # To add # - $CFG->phpunit_dataroot = '/dir/to/stable_24/moodledata_phpu'; # - $CFG->phpunit_prefix = 'phpu_'; php admin/tool/phpunit/cli/init.php phpunit
Upgrading the instances
We upgrade our instances as a new weekly release has just been released.
mdk upgrade -u --all
This is the equivalent to doing:
# For each instance of Moodle... cd /dir/to/stable_24/moodle git checkout MOODLE_24_STABLE git fetch origin git reset --hard origin/MOODLE_24_STABLE php admin/cli/upgrade.php --non-interactive --allow-unstable
Features
For a complete list of the commands MDK has to offer, read through the README file. For more details about each possible command, simply run them with the flag '--help'.
Installation
Debian/Ubuntu
sudo apt-add-repository ppa:2x1cq-fred-7nqa6/ppa sudo apt-get update sudo apt-get install moodle-sdk sudo mdk init # The next line prevents your from logging out and in again. sudo su `whoami`
Mac OS
brew tap danpoltawski/homebrew-mdk brew install moodle-sdk sudo mdk init
Installing MDK on Mac requires Homebrew, to install it use the following command.
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Windows
MDK has not been tested on Windows yet, but it should work, possibly after a few minor bug fixes.
Manual
Please follow the instructions from the README file.