Some quick tips for better productivity when developing Drupal core:
- Alias your editor to
e. If you use a GUI editor see if it comes with a command-line shortcut to use. TextMate by default hasmate. Not nearly short enough ;). - Set up a
dcommand to perform diffs. I use the following:
#!/bin/bash
cvs diff -u -N -F^f . | grep -v -e ^\? > $1.patch
e $1.patch
This opens up my editor afterwards so I can review the patch before submitting. Thegrepstrips out unnecessary junk (unknown files). - Set up a
pcommand to apply patches. I use the following:
#!/bin/bash
wget -O - $1 | patch -p0
This will take a patch URL and apply it locally.
Anyone else have anymore ideas?

reverse patch
I struggled to get this working in my shell. This is from my .bashrc. I added an 'r'r function for removing the patch:
function p {wget -O tmp.patch $1; patch -p0 < tmp.patch
}
alias r='patch -p0 -R < tmp.patch';
Diffing + Translations
I use this to view CVS repository diffs:
alias ccc='cvs -z3 diff -Nup | vim -'This alias tells me which *.po files are translated to which extent:
alias checkpo='for i in *.po; do echo -n "$i: " ; msgfmt --statistics $i ; done'Uwe.
Fun at the Shell
Wow - those are fun productivity enhancers.
I used find to improve my Drupal productivitythe other day. It's not exactly the same kind of trick as your examples, but it was helpful and on the shell.
That test to apply the patch in one go would be real handy in the automated testing idea of merlinofchaos wrote about I'll have to link back here from over there...
drup
Everyone works differently but I like to cvs down a fresh drupal install every couple of days, just to know that I'm staying on the edge of development for each branch.
To that end crunchywelch and I wrote this:
drup newsite DRUPAL-5
#!/bin/bash
if [ $# != 2 ];
then
cat >&1 << EOH
USAGE: d takes two parameters destination and branch, in that order.
$0 dest branch
EOH
exit 1;
fi
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/ co -d $1 -r $2 drupal
mkdir $1/sites/all/modules
mkdir $1/sites/all/themes
mkdir $1/sites/default/themes
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib/ co -d $1/sites/all/modules/cck -r $2 contributions/modules/cck
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib/ co -d $1/sites/all/modules/views -r $2 contributions/modules/views
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib/ co -d $1/sites/all/modules/devel -r $2 contributions/modules/devel
mysqladmin -p create $1
Not as useful pre-5.0, but still does the trick when you need a quick install to test things on. If I ever get time I want to make install profile that enables the devel block and all that right here too, but thats for another time.
Post new comment