Abt.cnf - part deux

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Abt.cnf - part deux

dmacq

I posted several weeks ago about the new PostStartup section of the abt.cnf file where you can specify code to be run after VA Smalltalk starts up. The example I gave was how to write “Hi, Mom” on the Transcript. Let's look at a more useful example.


At Instantiations, we strive to automate as much of our internal processes as possible, and I can post more about that if there is interest. My part of the effort is to test images created by the installer, and quite often these are development images. So I wrote this abt.cnf which prepares a clean abt.icx image for testing.


"***********************************************************" !

"* This abt.cnf will prepare an image for testing *" !

"***********************************************************" !


" set the owner of the image to Library Supervisor"!

(EmUser classPool declareVariable: 'CurrentUser')

value: (EmUser named: 'Library Supervisor').!


" connect to the current library"!

EmLibraryInterface startUp !


EtTools

rememberLastServerAddress: EmLibrary default serverAddress

andLibraryPath: EmLibrary default name

usingConnection: EmLibrary default.!


EmInterface current makeDefaultLibraryBe: EmLibrary default.!


EmLibrary cache resetMethodCache.!


EtTools recacheImage: false!


" do not display the VA Organizer windows" !

StsAbtApplicationsOrganizerView okToRestart: false. !

AbtQuickStartView showAtStartup: false !


PostStartUp !


System saveImage!

System exit !


***************** end of abt.cnf file ************************” !


So here we tell VA Smalltalk that Library Supervisor owns the image, connect to the current library, do not display the VisualAge Organizer Windows, save yourself and exit.


But this abt.cnf file will not work for an ibmst.icx because an ibmst.icx image has no VisualAge Organizer windows. So we can try this;


"***********************************************************" !

"* This abt.cnf will prepare an image for testing *" !

"***********************************************************" !


" set the owner of the image to Library Supervisor"!

(EmUser classPool declareVariable: 'CurrentUser')

value: (EmUser named: 'Library Supervisor').!


" connect to the current library"!

EmLibraryInterface startUp !


EtTools

rememberLastServerAddress: EmLibrary default serverAddress

andLibraryPath: EmLibrary default name

usingConnection: EmLibrary default.!


EmInterface current makeDefaultLibraryBe: EmLibrary default.!


EmLibrary cache resetMethodCache.!


EtTools recacheImage: false!


" do not display the VA Organizer windows unless we are an abt image" !

(System respondsTo: #stsSenders) 

ifTrue: [StsAbtApplicationsOrganizerView okToRestart: false.

AbtQuickStartView showAtStartup: : false] !


PostStartUp !


System saveImage!

System exit !


***************** end of abt.cnf file ************************” !


System respondsTo: #stsSenders will tell us if we are an abt.icx image, but this will fail; it will not compile because neither StsAbtApplicationsOrganizerView nor AbtQuickStartView exist in an ibmst.icx image. This is the solution:


"***********************************************************" !

"* This abt.cnf will prepare an image for testing *" !

"***********************************************************" !


" set the owner of the image to Library Supervisor"!

(EmUser classPool declareVariable: 'CurrentUser')

value: (EmUser named: 'Library Supervisor').!


" connect to the current library"!

EmLibraryInterface startUp !


EtTools

rememberLastServerAddress: EmLibrary default serverAddress

andLibraryPath: EmLibrary default name

usingConnection: EmLibrary default.!


EmInterface current makeDefaultLibraryBe: EmLibrary default.!


EmLibrary cache resetMethodCache.!


EtTools recacheImage: false!


" do not display the VA Organizer windows unless we are an abt image" !

(System respondsTo: #stsSenders)

ifTrue: [|app| app := Smalltalk at: #StsAbtApplicationsOrganizerView ifAbsent: [nil].

app notNil ifTrue: [app okToRestart: false].

app := Smalltalk at: #AbtQuickStartView ifAbsent: [nil].

app notNil ifTrue: [app showAtStartup: false]] !


PostStartUp !


System saveImage!

System exit !


***************** end of abt.cnf file ************************” !


Thus endeth lesson. Happy Mother's Day!

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.