Add utility method `MCVersionInfo >> #forPackage:` jv
authorJan Vrany <jan.vrany@labware.com>
Wed, 05 Aug 2020 16:08:46 +0100
branchjv
changeset 1109 4aad118c1257
parent 1108 1bdcfc9842d0
child 1110 500a2c0ef6dc
Add utility method `MCVersionInfo >> #forPackage:` ...that creates a default version info for given Smalltalk/X package. Date, time, author and message defaults to "now", current user and '<no message>'.
MCVersionInfo.st
--- a/MCVersionInfo.st	Mon Aug 10 14:37:20 2020 +0100
+++ b/MCVersionInfo.st	Wed Aug 05 16:08:46 2020 +0100
@@ -1,3 +1,6 @@
+"
+COPYRIGHT (c) 2020 LabWare
+"
 "{ Package: 'stx:goodies/monticello' }"
 
 "{ NameSpace: Smalltalk }"
@@ -12,6 +15,23 @@
 MCVersionInfo comment:'Adds to the record of ancestry, other identifying details.'
 !
 
+!MCVersionInfo class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2020 LabWare
+
+
+"
+! !
+
+!MCVersionInfo class methodsFor:'instance creation'!
+
+forPackage: package 
+    ^ self new initializeWithPackage: package
+
+    "Created: / 05-08-2020 / 15:34:49 / Jan Vrany <jan.vrany@labware.com>"
+! !
 
 !MCVersionInfo class methodsFor:'as yet unclassified'!
 
@@ -197,6 +217,19 @@
 	author _ initials.
 	ancestors _  aCollection.
 	stepChildren _ stepCollection
+!
+
+initializeWithPackage: aSymbol
+    name := aSymbol.
+    id := UUID fromBytes: (SHA1Stream hashValueOf: name).
+    message := '<no message>'.
+    date := Date today.
+    time := Time now.
+    author := OperatingSystem getFullUserName.
+    ancestors := nil.
+    stepChildren := nil.
+
+    "Created: / 05-08-2020 / 15:37:28 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
 !MCVersionInfo methodsFor:'pillaging'!
@@ -235,5 +268,10 @@
 
 version
     ^ '$Header: /cvs/stx/stx/goodies/monticello/MCVersionInfo.st,v 1.4 2012-09-11 21:30:28 cg Exp $'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 ! !