Updated script by moving functions to support files

- Function definitions have been removed from .rake files and placed
  into support files.

- Fixed a rake task bug in which all database tests would fail when
  invoking the build task on a freshly cloned repo without ever having
  run the test task. The test task generates a db for the test
  compilation to pickup, but the build task was not generating one. So
  if none existed, the tests would fail.

Signed-off-by: Byron Sanchez <bfs5030@gmail.com>