I did a screencast yesterday on automating the build of a development image; after fielding a few questions, I figured I'd post the relevant scripts. First, I use this workspace script to save my Store Repository profiles out to disk:
fname := 'connects.txt' asFilename writeStream.
Store.RepositoryManager.Repositories do: [:each |
1 to: each class allInstVarNames size do: [:evar |
| obj |
obj := each instVarAt: evar.
obj isNil
ifTrue: [fname nextPutAll: 'nil']
ifFalse: [fname nextPutAll: obj].
fname nextPut: $,].
fname nextPut: Character cr].
fname close.
That saves my repository information out to a simple, comma/CR delimited flat file. With that, I can automate the build of a development image with a script like the one below (obviously, the mix of parcels and store package/bundles will vary):
| fname list |
"do initial parcel load"
#(
'$(VISUALWORKS)\database\oraclethapiexdi.pcl'
'$(VISUALWORKS)\contributed\postgresql\storeforpostgresql.pcl'
'$(VISUALWORKS)\store\storefororacle.pcl'
'$(VISUALWORKS)\contributed\sunit\sunitui.pcl'
'$(VISUALWORKS)\parcels\rbsunitextensions.pcl'
'$(VISUALWORKS)\net\netclients.pcl'
) do: [:each |
Parcel loadParcelFrom: each].
"read in Repository settings"
fname := 'connects.txt' asFilename readStream.
list := OrderedCollection new.
[fname atEnd]
whileFalse: [
| prof str line i |
line := fname upTo: Character cr.
str := line readStream.
prof := Store.ConnectionProfile new.
i := 1.
[str atEnd]
whileFalse: [
| next |
next := str upTo: $,.
next = 'nil' ifTrue: [next := nil].
prof instVarAt: i put: next.
i := i + 1].
list add: prof].
fname close.
list do: [:each |
Store.RepositoryManager addRepository: each].
"connect to Store"
profile := Store.RepositoryManager repositories
detect: [:each | 'cincomsmalltalk' = each name]
ifNone: [nil].
profile ifNil: [^self].
Store.DbRegistry connectTo: profile.
"load a bundle"
(Store.Bundle newestVersionWithName: 'RSSBuilding') loadSrc.
"disconnect"
Store.DbRegistry disconnect.
"save image"
ObjectMemory saveAs: 'team' thenQuit: false
It probably makes sense to split the individual sections out, and to create "manifest" files of parcels/package to load - but you get the idea. This is a nice, simple way to automate a build - and you don't even need to "doIt" after starting your image. Instead, start the base visual.im as follows:
visual visual.im -filein build-team.st
That's it - works nicely for me
Technorati Tags:
smalltalk