[squeak-dev] [CI] Author, question about a Pharoism

Levente Uzonyi leves at elte.hu
Thu Sep 8 21:12:23 UTC 2011

On Thu, 8 Sep 2011, Casey Ransberger wrote:

> I'm looking at what Lukas did for CI in Pharo, it looks wholly adaptable to
> Squeak AFAICT.
> I'm hung up on a Pharoism. I'd really like to be able to check what fork I'm
> in and then do the right thing, but I'll settle for forking the package
> (temporarily) if it means I can get a build building in short order.
> How would one say this in Squeak? It's the during: part that I'm not sure
> about; I know of Utilities>>authorInitials. Well, I suppose I'm also fuzzy
> on how I'd default to 'hudson' for the author... it seems like maybe I can
> just force the use of 'hudson' as the author and call it good... not sure I
> see the use case otherwise.

Something like this should do it:

HDTestReport >> run

 	| originalAuthorInitials |
 	originalAuthorInitials := Utilities authorInitialsPerSe.
 		originalAuthorInitials ifEmpty: [
 			Utilities setAuthorInitials: 'hudson'. "jenkins?" ].
 			self setUp.
 			suiteTime := [ self runAll ] timeToRun ]
 		ensure: [
 			self tearDown.
 			Utilities setAuthorInitials: originalAuthorInitials ]


P.S.: optionally you can move the restoration of the author initials to 
another #ensure: block, which would "help" if #tearDown raises an error

> HDTestReport>>run
> Author uniqueInstance
> ifUnknownAuthorUse: 'hudson'
> during: [ [
> self setUp.
> suiteTime := [ self runAll ]
> timeToRun ]
> ensure: [ self tearDown ] ]
> -- 
> Casey Ransberger

More information about the Squeak-dev mailing list