Wanted: Migrating to a Newer Image

Damien Cassou recently announced the release of a new Squeak-Web image which can be found here. This post will focus on migrating the Wanted application from the image we've been using to his new one. Before this post, I was keeping my squeak stuff spread out all over the place, and since I'm migrating to a newer image I thought I'd get a little more organized and detail my setup here.

A More Disciplined Directory Structure
Instead of scattering everything all over the place, I created a proj directory with the following directory tree:


  • proj/squeak is where all Squeak-related stuff goes
  • each directory in apps contains a combination of an image plus a vm
  • doc is for all Squeak/Smalltalk related pdfs like free books
  • images and vms contain different versions of squeak images and vms
  • repository is for the local Monticello repository, which we'll get to in a bit
  • tmp should be obvious
The "apps/wanted" directory is a new directory created for the new squeak-web image. My old image that I've been using for the Wanted tutorial is sitting in a different location.

Setting Up a Local Monticello Repository
We're going to use Monticello to handle the versioning of Wanted (there's some overview info on Monticello here). Fire up the image you've been using for the Wanted tutorial, then click on the World and select open... -> Monticello Browser. You should see this window:


Click the "+Package" button. Enter "Wanted-Tutorial" (or the name of the package containing the Wanted tutorial objects in your image) in the "Name of package" dialog:


and click the Accept button. Then add a local repository by clicking the "+Repository" button, and choosing "directory" from the "Repository type" dialog:


The "Repository folder" dialog will then display:


Navigate to the folder you want to store the local Monticello repository in and hit the "ok" button. You should now be looking at the Monticello browser with the Wanted-Tutorial package selected in the left pane and the repository folder selected in the right pane. Click the "Save" button in the row of buttons in the Monticello browser. Enter you initials in the dialog that pops up and Accept. The "Edit Version Name and Message" dialog will pop up:


Enter a comment and Accept. If all went well you should end up with a window like this:


We now have a working versioning repository for our Wanted tutorial code. As you'll see, migrating it to newer images will be a snap. At this point, close the old image but keep it around--we'll need it later.

Setting Up the New Image
After downloading Damien's new image and unpacking it into the "images/squeak-web-95-2" directory (see the directory layout above), I copied the
  1. squeak-web-95-2.image
  2. squeak-web-95-2.changes
files into the "apps/wanted" directory. I then copied the
  1. Squeak3.8.xxx
  2. SqueakV39.sources
files from the current vm in the "vms" directory into the "apps/wanted" directory. I also copied the
  1. wanted.css
file from the old image directory into "apps/wanted". Once all 5 files are copied, in "apps/wanted", drag the squeak-web-95-2.image file over the Squeak executable to open Squeak with the new image. Collapse the Script Manager and Preference Browser windows to make some room.

Open a Monticello Browser and click the "+Repository" button. Choose "directory" from the "Repository type" and select the directory you created above. With the directory repository highlighted in the right pane in the Monticello Browser, click the "Open" button. You should see a window like this:

Highlight the "Wanted-Tutorial...1.mcz" file in the right pane (the version information will appear in the bottom pane when you do so), then click the "Load" button. After the progress dialogs go away, open a new Refactoring Browser and scroll to the bottom of the Packages list:

Well looky there! I'll wait for you if you want to get up and do a happy dance.

In this new image, Seaside doesn't know about our Wanted app yet because we haven't registered it. If you open a web browser to http://localhost:8080/seaside/wanted you will get a listing of the registered Seaside apps, and Wanted isn't one of them. Let's fix that. Open a Shout Workspace, enter the following, highlight and "do it":


WantedList registerAsApplication: 'wanted'


Now go to http://localhost:8080/seaside/wanted. Notice that our app shows up, but all of our WantedItems are missing! Stay tuned--we'll fix that in the next post. For now, save the new image. I'm just going to use the default "squeak-web-95-2.image" name instead of naming it "wanted.image" since it's already in the "wanted" directory. If you wanted you could name it "why-is-sanjaya-not-voted-off-yet.image" and the world would still turn and make bad decisions and watch bad TV.

2 comments:

Damien Cassou said...

Hi,

thank you for this tutorial. I have two remarks. First, I advise you to always use the universe browser to update your image (open->package universe browser->update list from network->select all upgrades->install selections).

My second advice would be to always use the same VM. You don't need to copy the VM and the sources file everywhere. If your VM does not support multiple images at the same time, use John McIntosh ones: http://www.smalltalkconsulting.com/squeak.html (search for the beta versions and take the last one).

Bye

mj said...

"First, I advise you to always use the universe browser to update your image"

Cool--I will check this out tonight when I get a chance. What is your normal process for upgrading to a new image? How do you handle backups?

"You don't need to copy the VM and the sources file everywhere."

I like doing this because I do the grandpa-style dragging the image over on top of the executable so there's no doubt which image and vm I'm running. Also, if everything is in the same directory, I can copy it over to my thumbdrive or easily scp to another box, etc.

I'd like to hear more about your (and other's too!) setup and practices that you use.

Thanks for the comments, and also for providing squeak-web!