Module development workflow

When you are developing a Tcl module it is often more convenient from an SCM standpoint to not rename the module file each time you want to increase its version number. An alternative to renaming is to keep the module's ongoing development in a file named ${module}-dev.tcl and copy its contents to ${module}-${version}.tm as needed. Under this approach you can treat .tm files essentially as disposable build artifacts.

If your module code has the structure

namespace eval ::mymodule {
    variable version 1.2.3
    # ...
}
# ...

it is especially easy to automate the creation of .tm files. The following module creation script shows how; here it is configured for fptools.

#!/bin/sh
source=fptools-dev.tcl
version=$(awk '/variable version/ { print $3 }' "$source")
dest="fptools-$version.tm"
cp "$source" "$dest"