Project Description
Variable Substitution Utility for Configuration Management (FinalBuilder etc)

More Info
A small utility for configuration management that takes an input file, a “substitute” file to be processed and a series of “sections” to use to perform the replacement. Created as a replacement for the "built in" variable substitution options in FinalBuilder.

So for example, if you had the following INI file:




And a “substitute” file as follows (this obviously isn’t a configuration file, it’s purely a very basic sample :-) ):

Subversion Server: %SVNServer%:%SVNPort%

Server: %Server%
Details : %Username% / %Password%Running it through the utility and specifying the MAIN and INT sections (I generally use a “global” section, then configuration specific sections) would give us:

Subversion Server: MySvnServer:80

Server: IntServer
Details : IntUser / Password

It’s a very, very simple utility, and indeed very little code; but I thought it might be of use to people who might be using FinalBuilder, or even people doing “manual” configuration management. It currently only supports INI files, but adding support for other file format is just a case of creating a new VariableReader implementation and decorating it with a ReaderHandles attribute to signify what “mode” you want it to handle, everything else is wired up automatically.

Utility Usage

Substitute - Variable Substitution Utility

Substitute.exe [mode] [delimiter] [variablefile.txt] [substitutionfile.txt] [sections..] (/v)

[mode] - Mode to use (ini)
[delimiter] - Variable delimiter (e.g. % would replace %VARIABLE%)
[variablefile.txt] - File containing variables for substituting
[substitutionfile.txt] - File to have it's contents substituted (%VARIABLENAME% syntax)
[sections..] - List of sections in the variable file to use
(/v) - (optional) Verbose output

Last edited Mar 16, 2009 at 8:31 PM by SteveRobbins, version 2