rconftool is an implementation of sysconftool in Ruby.
Version: 0.1rconftool is a reimplementation of Sam Varshavchik's sysconftool in Ruby. Its purpose is to keep configuration files "fresh" when upgrading an application from one version to another, ensuring that all necessary settings are present and obsolete ones removed.
License: MIT/X Consortium License
Operating System: Linux
To use it, application writers need to distribute their config files marked up with some simple metadata in comments, and arrange for the 'make install' or 'make install-configure' target to invoke rconftool.
rconftool can be called as a library function or from the command line. It can also install groups of files recursively from one directory tree into another.
rconftool is distributed under the MIT licence.
You can just use rconftool.rb from the current directory, or copy it anywhere into Ruby's library search path. The following command will do this for you:
# ruby install.rb
(1) As a command-line tool
# ./rconftool.rb foo.dist
Installs 'foo.dist' to 'foo' (option --strip-suffix '.dist' is the default)
# ./rconftool.rb --strip-suffix '.orig' --add-suffix '.txt' *.orig
Installs files foo.orig and bar.orig as foo.txt and bar.txt
# ./rconftool.rb --recursive --targetdir /etc/foo .
Installs all files in the current directory and its subdirectories into /etc/foo recursively. (Suffix '.dist' is still stripped off by default, unless you specify --strip-suffix ""). /etc/foo itself must exist, but subdirectories are created if necessary.
(2) As a library
# install single files
Rconftool::install('foo.dist', nil, nil, :strip_regexp=>/.dist$/)
Rconftool::install('bar.orig', nil, nil, :strip_regexp=>/.orig$/,
# using the command-line interface
argv = ['--recursive','--targetdir','/etc/foo','.']
rct = Rconftool::Processor.new(argv)