[squeak-dev] The Trunk: System-cmm.608.mcz
Levente Uzonyi
leves at elte.hu
Fri Oct 25 22:36:23 UTC 2013
On Fri, 25 Oct 2013, Chris Muller wrote:
> Hi, as you can see, this is why I want to have
> #valueWithAllPossibleArguments: available. We can move it to the
> System package if it is not common enough for Kernel.
I still don't see why we need that method. The functionality can easily be
added to SmalltalkImage >> #do: explicitly
(aBlock numArgs = 1 and: [ self arguments size > 1 ])
ifTrue: [ aBlock value: self arguments ]
ifFalse: [ aBlock valueWithEnoughArguments: self arguments ]
instead of
aBlock valueWithAllPossibleArguments: self arguments
Levente
>
> What's being addressed and documented is the surprisingly voluminous
> amount of code (encapsulated in #do:) needed to properly run squeak
> when passing in a "document" URL as the first argument.
>
> The contents of those documents can now, optionally, surround their code in
>
> Smalltalk do:
> [ :arg1 :arg2 :etc |
> "the document script can access arg1, arg2 nicely" ]
>
> to get easy-access to the arguments, and also handling the exceptions
> that need to be handled.
>
>
>
> On Fri, Oct 25, 2013 at 3:38 PM, <commits at source.squeak.org> wrote:
>> Chris Muller uploaded a new version of System to project The Trunk:
>> http://source.squeak.org/trunk/System-cmm.608.mcz
>>
>> ==================== Summary ====================
>>
>> Name: System-cmm.608
>> Author: cmm
>> Time: 25 October 2013, 3:38:27.908 pm
>> UUID: c3198c63-1008-493a-8e6b-b63886ab70cf
>> Ancestors: System-ul.607
>>
>> Convenience method for passing .st scripts as arguments to image. In the .st script, use Smalltalk do: [ :arg1 :arg2 :etc | ] to start servers, #doAndQuit: [ :args | ... ] for batch jobs, and #do:snapshot:andQuit: for jobs that "build" new images (e.g., for testing and/or deployment). Arguments from the command-line are passed as arguments to the block.
>>
>> In all cases, Notifications and Errors are logged to stdout and stderr, respectively.
>>
>> =============== Diff against System-ul.607 ===============
>>
>> Item was added:
>> + ----- Method: SmalltalkImage>>do: (in category 'command line') -----
>> + do: aBlock
>> + [ [ aBlock valueWithAllPossibleArguments: self arguments ]
>> + on: ProgressInitiationException
>> + do:
>> + [ : pie | "Don't want to log this notification."
>> + pie defaultAction ] ]
>> + on: Notification , Warning
>> + do:
>> + [ : noti | StandardFileStream stdout
>> + nextPutAll: DateAndTime now asString ;
>> + space ;
>> + nextPutAll: noti description ;
>> + cr.
>> + noti resume ]
>> + on: SyntaxErrorNotification
>> + do:
>> + [ : err | StandardFileStream stdout
>> + nextPutAll: err errorCode ;
>> + cr.
>> + self haltOrQuit ]
>> + on: Error
>> + do:
>> + [ : err | err printVerboseOn: StandardFileStream stderr.
>> + self haltOrQuit.
>> + err isResumable ifTrue: [ err resume ] ]!
>>
>> Item was added:
>> + ----- Method: SmalltalkImage>>do:snapshotAs:andQuit: (in category 'command line') -----
>> + do: aBlock snapshotAs: imageName andQuit: shouldQuit
>> + self do: aBlock.
>> + imageName
>> + ifNil:
>> + [ shouldQuit ifTrue:
>> + [ self
>> + snapshot: false
>> + andQuit: shouldQuit ] ]
>> + ifNotNil:
>> + [ | correctName |
>> + correctName := (imageName endsWith: '.image')
>> + ifTrue: [ imageName ]
>> + ifFalse: [ imageName , '.image' ].
>> + (FileDirectory default fullNameFor: correctName) = self imageName
>> + ifTrue:
>> + [ self
>> + snapshot: true
>> + andQuit: shouldQuit ]
>> + ifFalse:
>> + [ self saveAs: imageName.
>> + "Avoid instant-quit when relaunching by resaving."
>> + shouldQuit ifTrue:
>> + [ self
>> + snapshot: true
>> + andQuit: shouldQuit ] ] ]!
>>
>> Item was added:
>> + ----- Method: SmalltalkImage>>doAndQuit: (in category 'command line') -----
>> + doAndQuit: aBlock
>> + self
>> + do: aBlock
>> + snapshotAs: nil
>> + andQuit: true!
>>
>> Item was added:
>> + ----- Method: SmalltalkImage>>haltOrQuit (in category 'command line') -----
>> + haltOrQuit
>> + Smalltalk isHeadless
>> + ifTrue:
>> + [ self
>> + snapshot: false
>> + andQuit: true ]
>> + ifFalse: [ self halt ]!
>>
>>
>
>
More information about the Squeak-dev
mailing list
|