[squeak-dev] Processing a file at image startup (scripting)

Keith Hodges keith_hodges at yahoo.co.uk
Wed May 20 14:59:19 UTC 2009


Cédrick Béler wrote:
> Hi,
>
> While delivering a small app (a project scheduler), people asked me if
> it's possible to execute it by a command line without opening an
> image. I have a pseudo-dsl to define a project (collection of tasks)
> that the app is scheduling and so, what I'd like is launching the app
> by passing a file as parameter. Then squeak "open headless", process
> the entry file, write an outputfile with results and eventually
> errors, and exit.
>
> I did something but this is a terrible hack :) I'd like to have other
> idea on that. If we consider:
>
> squeak   -headless test.image   file.in
>
> According to the vm man, file.in must be a script (st file with bang
> notation). I'm not aware of a way to pass a plain text file. So I just
> hacked ProjectLauncher>>startUpAfterLogin  (this is where I get a dnu
> if passing a file as parameter) so that my file can be processed and
> the image closed afterwhile.
>
> Can people point me a better way of doing that ? My feeling is I need
> to create a ScriptClass that has a startUp method where file
> processing can be implemented.
>
> Thanks
>
> --
> Cédrick
>   
You might like to try Installer-Launcher which is loaded with LPF

http://installer.pbwiki.com/LevelPlayingField

This allows you to pass a sequence of classes and parameters to the
command line

squeak my.image TestReporter suite=allTests SmalltalkImage
save="out.image" +quit

The parameters are handled by the class methods #launchWith: paramsDict

Keith



More information about the Squeak-dev mailing list