Refactor database connection setup code
Refactor database connection setup code

* Fix code indentation
* Change repository lookup to use Hash#fetch and to raise a better error
  message when an unknown environment is specified.

datamapper/dm-rails