resourceloader: Rewrite the minify.php maintenance script
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 6 Aug 2019 16:27:17 +0000 (17:27 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 6 Aug 2019 16:39:19 +0000 (17:39 +0100)
commitfb6808df4b2cafe6bdb4fb6f292164f2b5fd6467
tree92d417c06fadf87d9d48cc67974f0ff164a6cca8
parent774d8c0bc85460c961210a7ffca6a29de481c921
resourceloader: Rewrite the minify.php maintenance script

* Remove the options of writing to a directory or a ".min.EXT" file,
  this made sense long ago when the script was used for producing
  final artefacts to check into SVN. But not today when it is mainly
  for testing out minifier behaviour.

* Add support for reading from standard input.
* Add support for setting --type (especialy for standard input).
* Add support for writing to standard output.

* Make --outfile optional. Write to standard output by default.

* Register <file> via Maintenance::addArg(), so that it shows
  up in --help. And so that we don't need our own validation for
  this as a required argument.

Test Plan:

  Run `echo 'x = true;' | php maintenance/minify.php --type js -`
  Output should be "x=!0;"

Change-Id: I0fdbedc713f66b9bd25eb8cb7334252cef7e20a8
maintenance/minify.php