VersionInfo.st
changeset 2028 1f54c88269b2
child 2177 ec8a8ef58c34
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VersionInfo.st	Wed Oct 22 20:54:32 2008 +0200
@@ -0,0 +1,135 @@
+"{ Package: 'stx:libbasic3' }"
+
+Object subclass:#VersionInfo
+	instanceVariableNames:'revision binaryRevision user date time fileName'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'System-SourceCodeManagement'
+!
+
+!VersionInfo class methodsFor:'documentation'!
+
+documentation
+"
+    Class used to return a Dictionary when asked for versionInfo.
+    This has been replaced by instances of this class and subclasses.
+    Notice, that subclasses may add more info for specific source repositories,
+    (CVSVersionInfo, MonticelloVersionInfo etc.)
+
+    [author:]
+        cg (cg@AQUA-DUO)
+"
+! !
+
+!VersionInfo methodsFor:'accessing'!
+
+at:aKey
+    "backward compatible dictionary-like accessing"
+
+    (self respondsTo:aKey) ifTrue:[
+        ^ self perform:aKey
+    ].
+    ^ self errorKeyNotFound:aKey
+
+    "
+     self new at:#binaryRevision
+     self new at:#foo
+    "
+
+    "Modified: / 22-10-2008 / 20:23:31 / cg"
+!
+
+at:aKey ifAbsent:replacement
+    "backward compatible dictionary-like accessing"
+
+    (self respondsTo:aKey) ifTrue:[
+        ^ (self perform:aKey) ? replacement
+    ].
+    ^ replacement
+
+    "
+     self new at:#binaryRevision
+     self new at:#foo ifAbsent:#bar
+    "
+
+    "Created: / 22-10-2008 / 20:19:42 / cg"
+!
+
+at:aKey put:value
+    "backward compatible dictionary-like accessing"
+
+    (self respondsTo:aKey) ifTrue:[
+        self perform:(aKey,':') asSymbol with:value.
+        ^ value "/ sigh
+    ].
+    ^ self errorKeyNotFound:aKey
+
+    "
+     self new at:#binaryRevision put:#bar
+     self new at:#foo put:#bar
+    "
+
+    "Created: / 22-10-2008 / 20:20:54 / cg"
+!
+
+binaryRevision
+    ^ binaryRevision
+!
+
+binaryRevision:something
+    binaryRevision := something.
+!
+
+date
+    ^ date
+!
+
+date:something
+    date := something.
+!
+
+fileName
+    ^ fileName
+!
+
+fileName:something
+    fileName := something.
+!
+
+keysAndValuesDo:aBlock
+    self class instVarNames do:[:nm |
+        aBlock value:(nm asSymbol) value:(self perform:nm asSymbol)
+    ].
+
+    "Created: / 22-10-2008 / 20:48:08 / cg"
+!
+
+revision
+    ^ revision
+!
+
+revision:something
+    revision := something.
+!
+
+time
+    ^ time
+!
+
+time:something
+    time := something.
+!
+
+user
+    ^ user
+!
+
+user:something
+    user := something.
+! !
+
+!VersionInfo class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic3/VersionInfo.st,v 1.1 2008-10-22 18:54:32 cg Exp $'
+! !