oojs-update.sh: Replace target dir instead of adding file copies
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 19 Apr 2014 00:48:59 +0000 (02:48 +0200)
committerKrinkle <krinklemail@gmail.com>
Sat, 19 Apr 2014 01:12:59 +0000 (01:12 +0000)
commit8871180029c07becaa9def688c0b27a9203b5b0c
treeb0186b1241265466123c946527c9a835de847308
parent528ab63985bd9256412a981876acfd714f0aba05
oojs-update.sh: Replace target dir instead of adding file copies

* A command like "cp dist/* $TARGET_DIR" does not remove files
  that were deleted in the release dist. Using rsync instead.

  Though addition can happen, deletion should never happen as we
  refer to these files in Resources.php. But we also shouldn't
  leave behind old files mixed with new files, so delete them.
  Our structure unit tests for resources take care of catching
  references to files that don't (or no longer) exist.

* Use bash -n instead of != "".

* Refactor slightly to make it re-usable in other projects without
  too much modification (only REPO_DIR and TARGET_DIR need updating,
  the rest is generic now).

* The "git commit <dir>" doesn't properly take care of staging
  deletion of files removed by the update script, nor does it
  reliably (?) stage new files.
  Instead using a combination of "git add -u <dir>" (The -u
  stages deletion and modifcation of tracked files), and
  "git add <dir>" (stages modification and creation of files in
  that directory).

Change-Id: Ieb20978c887c5a141f31cab704b8d239f1572af0
maintenance/resources/update-oojs.sh