reports/Builder__ReportClassSourceInfo.st
author Claus Gittinger <cg@exept.de>
Thu, 28 Mar 2019 13:54:38 +0100
changeset 542 aa25a71be62a
parent 265 eb1cc3afb10c
permissions -rw-r--r--
#DOCUMENTATION by cg
class: stx_goodies_builder_quickSelfTest
class definition

class: stx_goodies_builder_quickSelfTest class
added:18 methods
jan@201
     1
"{ Package: 'stx:goodies/builder/reports' }"
jan@201
     2
jan@201
     3
"{ NameSpace: Builder }"
jan@201
     4
jan@201
     5
ReportSourceInfo subclass:#ReportClassSourceInfo
jan@201
     6
	instanceVariableNames:'klass'
jan@201
     7
	classVariableNames:''
jan@201
     8
	poolDictionaries:''
jan@201
     9
	category:'Builder-Reports-Utils'
jan@201
    10
!
jan@201
    11
jan@201
    12
jan@265
    13
!ReportClassSourceInfo methodsFor:'accessing'!
jan@265
    14
jan@265
    15
pathNameAbsolute: aBoolean
jan@265
    16
    "Return a path (as String) to file containing the source code. The file points to the
jan@265
    17
     real source file. If `aBoolean` is true, then absolute path is returned, otherwise
jan@265
    18
     realtive path to package root is returned."
jan@265
    19
jan@265
    20
    | sourceFile packageDir |
jan@265
    21
jan@265
    22
    sourceFile := klass classFilename notNil 
jan@265
    23
                ifTrue:  [ klass classFilename ]
jan@265
    24
                ifFalse: [ (Smalltalk fileNameForClass:klass) , '.st' ].
jan@265
    25
    packageDir := aBoolean 
jan@265
    26
                    ifTrue:[ (Smalltalk getPackageDirectoryForPackage: package) pathName ]
jan@265
    27
                    ifFalse: [ package asString replaceAll: $: with: Filename separator; replaceAll: $/ with: Filename separator ].
jan@265
    28
jan@265
    29
    ^ packageDir , Filename separator , sourceFile.
jan@265
    30
jan@265
    31
    "
jan@265
    32
    (Builder::ReportSourceInfo forClass: Object inPackage: 'stx:libbasic') pathNameAbsolute: true
jan@265
    33
    (Builder::ReportSourceInfo forClass: Object inPackage: 'stx:libbasic') pathNameAbsolute: false
jan@265
    34
    "
jan@265
    35
jan@265
    36
    "Created: / 16-12-2014 / 10:25:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@265
    37
! !
jan@265
    38
jan@201
    39
!ReportClassSourceInfo methodsFor:'initialization'!
jan@201
    40
jan@201
    41
initializeWithPackage:aSymbolOrString class:aClass 
jan@201
    42
    package := aSymbolOrString asSymbol.
jan@201
    43
    klass := aClass theNonMetaclass.
jan@201
    44
    self setup.
jan@201
    45
jan@201
    46
    "Created: / 29-07-2013 / 18:37:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@201
    47
! !
jan@201
    48
jan@201
    49
!ReportClassSourceInfo methodsFor:'utilities'!
jan@201
    50
jan@201
    51
fileOutOn:aStream
jan@201
    52
    | filter |
jan@201
    53
jan@201
    54
    "JV@2012-02-02: Do not fileout extensionVersion methods, that one is filed out
jan@201
    55
     when extensions are filed out."
jan@201
    56
    (klass inheritsFrom: ProjectDefinition) ifTrue:[
jan@201
    57
        filter := [:m| m package = package 
jan@201
    58
                        and:[ (AbstractSourceCodeManager isExtensionsVersionMethodSelector:m selector) not 
jan@201
    59
                         "m selector ~~ self nameOfVersionMethodForExtensions"] 
jan@201
    60
                  ]
jan@201
    61
    ] ifFalse:[
jan@201
    62
        filter := [:mth | mth package = package ].
jan@201
    63
    ].
jan@255
    64
    klass isLoaded ifFalse:[ klass autoload ].
jan@255
    65
    klass fileOutOn:aStream 
jan@255
    66
           withTimeStamp:false 
jan@255
    67
           withInitialize:true 
jan@255
    68
           withDefinition:true
jan@255
    69
           methodFilter:filter.
jan@201
    70
jan@201
    71
    "Created: / 01-03-2013 / 17:51:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@255
    72
    "Modified: / 15-12-2014 / 11:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@201
    73
!
jan@201
    74
jan@201
    75
validate
jan@201
    76
    | file |
jan@201
    77
jan@201
    78
    file := (Smalltalk getPackageDirectoryForPackage: klass package) / ((Smalltalk fileNameForClass: klass) , '.st').
jan@201
    79
    ^ self validateAgainstReference: file
jan@201
    80
jan@201
    81
    "Modified: / 29-07-2013 / 14:54:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@201
    82
! !
jan@201
    83
jan@201
    84
!ReportClassSourceInfo class methodsFor:'documentation'!
jan@201
    85
jan@201
    86
version
jan@201
    87
    ^ '$Header$'
jan@201
    88
!
jan@201
    89
jan@201
    90
version_CVS
jan@201
    91
    ^ '$Header$'
jan@201
    92
! !
jan@201
    93