SVN__Task.st
changeset 25 7a99fc6767ef
child 134 379185993ee9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SVN__Task.st	Wed Sep 23 18:45:03 2009 +0200
@@ -0,0 +1,143 @@
+"{ Package: 'cvut:stx/goodies/libsvn' }"
+
+"{ NameSpace: SVN }"
+
+Object subclass:#Task
+	instanceVariableNames:'package classes workingCopy'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SVN-Tasks'
+!
+
+!Task class methodsFor:'documentation'!
+
+version_SVN
+    ^'$Id$'
+! !
+
+!Task methodsFor:'accessing'!
+
+branch
+
+    ^self workingCopy branch
+
+    "Created: / 23-03-2009 / 17:16:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+classes
+    ^ classes
+!
+
+classes:aCollection"<Collection[Class]>"
+
+    self 
+        assert: (aCollection allSatisfy: [:e|e isBehavior])
+        message: 'All elements should be classes'.
+
+    self
+        assert: (aCollection allSatisfy: [:e|e package = package])
+        message: 'All classes should belongs to my package (' , package , ')'.
+
+    classes := aCollection.
+
+    "Modified: / 16-06-2009 / 20:56:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+package
+    ^ package
+!
+
+package:aSymbol
+    package := aSymbol.
+!
+
+repository
+
+    ^self workingCopy repository
+
+    "Created: / 23-03-2009 / 11:24:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+workingCopy
+
+    workingCopy ifNil:
+        [workingCopy := 
+            (SVN::RepositoryManager repositoryForPackage: self package)
+                workingCopy].
+    ^workingCopy
+
+    "Created: / 23-03-2009 / 11:18:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+workingCopy:aWorkingCopy
+    workingCopy := aWorkingCopy.
+    package := aWorkingCopy package
+
+    "Modified: / 23-03-2009 / 11:44:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Task methodsFor:'executing'!
+
+do
+    "
+        Perform whole task
+    "            
+
+    ^ self subclassResponsibility
+
+    "Modified: / 23-03-2009 / 11:16:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Task methodsFor:'executing - private'!
+
+do: aBlock
+
+    ^SVN::CompatModeQuery
+        answer: false
+        do: aBlock
+
+    "Created: / 15-07-2009 / 20:07:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+doCompileSvnRevisionNrMethod: compileRevision
+    | pkgDef revNr |
+
+    SVN::ActivityNotification notify:'Compiling #svnRevisionNr method'.
+    pkgDef := self workingCopy packageDefinition.
+    revNr := compileRevision
+                ifTrue:[pkgDef svnRevision number]
+                ifFalse:[nil].
+
+    (revNr notNil or:[(pkgDef theMetaclass includesSelector:#svnRevisionNr) not]) ifTrue:
+        [pkgDef theMetaclass
+            compile: (pkgDef svnRevisionNr_code: revNr)
+            classified:'description - svn'.
+        (pkgDef theMetaclass compiledMethodAt:#svnRevisionNr) 
+            setPackage:self package asSymbol].
+
+    "Created: / 16-06-2009 / 12:16:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Task methodsFor:'notification'!
+
+notify: aString
+
+    self notify: aString progress: nil
+
+    "Created: / 29-05-2009 / 16:51:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+notify: aString progress: aNumberOrNil
+
+    aNumberOrNil 
+        ifNil:[ActivityNotification notify: aString]
+        ifNotNil:[ProgressNotification notify: aString progress: aNumberOrNil]
+
+    "Created: / 29-05-2009 / 16:51:59 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Task class methodsFor:'documentation'!
+
+version
+    ^ '$Header$'
+! !