Renaming modules from the command line
As we continue to build Tau Station, the free-to-play narrative sci-fi MMORPG (what a mouthful!), we find our code base is getting larger and larger. As with any large codebase, we've found ourselves sometimes mired in technical debt and need a way out.
One simple hack I wrote has saved so much grief with this process. I can run this from the command line:
bin/dev/rename-module.pl Veure::Old::Module::Name Veure::New::Module::Name
And it automatically renames the module for me, updates all references to it, creating directories as needed, renaming test classes built for it, and uses git
.
This is that script:
It is, of course, a bit of a hack and obviously uses a few custom tools we've built ourselves, but curiously, it hasn't botched a rename a single time, including one I did this morning which resulted in a diff of over 1,000 lines.
Though "lines of code" isn't a great metric, if you count our Perl, our Javascript, our CSS, and our templates, we're pushing in on half a million lines of code in Tau Station. Even tiny tools like this can make life much easier. Now that we're not afraid to make sweeping namespace reorganizations, it's easier to keep on top of technical debt.
Leave a comment