From: Chris Kottom Date: 2011-03-08T15:15:16+09:00 Subject: Re: gem to deal with config file / program options --000e0cd5918402327e049df27b7b Content-Type: text/plain; charset=UTF-8 For command line arguments, Ruby's OptionParser is a part of the standard library. http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html For YAML configuration files, I've never needed anything so complex that I couldn't get there with a combination of YAML::load_file and Hash#merge using Ryan Bates' Railscaston YAML configuration files as a sort of loose template. Are you looking for something more sophisticated than that? On Mon, Mar 7, 2011 at 11:27 PM, Shadowfirebird wrote: > Hi all, > > Short version: What gems do people use to deal with program options in a > YAML file and taken from the command line? I seem to have too much choice > to make a sensible decision as to which to use. > > > Long version: > > I mostly write command-line ruby programs and I've getting fed up with > dealing with program options. You know the sort of thing: my program > collects command line options using optparse; saved options from a YAML > file; and implicitly knows good defaults for these. The idea being that > these three all end up in a hash that the gubbins of my program can refer > to. > > I've decided that rather than dealing with this in a half-arsed manner I > want to get it right this time. I don't mind rolling my own, but obviously > if there's a gem that does it for me, I'll use that. The problem is that > there are hundreds of gems called config-something, and half of them look as > if they might do the job -- if there was any documentation... > > (The real trick I'd like to pull is to specify the YAML filename on the > command line, but still have the command line options override those in the > YAML file.) > > What does everyone else use? > > Ta, > Shadowfirebird. > -- > It's easier to take it apart than to put it back together. > -- Washlesky > > --000e0cd5918402327e049df27b7b--