[squeak-dev] The Trunk: System-cmm.608.mcz

Chris Muller asqueaker at gmail.com
Fri Oct 25 20:46:55 UTC 2013


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.

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