h2. Version 0.4.5 * can now ask for @has_definition?(:my_param)@ or @has_definition?(:my_param, :description)@. * validate! and define each returns self, so you can chain. h2. Version 0.4.4 2011-05-13: MANY BREAKING CHANGES Killed many features for great justice. Configliere should now be much more predictable and lightweight, and has a much stricter API. Unfortunately, this will break backwards compatibility in some ways. h4. Cleanup of the Configliere::Params "Magic Hash" class * Configliere no longer modifies any core classes * All the hash gymnastics have been relocated to DeepHash. * DeepHash now converts *all* keys to symbols, and transparently handles deep keys:
Settings['foo.bar'] = 1 Settings.merge! 'foo.bar' => 1 Settings[ [:foo, :bar] ] = 1 # => all give { :foo => { :bar => 1 } }* DeepHash typeconverts objects of type Hash to DeepHash when merged or added. * DeepHash added several convenience methods -- @slice/slice!@, @compact/compact!@, @extract/extract!@, @reverse_merge/reverse_merge!@, @assert_valid_keys@. * Configliere::Params @#defaults@, @#resolve!@, @#validate!@ and @#use@ all return self, so you can say
Settings.defaults(:hi => :mom).use(:commandline).resolve!.validate!* Configliere::Params.use now adds middleware only to the *instance* -- you don't get commandline params in your settings object just becaus some other class use'd it. * Configliere::Params middlewares should supply a block to Configliere::Params.on_use to #extend the object, #use related middlewares, etc. h4. Cleanup of Configliere::Define. * The prepositional soup of accessor sugar is gone, replaced by three public methods: - @definition_of(param, aspect=nil)@ (without arg, gives the definition hash; with arg, gives that value); - @params_with(aspect)@ (hash of param => aspect_definition) - has_definition?(param) (has #define been called for that param?) see below for what's gone. * Specs for the magical getter/setter given when you define a param, and for deep key handling. * Commandline now tracks commandline arguments that haven't been define'd in @unknown_argvs@. It adopts them all the same, but if you don't like what you see there you're free to raise a warning or error. * Single-character flags now take an argument: @-a=hello@ or @-a hello@ h4. Misc * :encrypted keys are now stored as base64-encoded * cleaned up handling of encrypt_pass -- it's no longer publicly readable; set it as a member (Settings[:encrypt_pass]) or through the ENCRYPT_PASS environment variable and it will be adopted in the course of action (and, if a member, deleted). Because of the #use method refactoring, you can have independent settings bundles use encrypted independently. * Prompt is now its own middleware:
Settings.use :prompt pwd = Settings.prompt_for(:password)* bin/configliere shows off the git-style-binaries aspect, and helps you set encrypted params. * Specs documentation is now quite readable * Cleaned up the STDERR-capturing part of the specs * Added spork and watchr support to the specs. h4. Killing features for great justice: * No modifications to core classes. Scripts that were secretly depending on Configliere for blank? etc might now break. deep_merge, deep_set and deep_delete have been moved to a DeepHash class, and the Sash class is gone. * dashed commandline params are accepted but cause a warning -- they do *not* serve as deep keys. By default Configliere happily accepts them. To change that, make a middleware to either convert --foo-bar to --foo.bar, or convert --foo-bar to --foo_bar. * config_file now just takes a filename: Instead of a magic handle, scope a segment of the file with the :env option:
Settings.read('./config/foo.yaml', :env => ENV['RACK_ENV'])Stripped out a whole raft of oversweet sugar: * Settings.argv Settings.rest * Settings.commands? Settings.params_with(:command).empty? * Configliere.new Configliere::Param.new * param_or_ask Settings.prompt_for (with Settings.use(:prompt)) * param_definitions Not publicly accessible, use definition_of(param) * described_params Settings.params_with(:description) * type_for Settings.definition_of(param, :type) * typed_params Settings.params_with(:type) * required_params Settings.params_with(:required) * define with :no_help and :no_env_help (instead say @:internal@) * Removed the long-deprecated :git_style_binaries synonym for :commands h2. Version 0.3.4 The jump in minor version number was unintentional. * handle case wehre file is empty on environment merge * read returns self, so can chain h2. Version 0.2.3 * Added a feature to load only production/development/etc subhash from a config file, so:
Settings.read(root_path('config/foo.yaml'), :env => ENV['RACK_ENV'])h2. Version 0.2.1 2011-01-28 * Missing required params include their definition in error message * finally{} blocks don't supply a parameter any more -- use self instead. h2. Version 0.1.1 2010-08-17 * Settings.read now does expand_path on the file path h2. Version 0.1.0 2010-07-24 * Version 0.1 !!! * Single-letter option flags * Can give a ':finally' proc (or hand a block to) Settings.define. Example:
Settings.define :key_pair_file, :description => 'AWS Key pair file', :finally => lambda{ Settings.key_pair_file = File.expand_path(Settings.key_pair_file.to_s) if Settings.key_pair_file } Settings.define :key_pair, :description => "AWS Key pair name. If not specified, it's taken from key_pair_file's basename", :finally => lambda{ Settings.key_pair ||= File.basename(Settings.key_pair_file.to_s, '.pem') if Settings.key_pair_file }h2. Version 0.0.8 2010-05-02 * Provisional implementation of git-style binaries (foo-ls and foo-chmod and so on) * Minor fixes h2. Version 0.0.6 2010-04-05 * configliere/define and configliere/config_file are included by default. * fixed a bug when ENV['HOME'] is missing (running as root) h2. Version 0.0.5 2010-01-27 Configliere.use will load all gems by default h2. Version 0.0.4 2010-01-16 * Cured a variety of issues noted by "@monad":http://github.com/monad -- thanks for the feedback! h2. Version 0.0.3 2010-01-15 * @Settings.param@ now only works for params that have been @#define@'d :
Settings :no_yuo => 'oops' Settings.no_yuo #=> NoMethodError: undefined method `no_yuo' for { :no_yuo => "oops" } :Configliere::Param Settings.define :happy_param, :default => 'yay' Settings.happy_param #=> "yay"* Note that you *must* use symbols as keys (except for dotted notation for deep keys). See the README. * You must now define environment variables using @Settings.env_vars :param => 'ENV_VAR'@. The order was switched to consistently use param as the key. Also, @environment@ was renamed to @env_var@ to avoid confusion with the "development/test/production" convention from rails and friends. * die takes an error code as option * Added example scripts for encrypted and config_block scripts * The directory path to a config_file will now be created automatically