Refactor deploy-lock a bit

Some overall cleanup, with the addition of emitters so we can hook into the deploys.  Tagging @jmacadam and @doomspork for review.