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

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Tue Dec 9 18:24:37 UTC 2008


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

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

Name: Sake-Core-kph.73
Author: kph
Time: 9 December 2008, 6:24:35 pm
UUID: 744704e7-d9ce-401c-8093-5099ea933934
Ancestors: Sake-Core-kph.72

moved class var LastStatus to be per class instance var #status

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

Item was changed:
  ----- Method: SakeTask class>>check:eval:onChanged: (in category 'as yet unclassified') -----
  check: key eval: aBlock onChanged: aTaskOrBlock
  
  	^ self define: [ :task |
+ 		task	 if: [ task statusAt: key hasChanged: aBlock value ].
- 		task	 if: [ task lastStatusAt: key hasChanged: aBlock value ].
  		task action: aTaskOrBlock. 
  	]!

Item was added:
+ ----- Method: PackageOrganizer class>>taskSaveAllPackagesIn:withComment: (in category '*sake-core') -----
+ taskSaveAllPackagesIn: repository withComment: message
+ 
+ 	^ SakeTask define: [ :task |
+  				
+ 		task dependsOn: (self default packageInfos collect: [ :pkgInfo |  pkgInfo taskSaveIn: self repository withComment: message ])
+ 
+ 	].
+ 
+  !

Item was added:
+ ----- Method: SakeTask>>statusAt:hasChanged: (in category 'signals') -----
+ statusAt: key hasChanged: val
+ 
+ 	^ self class status in: [ :s | (s at: key ifAbsent: nil) ~= (s at: key put: val) ]!

Item was added:
+ ----- Method: SakeTask class>>stautus (in category 'as yet unclassified') -----
+ stautus
+ 
+ 	^	status ifNil:[ status := Dictionary new ]!

Item was changed:
  Object subclass: #SakeTask
  	instanceVariableNames: 'args context info priors ifBlock actionBlock answers hasRun result runLevel target author'
  	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.
  
  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: PackageInfo>>taskSaveIn:withComment: (in category '*sake-core') -----
+ taskSaveIn: repository withComment: message
+  
+ 	^ SakeTask define: [ :task |
+  
+ 		task if: [ (self manager changesRelativeToRepository: repository) isEmpty not ].
+  				
+ 		task action: [ self manager repositoryGroup addRepository: repository.
+ 				repository storeVersion: (self manager newVersionWithName: self manager uniqueVersionName message: message)
+ 			] 
+ 		
+ 	  ].
+  !

Item was changed:
  ----- Method: SakeTask class>>cleanUp (in category 'as yet unclassified') -----
  cleanUp
  
+ 	status := nil!
- 	LastStatus := nil!

Item was removed:
- ----- Method: PackageInfo>>taskSaveIn: (in category '*sake-core') -----
- taskSaveIn: repository
-  
- 	^ SakeTask define: [ :task |
-  
- 		task if: [ (self manager changesRelativeToRepository: repository) isEmpty not ].
-  				
- 		task action: [ self manager repositoryGroup addRepository: repository.
- 				repository storeVersion: (self manager newVersionWithName: self manager uniqueVersionName message: 'auto save')
- 			] 
- 		
- 	  ].
-  !

Item was removed:
- ----- Method: SakeTask>>lastStatusAt:hasChanged: (in category 'signals') -----
- lastStatusAt: key hasChanged: val
- 
- 	LastStatus ifNil: [ LastStatus := Dictionary new ].
- 
- 	^ (LastStatus at: key ifAbsent: nil) ~= (LastStatus at: key put: val)!

Item was removed:
- ----- Method: PackageOrganizer class>>taskSaveAllPackagesIn: (in category '*sake-core') -----
- taskSaveAllPackagesIn: repository
- 
- 	^ SakeTask define: [ :task |
-  				
- 		task dependsOn: (self default packageInfos collect: [ :pkgInfo |  pkgInfo taskSaveIn: self repository ])
- 
- 	].
- 
-  !



More information about the Packages mailing list