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

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Sat Jul 18 01:27:29 UTC 2009

A new version of Sake-Core was added to project Sake :

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

Name: Sake-Core-kph.111
Author: kph
Time: 18 July 2009, 2:27:26 am
UUID: f429636a-72ca-4094-80a9-a353cec553ef
Ancestors: Sake-Core-kph.110

+ #isNeeded

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

Item was added:
+ ----- Method: SakeTask>>isNeeded (in category 'as yet unclassified') -----
+ isNeeded
+ 	| priorTasks |
+ 	self hasRun ifTrue: [ ^ false ].
+ 	priorTasks := self tasksFromList: self dependsOn.
+ 	^ self isNeeded: priorTasks
+   !

Item was changed:
  Object subclass: #SakeTask
  	instanceVariableNames: 'args context info priors ifBlock actionBlock answers hasRun result runLevel target author setOfTasks'
+ 	classVariableNames: 'Count LastStatus'
- 	classVariableNames: 'LastStatus Count'
  	poolDictionaries: ''
  	category: 'Sake-Core'!
  SakeTask class
  	instanceVariableNames: 'status'!
  !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.
  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:
  ^ SakeTask define: [ :task |
  	task dependsOn: { self taskSecondary }.
  	task action: [ self log sake: 'Doing Primary Task'. ].
  ^ 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"

More information about the Packages mailing list