wp-enforcer icon indicating copy to clipboard operation
wp-enforcer copied to clipboard

Rewrite for the PHP CLI?

Open stevegrunwell opened this issue 8 years ago • 8 comments

I'm considering rewriting the main wp-enforcer Bash script in PHP. It would still be run the same way, but rather than dealing with a very procedural scripting language we could a) leverage the PHP CLI Tools package maintained by the WP-CLI team, b) make testing the code for this [very WordPress-specific tool] way easier (see #16), and generally make the script more portable (considering the package is installed via Composer and thus only available in environments that can already execute code via the PHP CLI).

Anyone want to either talk me off that ledge or convince me to take the plunge before we hit a 1.0.0?

Cc: @bswatson @daveross @ericmann

stevegrunwell avatar Dec 02 '15 02:12 stevegrunwell

:+1:

johnpbloch avatar Dec 02 '15 02:12 johnpbloch

:+1:

bswatson avatar Dec 02 '15 02:12 bswatson

Anyone want to either talk me off that ledge

No, but I'll gladly give you a friendly shove ...

or convince me to take the plunge before we hit a 1.0.0?

A rewrite in a different language can potentially break backwards compat. If you're going to retain back-compat, by all means ship 1.0 and we can do a rewrite afterwards. If it's going to be a major usability change, we'd have to bump to 2.0 and provide upgrade instructions and whatnot. While semver allows for major releases to break compat, I think it's a really mean thing to do.

Particularly if people use 1.0, then find 2.0 is effectively a completely different product. If you're OK with that, ship. If it makes you as queasy as it does me, let's hold the release until post-rewrite.

ericmann avatar Dec 02 '15 05:12 ericmann

@ericmann you raise some very valid points – the goal is to not change the way the script works at all, just write it in a way that will be easier to maintain (as @daveross and @bradp have proven my Bash skills could use some work) and for other PHP devs to contribute to.

Also, PHPUnit. I loves me some PHPUnit.

stevegrunwell avatar Dec 02 '15 18:12 stevegrunwell

Also, PHPUnit. I loves me some PHPUnit.

got _6839d07db570250122cb4837d5738760

johnpbloch avatar Dec 02 '15 19:12 johnpbloch

An update on this:

In what little free time I've had recently I've started work on a more generic "Git hooks via Composer"-type package, which will then be utilized by WP Enforcer 1.0+ to have a more PHP-powered experience.

More details coming at a later date. For now, it's Star Wars' Day!

stevegrunwell avatar Dec 18 '15 20:12 stevegrunwell

Ahead of this I've started work on a more abstracted Git Hook package for Composer, with the goal of that being the underlying tool and WP Enforcer becoming a WordPress-specific implementation of GitHook'd. My hope is that would easily allow other devs to spin up projects like Drupal Enforcer, "PSR, PLS", and other clever Git Hook-powered packages.

stevegrunwell avatar Dec 21 '15 23:12 stevegrunwell

Another update: GitHook'd was a dumb name, and I know a lot more now than I did at the time.

Smee is the current plan, with WP Enforcer being rewritten as a WordPress-specific implementation of that library. Work is happening, just very, very slowly.

I blame the toddler.

stevegrunwell avatar Sep 18 '17 15:09 stevegrunwell