Do a "prepare" before a "serve"
Refactored code and added tests.
Merge pull request #393 from hiddentao/serve_prepare

Run cordova.prepare before doing phonegap.serve so that we can use prepare hooks