Home

Handy Drupal Core Development

Apr 12, 2006

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 has mate. Not nearly short enough ;).
  • Set up a d command 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. The grep strips out unnecessary junk (unknown files).
  • Set up a p command 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

Apr 13, 2006 Anonymous

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

Apr 13, 2006 Uwe Hermann

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

Apr 14, 2006 greggles

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

May 22, 2007 Sam Tresler

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

Note: all posts containing spam will be removed.
The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <b> <dd> <dl> <dt> <i> <li> <ol> <u> <ul> <img> <em> <p> <br> <span> <div> <h2> <h3> <abbr> <small> <table> <tr> <td> <strong> <acronym> <th> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

Recent comments

Images