A Drush command to refactor a project/module/theme by renaming its folders, files and function namespaces with a search/replace algorithm.
Usecase
- You started your subtheme with the name "bootstrap_EXAMPLE", now it's finished you want it to be "bootstrap_specialproject".
- You created a great Feature on one site "feature_onesite" and you want to reuse it on a second site -> "feature_secondsite".
- While developing there are a lot of situations where you want to flip a project name to a different name. That is what this drush module does.
- This is offcourse also possible with IDE tooling like phpstorm. This drush module is more like a fast helper.
What it does
- Copy project to a new location
- Renames all files and folders inside a project recursively
- Replaces all occurrences of a namespace inside all project files.
Examples
$ drush refactor-project bootstrap_test bootstrap_final
Renames project "bootstrap_test" to "bootstrap_final" and places the folder "bootstrap_final as sibling of "bootstrap_test".
$ drush rp --oldname="project_to_refactor" --newname="project_refactored" --target-directory="sites/all/modules/custom"
Renames project "project_to_refactor" to "project_refactored" and places the folder "project_refactored" in "sites/all/modules/custom".
$ drush rp --help
Get help information and examples.
Options
--newname : New namespace
--oldname : Namespace of project that must be renamed
--target-directory : Directory relative to Drupal root where to place the renamed project.
Installation
$ drush dl refactor_project
$ drush cc drush
or
Download this module and place it inside .drush directory in your user directory: ~/.drush/refactor_project
Project information
- Created by ndf on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.

