markbates / configatron

A super cool, simple, and feature rich configuration system for Ruby apps.

Home Page:http://www.metabates.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hook for configuration factory?

neontapir opened this issue · comments

I have a question. In my console application, I converted from a homebrew configuration module to Configurator. It tracks say a dozen items and I want to keep the setup logic encapsulated in a factory class. In most circumstances, I only want to setup Configurator once because it's involved. However, during unit testing, I want to generate different configurations against a blank Configurator to ensure various command-line parameters behave as expected.

Since Configurator already mostly supports this use case through 'temp', is there a way I can either:

  • reset Configurator to a blank state to eliminate the change of test run order playing a factor
  • hook in my factory class create method into Configurator, so I don't need to memoize the standard configuration?

Thanks,
Chuck

You can completely clear configatron settings to a blank slate with

configatron.reset!

Perfect, that satisfies my use case! Thanks!