VersionInfo.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 22 Mar 2013 11:11:55 +0000
branchjv
changeset 3128 87750af738dc
parent 3125 08d6603c4fe9
parent 3121 19723298dd2c
child 3838 474d8ec95b33
permissions -rw-r--r--
Merged heads

"
 COPYRIGHT (c) 2008 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libbasic3' }"

Object subclass:#VersionInfo
	instanceVariableNames:'revision binaryRevision user date time fileName'
	classVariableNames:''
	poolDictionaries:''
	category:'System-SourceCodeManagement'
!

!VersionInfo class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2008 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

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"
!

author
    ^ self user

    "Created: / 21-12-2011 / 23:09: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"
!

repositoryPathName
    "raise an error: must be redefined in concrete subclass(es)"

    ^ nil "Not known"

    "Modified: / 23-11-2011 / 23:33:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

revision
    ^ revision
!

revision:something
    revision := something.
!

time
    ^ time
!

time:something
    time := something.
!

timeStamp:aTimestamp
    date := aTimestamp asDate.
    time := aTimestamp asTime.

    "Created: / 04-12-2011 / 10:06:02 / cg"
!

timezone
    "raise an error: must be redefined in concrete subclass(es)"

    ^ nil "Not known"

    "Modified: / 23-11-2011 / 13:54:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

user
    ^ user
!

user:something
    user := something.
! !

!VersionInfo class methodsFor:'documentation'!

version_CVS
    ^ '§Header: /cvs/stx/stx/libbasic3/VersionInfo.st,v 1.6 2011/12/22 08:59:53 cg Exp §'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '§Id: VersionInfo.st 1909 2012-03-31 00:14:49Z vranyj1 §'
! !