rconftool 0.1 review
Downloadrconftool is a reimplementation of Sam Varshavchik's sysconftool in Ruby
|
|
rconftool 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.
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.
Installation
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
Usage
(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
require 'rconftool'
# install single files
Rconftool::install('foo.dist', 'foo')
Rconftool::install('foo.dist', nil, nil, :strip_regexp=>/.dist$/)
Rconftool::install('foo.orig', 'foo.txt')
Rconftool::install('bar.orig', nil, nil, :strip_regexp=>/.orig$/,
:add_suffix=>'.txt')
# using the command-line interface
argv = ['--recursive','--targetdir','/etc/foo','.']
rct = Rconftool::Processor.new(argv)
rct.run(argv)
rconftool 0.1 search tags