Refactor and test `deploy`, part 2

This is a follow-up to https://github.com/zerovm/zpm/pull/65.

This change abstracts a few core pieces of the `deploy_project` logic into separate helper functions, and adds tests for them.