From: dima Date: 2007-10-02T15:50:02+09:00 Subject: Re: Config files On Oct 2, 5:26 am, BJ Dierkes wrote: > I prefer using standard *nix style configuration files in the form of > 'param = value'. I wrote a class to read this type of configuration > file called ParseConfig. > > http://rubyforge.org/projects/parseconfig/ > > It is available via rubygems/rubyforge: > > gem install parseconfig > > Usage is really simple. Say you have a config file that looks like: > > --- > user = 'username' > pass = 'password' > log_file = '/var/log/mylog' > --- > > A quick example to use this config would be: > --- > require('rubygems') > require('parseconfig') > > config = ParseConfig.new('/path/to/config/file') > user = config.get_value('user') > pass = config.get_value('pass') > log_file = config.get_value('log_file') > --- > > If you all have any suggestions, etc... you can submit them via the > RubyForge Tracker. > > On Oct 1, 2007, at 6:21 PM, Lee Jarvis wrote: > > > I am writing an application that will read and grab values from a > > configuration file. I am wondering what peoples opinions are on > > what to > > use. YAML? XML? Does anyone have any preference? Are any better > > then the > > others or is it just down to user preference? > > > Thanks > > -- > > Posted viahttp://www.ruby-forum.com/. As told so menu times before: There is no golden hammer. The optimal solution depends on your application needs and estimation about future use of it. The yaml is more human readable. XML is universal and can be used by other applications but has some overhead. Classical config files are something programmers used to and it's portable and more or less human readable. There is also a data base configuration but that is out of the scope because you should have configuration for database that holds configurations for application. Personally, the yaml version is a way to start. If some need emerge that can't be natively expressed by yaml than you should move to other solution. But most probably you will stay on yaml.