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.
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 intoconfig/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
.