2

I'm currently developing my first custom module for Drupal 7 and am having a hard time finding documentation about the available local deployment strategies.

I have a custom module project, consisting of my modules sources, a gulp file and some other things of less interest (README, .editorconfig, ...). When I make a change on my source code, my gulp builder automatically deploy the changes to my local Drupal installation (the document root), in the folder where my custom module is installed.

Now, I would like to test my changes, and that's where I'm stuck: changes that are part of the install hooks of the module (adding fields, custom nodes, and so on) don't appear on the website. I have to disable my module, uninstall it, resinstall it and enable it to see those changes. This is a very long and painful process.

Even using drush commands to achieve this, the disable, uninstall, install and enable process is very long, meaning I'm losing a lot of time waiting for Drupal to manage my module, even for the tiniest source code change.

And of course, in any case, I have to recreate every content I had previsouly created to test my module.

Is there a strategy to allow near-realtime deploy and testing when developing a custom module ? How are you guys dealing with this ? Is there at least a drush command to replay the install hooks of my module ?

Thanks by advance.

1

I do not think there will be a way to reduce time of reverting the database changes. However you can get a shortcut command to re-install a module.

Checkout answer by @MPD Quick Uninstall/Reinstall of a Custom Module, so you will need devel module to bind all those commands in one, also devel is good for development purpose.

1

In many cases you can develop and test your code outside the install/uninstall hooks, and when you know it's working you simply add it to the hooks and run it once or twice.

You can also use Backup & Migrate and do a quick db restore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.