Modulator - Very Quick Module Skeltons - written in Perl

Recently I stumbled upon the "modulator", a script that builds a .module, .install, and .info files for you on the fly, naming the files along with the functions as well.

The script is written in Perl, I know this is not the "Drupal" way, but it is darn easy to use. Normally you would need to build these files by hand or piece one together. There is also a "module" to build a module skeleton for you - module builder. I prefer the Modulator simply because it is faster.

The script also works a bit with SimpleTest (see below) too, a nice feature.

Here are the features (taken from script comments):
# - creates a module folder and associated file skeletons
# - generates a test class and test methods and places them in a test file
# recognized by SimpleTest. This currently only covers unit tests,
# and not higher level tests like functional or integration tests.
# - can be re-run throughout module development
# - if you add a new function to a module, rerun the script and a test
# stub will be generated and placed in the appropriate test class
# - works with existing modules
# - adds hook_simpletest to an existing module

Here is how you run the script, for those who are not familiar how to run Perl scripts (Download the script to your server first - before proceeding):

  • Open up your shell (or SSH)
  • Go to the directory where you put modulator.pl
  • Run it with: perl modulator.pl [module_name] [group_name] [tab_space]
  • You're done!

The notes in the script explain what [module_name] [group_name] [tab_space] represent. Very nice options...

What would I change? Make this into a module, to mesh with Drupal's way of doing things.

A big thank you Andy Michaels @ Achieve Internet!

webchick

06.29.2008

See Module Builder: http://drupal.org/project/module_builder.

It'd be nice to get some patches over there that add in functionality like SimpleTest creation.

Rafael Ferreira Silva

06.30.2008

Very good tip! I'll start to use this for my projects!

Andy Michaels

07.14.2008

Hey, glad to see someone using that code! When I first shopped it around, I got mixed reviews. Some condemned it as "yet another thing that does something that something else does". Others saw some value in it, so I floated it around as I saw fit. Achieve was cool enough to allow me to basically give it away. As you stated, it's not *exactly* the Drupal way, but it didn't seem to fit as a module, since that'd require you to visit your site to use it. Maybe I missed something. I had talked to a few people about further development, but alas, Achieve shut down NYC operations and I moved on :( @webchick - it does create stub simpletest functions. What's nice is, adding a new function only requires a few keystrokes to get the new test stub created. If you have some specific things you'd like to add, I'd consider adding it myself. Drop me a line. -Andy

Andy Michaels

07.14.2008

Maybe I should learn to read. Strike the comment to webchick. She was talking about module builder. Stupid jetlag.

Bèr Kessels

12.04.2008

Alternatively, have alook at the very nice Ruby Gem for building modules: http://vision-media.ca/resources/drupal/drupal-module-builder-gem

elvis

12.04.2008

@Kessels, thanks for the update. It looks like a useful module!

TJ Holowaychuk

12.04.2008

Cool stuff! the gem is undergoing majorrrrr refactoring btw, and will feature some pretty cool functionality brought over from some of my other gems. As I mentioned to Bèr it may never see the refactoring it needs though, depending if I stay with Drupal or move on with life and enjoy Ruby (and enjoy it MUCH more than PHP :) )

elvis

12.05.2008

@TJ, I would encourage you to stay with Drupal :)

TJ Holowaychuk

12.05.2008

I may have no choice for the near future, but eventually I hope to work primarily with ruby / rack /  mack and work on a Ruby implementation of Drupal.

Thanks to the distributed nature of ruby it would actually be relatively 'quick' to get a comparable framework up and running, so I will see how it goes :)

Name
E-mail (Kept Private)
Your Website
CAPTCHA
Are you human?
Image CAPTCHA