Squeak/Pharo command line scripting
UPDATE (5/22/2011): I figured out how to use the “open” command, instead of digging into the bundle. See the “Scripting the Image” section below.
Typical Workflow
I go through a lot of images. It’s just the way it is – make some changes to a package, try to load it in a fresh image, open another image with an older version to compare.
The Case for Scripting
The frustrating part is not using many images (which is pretty cool – to have multiple computers running at once… but I digress), but setting up the images every time. So I decided I’d find a way to load common configurations automatically. But how would I communicate to the image that it should run certain code on startup? A quick google found writing scripts.
Poor Command of the Mac Command Line
This sounded like just what I needed, but I ran into a bit of trouble with the Mac command line:
~$ open -a /Applications/Squeak\ 4.2.5beta1UFSPathMakeRef(/Applications/Squeak 4.2.5beta1U) failed with error -43.~$ open -a Squeak\ 4.2.5beta1U ./Pharo-1.1-scripting/Pharo-1.1-11411dev10.07.1.imageUnable to find application named ‘Squeak 4.2.5beta1U’~$ /Applications/Squeak\ 4.2.5beta1U ./Pharo-1.1-scripting/Pharo-1.1-11411dev10.07.1.image-bash: /Applications/Squeak 4.2.5beta1U: No such file or directory~$ /Applications/Squeak\ 4.2.5beta1U.app ./Pharo-1.1-scripting/Pharo-1.1-11411dev10.07.1.image-bash: /Applications/Squeak 4.2.5beta1U.app: is a directory…
Scripting the Image!
~$ open -a /Applications/Squeak\ 4.2.5beta1U.app/ –args./Pharo-1.1-11411dev10.07.1.image /Users/sean/Squeak/SpdImageSetup.st testArgument
~$ “/Applications/Squeak 4.2.5beta1U.app/Contents/MacOS/Squeak VM Opt” ./Pharo-1.1-11411dev10.07.1.image /Users/sean/Squeak/SpdImageSetup.st testArgument
Another was using “open” is:
open -a “/Applications/Squeak 4.2.5beta1U.app”
Please note the additional “.app”
I would totally learn Smalltalk; I want to see where Ruby got its inspiration from, and Squeak and Pharo do look pretty cool. But there’s no way I’m learning a language that doesn’t have a halfway decent command line interface. It’s a supreme hassle to work without one.
That’s just one of a thousand reasons I won’t pick up Smalltalk today. Another is that there are very few installers. I don’t want to hear about VMs and images; I just want to open an MSI, DMG, or DEB and start cracking with $ gst hello.st. Too bad GNU Smalltalk doesn’t have Mac and Windows installers.
@Andrew Pennebaker Your installer wish is my command. Here are links to one click apps for both Squeak and Pharo. As for CLI, Pharo is developing the Coral project for this, but I thing you’d find it less important than you think if you dove in. I had a similar experience… When I saw code examples in Smalltalk, I used to think, “why don’t you learn a modern language!” But after being blown away by Alan Kay’s TED Talk, I “got it” and never looked back to C, C++, or even Ruby (although I often use Ruby for glue code). Although I am still irritated by not having my VI bindings (which I will implement at some point), the productivity and epistemological benefits make it the clear winner.