Downloading and
installing externals with a Rev rich client/Internet app
Below are brief instructions for downloading Rev externals from a server and installing them in a Rev application running on a client. The instructions are trivial for Windows but nontrivial for Mac OS X.
The revxml external in the Rev distribution is used as an example below. With a change in file names, the directions should apply to other externals.
In my application, I wanted a client Rev application without the revxml external to be able to download and use stacks which require the revxml external. As of December 2004, Reactor Lab's Division 1, Lab 6, Reactor Networks, uses this method for access to Rev's XML editing tools.
These directions assume the presence of two Rev stacks on the client: stack A which handles download and installation and stack B which will use the external.
Windows
Externals are .dll files. I obtained the revxml.dll file by creating a new stack, then saving as a standalone which will use revxml. After saving as a standalone, copy the file revxml.dll in the externals folder in the standalone folder. Compress the .dll file using gzip, e.g., to file revxml.dll.gz, and upload to the server.
On the client, stack A downloads revxml.dll.gz, expands it, and writes revxml.dll to a binfile on the client disk. Stack A then sets the externals of stack B to file "revxml.dll" (see the externals property in Rev help) and then opens stack B or puts it in use for the first time in the session.
Mac OS X
An external is contained in a Mac OS X "bundle," which is a directory containing other directories and files, including the actual executable external file.
Obtain the external bundle by creating a new stack, then saving it as a standalone which will use revxml. Save the standalone to the Desktop so it's easy to cd to in Terminal. Open the Terminal application and cd into the application package until you get to the directory level where you see the directory revxml.bundle. Compress the revxml.bundle directory and file structure into a single archive file using the command, e.g.,
ditto -c -rsrc -k
revxml.bundle revxml.bundle.arkive
where ditto is a standard utility, -c is option to compress, -rsrc is option to preserve Mac resources, -k option is to compress using the PKZip algorithm, revxml.bundle is the name of the directory and file structure, and revxml.bundle.arkive is an arbitrary output file name (arkive with a k reminds me that the -k option was used). Without the -k option, the result appears to be roughly the same size as the original. Upload the archive file to the server.
On the client, stack A downloads the archive file and writes it to a binfile on the client disk. Now I used shell commands to cd to the location of the archive file on the client disk and then expand it. In Rev script:
# cd to download directory,
*NOTE* SINGLE QUOTES ' for path with spaces
# variable tPathWithSpaces
contains a string specifying the path on the local
# client to the directory in
which file revxml.bundle.arkive was saved
put "get shell("
& quote & "cd '" &
tPathWithSpaces & "'" & quote & ")" into
temp
do temp
# now expand
put "get shell("
& quote & "ditto -x -rsrc -k revxml.bundle.arkive
revxml.bundle"\
& quote & ")" into temp
do temp
where option -x in ditto means to expand. The result is the original directory and file structure of the Mac OS X bundle.
Finally, stack A sets the externals of stack B to "revxml.bundle" and then opens stack B or puts it in use for the first time in the session.