Komodo Macro for creating new Drupal modules

I've been playing around with Komodo a bit lately, and have been intrigued by the tools available to customize the development environment.

One of the more powerful features in Komodo is the ability to create 'snippets', 'commands' and 'macros'. They say that whatever can be automated should be automated when developing code. The less monkey work you do the better, and snippets, commands and macros are a great way to reduce said monkey work.

As an experiment I created a macro that will create a module stub. When run, the macro asks you to name your module. It then creates the module folder, the three primary module files and a 'test' directory.

Limitations:

  • The macro is for a windows development environment.Update:Thanks to jeffG I have OS detection - but it is not tested in a non windows machine - still it should work
  • There is no error handling
  • There is no input validation
  • The macro assumes the project file is in the root of your drupal project folder

Possible Improvements:

  • Fix the limitations
  • Have the macro insert snippets of code into the files
  • Rather than 'runEncodedCommand' - break commands into Komodo 'commands' and call them in order

Update: Attached is version 0.1 an update to the original macro.

andre

AttachmentSize
create new drupal module stub.kpz1.7 KB
create new drupal module stub - 0.1.kpz1.85 KB
March 10th 2008 7AM
By: andre
File Under:

 

Comments

I took the time to look at

I took the time to look at Komodo today. I have been using Dreamweaver to develop Drupal code but it does not have any code insight fro Drupal.

Komodo is capable of reading any directory of php files and reading the functions so it is ideal for Drupal development.

Andre, thanks for adding

Andre, thanks for adding this for Komodo. I just started using Komodo and I love the power it brings to the table.

BTW, what captcha settings are you running to get your letters big, clear, and wavy?

Regards

Where's the Code?

Sorry, where's the code?

If you want, I can give you hints on how to get the Macro to work cross-platform. In particular, you can use the AppInfo XPCOM component in Mozilla to detect Windows:

var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
getService(Components.interfaces.nsIXULRuntime);

if (appInfo.OS == 'WINNT') {
// windows-only stuff
}

As well, using Run_RunEncodedCommand can be quite useful if you supply an option callback. This allows you to execute additional JS code after the command is completed:

ko.run.runEncodedCommand(window, 'perl -e "sleep(10);"', function() {
alert('command is finished!');
});

File Attached

For those that didn't quite see it - the file is attached to the page.

Or click here to download.

I will add the OS detection and switch the command to use 'touch' in non windows systems.

Update: New version here: http://becircle.com/files/create%20new%20drupal%20module%20stub%20-%200....

andre