Here are some additional sdx scripts - to automate some tasks I seem to be doing manually quite often
This will soon become part of the standard sdx distribution (
stevel - Jan 24, 2005)
(
XO - Mar. 1, 2006) Steve, good stuffs! however current sdx.kit doesn't have these
create &
fill nice features yet. ^o^
The first is "sdx create" - it creates the .vfs hierarchy if one doesn't exist (much like "sdx qwrap" then "sdx unwrap", except it doesn't create a .kit).
But on platforms that support symbolic linking, instead of copying the whatever.tcl script into whatever.vfs/lib/app-whatever/whatever.tcl, it creates a symbolic link. This matches the way I work on Linux - the real source file sitting next to whatever.vfs and a symbolic link to it from within the .vfs hierarchy.
This approach also means that a "package provide app-whatever" will be added to the whatever.tcl in the current directory - so "sdx create" first renames whatever.tcl to whatever.tcl.orig and then copies that back to whatever.tcl (whew!)
The second script is "sdx fill". This tries to add any dependent packages to the whatever.vfs/lib directory by looking for a corresponding starkit in the users PATH (using auto_execok).
On my system, I keep a copy of various library starkits in /usr/local/bin (e.g. oomk.kit, csv.kit, tktable.kit, etc.). If any of these are "package require"d in whatever.tcl, then "sdx fill" will find these using auto_execok and will copy the contents of their .vfs/lib directory into whatever.vfs/lib. When looking for the package name it tries lowercase and also [lindex [split $pkg :] 0] (e.g. style::as).
"sdx fill" isn't a replacement for a proper repository, but I find it a useful automation tool.
There is a preliminary version at
http://www.digitalsmarties.com/sdx/fill.tcl - if you don't know how to add it to your sdx Starkit then you probably shouldn't be using it.
For example, ...
$ cat blah.tcl
package require oomk
package require Tk
package require Tktable
package require busy
package require csv
package require style::as
$ sdx create blah
created blah.vfs
renamed blah.tcl to blah.tcl.orig
added "package provide" to blah.tcl
blah.tcl linked to blah.vfs/lib/app-blah/blah.tcl
$ sdx fill blah
added oomk package
added snit package
added tktable package
added busy package
added csv package
added style package
$ tree blah.fs
blah.vfs
|-- lib
| |-- app-blah
| | |-- blah.tcl -> /Users/steve/Work/sdx/blah.tcl
| | `-- pkgIndex.tcl
| |-- busy
| | |-- AIX-ppc
| | | |-- busy.so
| | | `-- critcl.tcl
| | |-- Darwin-ppc
| | | |-- busy.dylib
| | | `-- critcl.tcl
| | |-- Linux-x86
| | | |-- busy.so
| | | `-- critcl.tcl
| | |-- SunOS-sparc
| | | |-- busy.so
| | | `-- critcl.tcl
| | |-- Tcl
| | | `-- busy.tcl
| | |-- Windows-x86
| | | |-- busy.dll
| | | `-- critcl.tcl
| | |-- critcl.tcl
| | `-- pkgIndex.tcl
| |-- csv
| | |-- csv.tcl
| | `-- pkgIndex.tcl
| |-- oomk
| | |-- oomk.tcl
| | `-- pkgIndex.tcl
| |-- snit
| | |-- license.txt
| | |-- pkgIndex.tcl
| | `-- snit.tcl
| |-- style
| | |-- as.tcl
| | |-- lobster.tcl
| | |-- pkgIndex.tcl
| | `-- style.tcl
| `-- tktable
| |-- Darwin-ppc
| | `-- tktable.dylib
| |-- Linux-x86
| | `-- tktable.so
| |-- pkgIndex.tcl
| `-- tkTable.tcl
`-- main.tcl