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