konklone / oversight.garden

Bringing together the oversight community's work.
https://oversight.garden
Creative Commons Zero v1.0 Universal
26 stars 9 forks source link

Refactor config/environment.rb and rake tasks for encapsulation #89

Closed konklone closed 8 years ago

konklone commented 8 years ago

This removes the use of Ruby global variables in favor of an Environment class with a few magic class methods. The encapsulation is easier to manage and predict, and I think it cleans up the code a bit.

I also moved the Elasticsearch client creation out of rake altogether and into config/environment.rb, so that that can all be loaded in in the :environment task, and the dependencies by other tasks can just be on :environment.

divergentdave commented 8 years ago

Excellent, thank you for cleaning up my use of globals!

konklone commented 8 years ago

Phew! Took me a few tries to fix the tests. The test suite is really comprehensive, thanks for setting it up @divergentdave.