james-henderson/nomad — pull request #11 by dparis (2014-08-05 05:54:51+00:00)
Title: Refactor internals, add read-config function

As per the discussion in #10, I've added a function called `(read-config ...)` which takes a file path string or resource object. I've also refactored some of the internals to be a bit more idiomatic:

- Removed unnecessary macros. They weren't bad, but I like to adhere to the [first rule of macro club](http://clojurefun.wordpress.com/2013/01/09/when-do-you-need-macros-in-clojure/). Without those macros, there are no more magic functions defined in the namespace, fewer refs which means less mutable state, and I think the `(with-location-override ...)` macro is more threadsafe since it's now using with-redefs which updates the bindings for all threads.
- The only state remaining is contained in the `config-cache` atom which holds a hash map. The map is keyed by the file-or-resource used to init the config, and maps to the current config data. All of the current cache/update semantics are preserved, as far as I can tell.
- Some minor reorganization and formatting changes.

All of the current test suite passes cleanly. If you like, I can add a test for the `(read-config ...)` function, but since it just passes through to the already well-tested `(get-current-config ...)` functionality, it seemed reasonable to omit.

Let me know if you have any questions/comments. Cheers!