[Pkg] Sake : Sake-Core-kph.69.mcz

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Sun Dec 7 22:07:30 UTC 2008


A new version of Sake-Core was added to project Sake :
http://www.squeaksource.com/Sake/Sake-Core-kph.69.mcz

==================== Summary ====================

Name: Sake-Core-kph.69
Author: kph
Time: 7 December 2008, 10:07:28 pm
UUID: ece8970e-aa84-4b98-9d9c-af0580a01404
Ancestors: Sake-Core-kph.68

added #author so that tasks may be performed under a specific name

=============== Diff against Sake-Core-kph.68 ===============

Item was added:
+ ----- Method: SakeTask>>author: (in category 'as yet unclassified') -----
+ author: initials
+ 
+ 	author := initials!

Item was added:
+ ----- Method: SakeTask>>author:during: (in category 'as yet unclassified') -----
+ author: initials during: aBlock
+ 
+ 	| tmp |
+ 	
+ 	[ 	
+ 		tmp := Utilities authorInitialsPerSe.
+ 		Utilities setAuthorInitials: author.
+ 		aBlock value.
+ 
+ 	] ensure: [ Utilities setAuthorInitials: tmp ]
+ 	
+ 	!

Item was changed:
  ----- Method: SakeTask>>doAction: (in category 'as yet unclassified') -----
  doAction: priorTasks
  
   
  	Count := 0. "reset loop trap"
  		
  	self doActionStep.
  	
  	result := nil.
  	
+ 	self action isBlock ifTrue: [ 
+ 		
+ 		result := self setAuthorDuring: [ self action valueWithPossibleArgument: priorTasks ].
+ 		
+ 	].
- 	self action isBlock ifTrue: [ result := self action valueWithPossibleArgument: priorTasks. ].
  	
  	(self action isKindOf: Collection) ifTrue: [ self doTasks: self action ].
  
  	self doActionEnd.
  	
  !

Item was changed:
  Object subclass: #SakeTask
+ 	instanceVariableNames: 'args context info priors ifBlock actionBlock answers hasRun result runLevel target author'
- 	instanceVariableNames: 'args context info priors ifBlock actionBlock answers hasRun result runLevel target'
  	classVariableNames: 'LastStatus Count'
  	poolDictionaries: ''
  	category: 'Sake-Core'!
  
  !SakeTask commentStamp: 'kph 4/22/2008 22:42' prior: 0!
  SakeTasks are typically defined as class side methods, which return an instance of SakeTask.
  
  To obtain a list of available tasks, do "Senders of #define: "
  
  MyClass-task1: aParameter
  
  	^ SakeTask define: [ :task |
  		 	task dependsOn: {self ruleL3.}.
  			task if: [ <return true if action is needed> ].
  	     	task action: [ <do something> ]
  	  ]
  
  The 'unique id' of a task is the method context in which it is instanciated, and its paramters.
  Therefore only one task should be instanciated per method.
  
  Note: Sake tasks can have parameters, Rake tasks dont.
  
  To execute a task...
  
  (MyClass task1: 'param') run.
  
  Results of the prior tasks are available via #results.
  
  FAQ
  ====
  How can I call one Sake task from inside another task?
  
  Generally, if you want invoke one task from another task, the proper way to do that is to include the task to be invoked as a prerequisite of the task doing the invoking.
  
  For example:
  
  MyTasks-c-#taskPrimary
  
  ^ SakeTask define: [ :task |
  	task dependsOn: { self taskSecondary }.
  	task action: [ self log sake: 'Doing Primary Task'. ].
  ]
  
  MyTasks-c-#taskSecondary
  ^ SakeTask define: [ :task |
  	task action: [ self log sake: 'Doing Secondary Task' ].
  ]
  
  In this case, if the secondary task fails, the whole task stops. 
  
  Secondary tasks can also be passed to the ifBlock. In that case, if the task succeeds then the action is performed, if the task fails then the action is considered not needed.
  
  ^ SakeTask define: [ :task |
  	task if: { self taskSecondary }.
  	task action: [ self log sake: 'Doing Primary Task'. ].
  ]
  
  Action, can also take a list of tasks.	
  	
  ^ SakeTask define: [ :task |
  	task action: {
  	                 self taskSecondary. 
  	                 [ self log sake: 'Doing Primary Task' ].  "a block task"
  				} 
  ].
  	
  	
  !

Item was added:
+ ----- Method: SakeTask>>setAuthorDuring: (in category 'as yet unclassified') -----
+ setAuthorDuring: aBlock
+ 
+ 	| tmp |
+ 
+ 	author ifNil: [ ^ aBlock value ].
+ 	
+ 	[ 	
+ 		tmp := Utilities authorInitialsPerSe.
+ 		Utilities setAuthorInitials: author.
+ 		^ aBlock value.
+ 
+ 	] ensure: [ Utilities setAuthorInitials: tmp ]
+ 	
+ 	!



More information about the Packages mailing list