fmcorz / mdk Goto Github PK
View Code? Open in Web Editor NEWMoodle Development Kit. A collection of tools meant to make developers' lives easier.
License: GNU General Public License v3.0
Moodle Development Kit. A collection of tools meant to make developers' lives easier.
License: GNU General Public License v3.0
Attempting to run mdk create ... I get the following error -
File "/usr/local/mdk/moodle-create.py", line 35, in
Wp = workplace.Workplace()
File "/usr/local/mdk/lib/workplace.py", line 50, in init
self.cache = os.path.abspath(os.path.realpath(os.path.expanduser(C.get('dirs.mdk'))))
File "/usr/lib64/python2.7/posixpath.py", line 252, in expanduser
if not path.startswith('~'):
AttributeError: 'NoneType' object has no attribute 'startswith'
You came up with a quick fix for this problem:
index 286f89f..303c331 100755
--- a/moodle-backport.py
+++ b/moodle-backport.py
@@ -99,7 +99,7 @@ for v in versions:
debug("Preparing cherry-pick of %s/%s in %s" % (remote, branch, name))
# Stash
git version 1.7.0.4
The problem is that this developer in particular is forgetful (and I know i'm not the only one) and might forget to run the dev script. Then I submit something for integration with warnings in it and integrators think i'm a time wasting looser.
There also can be problems early in the moodle init process which might prevent the setting from the DB being applied earlier enough for some development tasks.
It would be great to install auth_mdk every new install with:
--plugin auth_mdk
It would be cool to have a mdk rebase command which automated fetch'd the branch from another issue.
For example, on working on Petr's branch I have to go to the issue, work out what his branch is named, then I do:
git fetch git://github.com/skodak/moodle/ w30_MDL-39846_m26_event2
git rebase b504e1231b9e4f4a6475f0cb09409d2c79861df5 --onto FETCH_HEAD
Ability to add a peer-review template in the comments filed would be nice!
The MDL number in the last commit does not match the branch being pushed to.
Branch: MDL-31356 vs. commit: MDL-31356:
Git cherry-pick origin/master..github/[branch to cherrypick]
Doesn't seem to work on my particular system set up.
adrian@adrian-desktop:~/moodles/stable_master_postgres/moodle$ mdk backport -v 23 -d
Preparing cherry-pick of github/wip-MDL-31776-master in stable_23
Fetching remote origin...
Fetching remote github...
Creating branch wip-MDL-31776-23
Cherry-picking origin/master..github/wip-MDL-31776-master
Error while cherry-picking github/wip-MDL-31776-master in stable_23.
fatal: Cannot find 'origin/master..github/wip-MDL-31776-master'
Done.
git version 1.7.0.4
I don't think the grammar here is quite correct:
mdk create
Creating instance stable_master...
Cloning stable repository into cache...
That's going to take a while...
I think it would be better to say 'This is going to take a while...', 'that' sounds incorrect to me, since its part of the same process.
If I was more intelligent I would be able to back this up with proper grammar rules, but i'm not - it just sounds incorrect.
Initially for shifter, jshint, and yuidoc:
mdk js [-s|--shift] [-d|--doc [port]] [-l|--lint]
The default should be context dependent:
mdk js -s -d
mdk -s
When we get YUITest and yeti off the ground, this should extend to:
This will need to:
.git/info/excludes
for /node_modules
; and then all/some of:npm install shifter
(for shifting)npm install yuidocjs
(for docs)npm install jshint
(for linting)npm install yeti phantomjs
(for device testing)By calling npm install
without the -g
(global) option, we install the modules into the node_modules directory in the CWD. By doing it in this way, we keep the versions of each tool matching the branch it's used against.
When generating documentation, we should link documentation against our own apidocs location (see https://tracker.moodle.org/browse/MDLSITE-2498) and use both the version number and git hash in the project-version option passed to it.
MDL-38173 has not branch for master and some weird behaviour happened:
$ mdk pull MDL-38173
Retrieving information about MDL-38173 from Moodle Tracker
Not enough information to pull the branch
Stashed your local changes
Pulling branch None from git://github.com/damyon/moodle.git into MDL-38173-master
Popped the stash
Done.
It's possible that you could speed up remote clones by making use of 'alternate object repository'. This puts the git object repository into a shared directory. It needs more research, but the basics are:
--reference <repository>
If the reference repository is on the local machine, automatically setup .git/objects/info/alternates to obtain objects from the reference repository. Using an
already existing repository as an alternate will require fewer objects to be copied from the repository being cloned, reducing network and local storage costs.
NOTE: see the NOTE for the --shared option.
One thing from using it in the past, is that I don't think that when you pull the new objects necessarily go into the shared repo.
I have it 10 times now!
It's because /var/www is not writable for the current user. So I did a chmod 777 /var/www but it's not super great if you deploy your dev environment in the cloud.
I confim the stable22 is still in alpha (HEAD). I'm not sure why it fails.
Otherwise it works well so far :)
I only recently discovered the other arguments to mdk phpunit, but having just tried it, I can't use it because it doesn't bash complete the path ๐ฏ (just discovered that emoticon accidentally ๐ฑ
e.g., I type:
phpunit coh <TAB> te <TAB> co <TAB>
And get
phpunit cohort/tests/cohortlib_test.php
And i'd like to do that with mdk phpunit -u
If someone has a patch which doesn't merge cleanly it'd still like to review it, so it would be nice if there was a way to checkout their branch without merging.
i.e. checking out the remote branch
typing the full name for branches can be a bit longwinded.
Given that by default, all integration branches start integration
and all stable branches stable
, it should be possible to make many commands take both -i
or -s
and the name. For example:
mdk update -i master
instead of:
mdk update integration_master
Which means it updates the tracker with no code in place
mdk backport -v master -t
/usr/bin/git remote -v
/usr/bin/git config --get remote.origin.url
/usr/bin/git symbolic-ref -q HEAD
/usr/bin/git remote -v
/usr/bin/git config --get remote.origin.url
/usr/bin/git remote -v
/usr/bin/git config --get remote.origin.url
Preparing cherry-pick of p25/MDL-39936-25 in pm
/usr/bin/git log -n 30 --format=%H origin/MOODLE_25_STABLE..MDL-39936-25
/usr/bin/git stash save
Fetching remote /Users/danp/moodles/p25/moodle...
/usr/bin/git fetch /Users/danp/moodles/p25/moodle MDL-39936-25
/usr/bin/git show-ref --verify --quiet refs/heads/MDL-39936-master
Creating branch MDL-39936-master
/usr/bin/git branch --track MDL-39936-master origin/master
/usr/bin/git checkout MDL-39936-master
Cherry-picking origin/MOODLE_25_STABLE..MDL-39936-25
/usr/bin/git cherry-pick 2e804059400a3f9c3d967305257eacac727643f6
/usr/bin/git log -n 1 --format=%H origin/master
Setting tracker fields:
Pull from Repository: git://github.com/danpoltawski/moodle.git
Pull Master Branch: MDL-39936-master
Pull Master Diff URL: https://github.com/danpoltawski/moodle/compare/b6f8a936425f93efc692e9b3afab32ed3228aefd...MDL-39936-master
Instance pm successfully patched!
If you run the following code, it will allow you to access your fork of moodle/moodle without prompting you with password or error when you try mdk push.
clear
echo "This script adds a new SSH key to you github account so you can push directly from this machine without entering your password once the script has ran. Your login/password will only be used to do SSL curl call - even thought the script is carefully tested to not have any bug, the script contributors or distributors CANNOT be hold reponsible for the script updating/deleting your Github rep and Github account."
read -p "Github username:" githubuser
stty -echo
read -p "Github password:" githubpassword; echo
stty echo
GETEMAIL=curl -u "$githubuser:$githubpassword" -i https://api.github.com/user/emails | grep -Po '\[*"([^""]*)"' | tail -1
EMAIL=${GETEMAIL//"/}
read -p "Enter your Github SSH passphrase - you will be prompt to enter it a second time very soon" githubpassphrase
ssh-keygen -f ~/.ssh/id_rsa -N "$githubpassphrase" -t rsa -C "$EMAIL"
sshkey=cat ~/.ssh/id_rsa.pub
jsonparams="{"title":"mdk ssh key", "key":"$sshkey"}"
curl -X POST -u "$githubuser:$githubpassword" -d "$jsonparams" -i https://api.github.com/user/keys
echo 'StrictHostKeyChecking no' > ~/.ssh/config
ssh -T [email protected]
The 'Process complete!' seems like the wrong result of this operation:
mdk create -i -r dev.php
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Creating instance pm...
Fetching cached repository moodle.git...
/usr/bin/git fetch
Cloning repository...
/usr/bin/git clone /Users/danp/.moodle-sdk/moodle.git /Users/danp/moodles/pm/moodle
Checking out branch...
Error creating pm:
This is not a Git repository
Traceback (most recent call last):
File "/usr/local/Cellar/moodle-sdk/0.4.2/libexec/moodle-sdk/lib/commands/create.py", line 164, in do
M = self.Wp.create(**kwargs)
File "/usr/local/Cellar/moodle-sdk/0.4.2/libexec/moodle-sdk/lib/workplace.py", line 123, in create
repo.setRemote(C.get('myRemote'), C.get('remotes.mine'))
File "/usr/local/Cellar/moodle-sdk/0.4.2/libexec/moodle-sdk/lib/git.py", line 255, in setRemote
if not self.getRemote(remote):
File "/usr/local/Cellar/moodle-sdk/0.4.2/libexec/moodle-sdk/lib/git.py", line 119, in getRemote
remotes = self.getRemotes()
File "/usr/local/Cellar/moodle-sdk/0.4.2/libexec/moodle-sdk/lib/git.py", line 125, in getRemotes
result = self.execute(cmd)
File "/usr/local/Cellar/moodle-sdk/0.4.2/libexec/moodle-sdk/lib/git.py", line 90, in execute
raise Exception('This is not a Git repository')
Exception: This is not a Git repository
Process complete!
(I think the error occurred because the cwd was a directory i'd just removed with mdk remove. Probably it should abort at that point).
For easy install.
I have done a quick first stab at it here:
https://github.com/danpoltawski/mdk/compare/debian-packaging
To test it out:
apt-get install build-essential devscripts debhelper
cd mdk
debuild -us -uc
cd ../
dpkg -i moodle-mdk[blahblah].deb
Some things to make it proper would be:
mdk phpunit -u li-bash: compopt: command not found
-bash: compopt: command not found
st.txt
If the instance directory is 0777 and the web installer creates the config.php, it is then not readable. This has to be handled nicely.
Please... for the love of my sanity, make MDK more shell-like in this way?
As far as I can tell from mdk config list, there isn't a configuration item for it?
I would like to change mine to https://dan.moodle.local (because I like to test with https, and also like to be able to access it from iPad/iPhone)
Fix that by modifying the umask.
Its pretty easy to accidentally use the wrong bug number (miss a digit, etc) and so it'd be good to play a bit safer with the tracker.
My thought is that before actually updating the tracker it could be a simple confirmation like:
"Are you sure you want to update:
MDL-xxxxx Bug summary from tracker
y/n"
Defaulting to y, so you only need to press y. I don't think it'd be tooo slow, but you could make this a config file option (and i'll laugh and point at people who don't use it and update the wrong bugs).
To check and fix the remotes/wwwroot for instance.
I know that it's virtually impossible for a child process to change the path of it's parent, but it would be hand to be able to do something like:
cd mdk info -p integration_master
mdk create -t -i -r dev -v master -s mysql -e mysql
usage: moodle-create.py [-h] [-t] [-i] [-r [run [run ...]]] [-v version]
[-s suffix] [-e engine]
moodle-create.py: error: argument -e/--engine: invalid choice: 'mysql' (choose from 'mysqli', 'pgsql')mdk create -t -i -r dev -v master -s mysql -e mysqli
Creating instance im_mysql...
Cloning repository...
Checking out branch...
Creating database...
Installing im_mysql...
Moodle 2.4beta+ (Build: 20121123) command line installation program
Error, incorrect value "mysqli" for "dbtype"
Traceback (most recent call last):
File "/home/damyonw/Documents/Moodle/mdk/moodle-create.py", line 99, in
M.install(**kwargs)
File "/home/damyonw/Documents/Moodle/mdk/lib/moodle.py", line 274, in install
raise Exception('Error while running the install, please manually fix the problem.')
Exception: Error while running the install, please manually fix the problem.
The cached remote should be a mirror repository.
The option of using cache as remote should be removed in favor of this, and the update of the mirror should be done in the background.
The update of the mirrored repo should happen either (pick one):
cd [yourmoodledir]/install
mdk behat -r
The php webserver will be started in the wrong directory and behat will fail.
git reset --soft HEAD^
git commit -a -m "THE LAST COMMIT MESSAGE"
mdk push --force
mdk pull
Traceback (most recent call last):
File "/home/damyonw/Documents/Moodle/mdk/moodle-pull.py", line 52, in
issue = re.sub(r'(MDL|mdl)(-|_)?', '', args.issue)
File "/usr/lib/python2.7/re.py", line 151, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or buffer
sudo mdk install --engine pgsql
Creating database...
Installing integration_master...
OSError: [Errno 2] No such file or directory
Note:
I wonder if this error could be due to the config.php that can not be written. I remember you told me about a debug/verbose mode to see exactly when mdk crashed and what it was doing, how do I enable it?
moodle-create.py: error: argument -v/--version: invalid choice: '25' (choose from '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', 'master')
Please explain.
Say your current stable_master is on 2.5, but we just released a new version and so masterBranch is set to 26. Then running mdk update on stable_master will not reset to the master branch but to origin/MOODLE_25_STABLE.
This is seen as a bug from the user, but that is caused by the version.php file still displaying branch = 25. A manual git reset on the master branch will fix the issue.
Not sure how to fix this, or how to prompt the user for the right action.
There's rarely a time when you don't want to purge caches after pulling a fix in. I'd argue that we should purge caches as we pull in a patch, but provide a --no-purge | -P option for those times when you don't want to.
It would be nice if --tracker accepted a reference to another branch, commit, or HEAD^ when pushing to the tracker.
Some commands will trigger git gc
which can take a very long time to be done. Preventing this would be useful.
git://git.moodle.org/moodle.git should be named production, as the branch master IS NOT stable, only the stable branches are. The use of the word stable is very confusing.
I challenge you to work out which are talking about remotes and which are branches:
wording.prefixStable: stable_
wording.prefixMaster: master
wording.integration: Integration
wording.master: Master
wording.stable: Stable
mdk selfupdate (so it updates mdk automatically - it would be good if mdk can detect an update)
mdk fix -timetracking (keep track of the time I stay on an issue - save it in a text file)
mdk plugin XXXX (XXX being the git repository, recognize the plugin name and automatically install in the correct directory)
mdk praise XXXX "This is top cool" (because blame is not a positive attitude - send an jabber message / tracker issue comment to thanks someone for their work on the issue XXXX)
mdk jemapelle YYYY (send a jabber message to mark)
mdk beer (redirect you to paypal to send $12 to Fred as it's the price of a beer in Perth)
mdk nothing (because you love to type mdk)
Or when a --verbose option is passed - so that when something doesn't work I can run it manually and see whats going wrong
If I get time to do this I'll let you know.
Its confusing to have different ones. I would suggest changing (or at least aliasing) mdk push to -j for consistency before too many people use it ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.