Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

177 lines (118 sloc) 7.54 KB

Version 0.4.10

Minor improvement to the sub-command (git-style) module. Still not great.

Version 0.4.9

Gemfile dependencies less aggressive.
Uses MultiJSON; removed strict dependency on JSON

Version 0.4.7

  • can now load JSON
  • updated specs to run on Windows
  • Only accepts things that are to_sym’bolizable as keys
  • pings on commit

Version 0.4.6

Unwittingly moved DeepHash’s alias_method(:merge,:update) above the redefinition of update, and so made merge be quietly broken. Fixed, and many more specs added.

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.

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.

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[''] = 1
  Settings.merge! '' => 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.

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


  • :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.

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 —, 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:'./config/foo.yaml', :env => ENV['RACK_ENV'])

Stripped out a whole raft of oversweet sugar:

  • Settings.argv
  • Settings.commands? Settings.params_with(:command).empty?
  • 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

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

Version 0.2.3

  • Added a feature to load only production/development/etc subhash from a config file, so:'config/foo.yaml'), :env => ENV['RACK_ENV'])

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.

Version 0.1.1 2010-08-17

  • now does expand_path on the file path

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 }

Version 0.0.8 2010-05-02

  • Provisional implementation of git-style binaries (foo-ls and foo-chmod and so on)
  • Minor fixes

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)

Version 0.0.5 2010-01-27

Configliere.use will load all gems by default

Version 0.0.4 2010-01-16

  • Cured a variety of issues noted by @monad — thanks for the feedback!

Version 0.0.3 2010-01-15

  • Settings.param now only works for params that have been #define’d :
    Settings :no_yuo => 'oops'
    #=> NoMethodError: undefined method `no_yuo' for { :no_yuo => "oops" } :Configliere::Param
    Settings.define :happy_param, :default => 'yay'
    #=> "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
Jump to Line
Something went wrong with that request. Please try again.