"{ Package: 'stx:goodies/builder/reports' }"
"{ NameSpace: Builder }"
StandaloneStartup subclass:#ReportRunner
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Builder-Reports'
!
ReportRunner class instanceVariableNames:'parser report debugging'
"
The following class instance variables are inherited by this class:
StandaloneStartup - MutexHandle
Object -
"
!
!ReportRunner class methodsFor:'initialization'!
initialize
super initialize.
debugging := Transcript notNil and:[Transcript isView].
"Created: / 06-11-2011 / 22:07:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ReportRunner class methodsFor:'command line options'!
cmdlineOptionOutputDirectory
^CmdLineOption new
short: $D;
long: 'output-directory';
description: 'Default report output directory';
action:[:outputdir |
Report outputDir: outputdir.
self verboseInfo:'Report dir: ' , Report outputDir asString.
]
"Created: / 06-11-2011 / 09:33:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
cmdlineOptionReport
^CmdLineOption new
short: $r;
long: 'report';
description: 'Report to run';
action:[:option |
report := Smalltalk at: option asSymbol.
report isNil ifTrue:[
Stderr nextPutLine:('ERROR: Report class %1 does not exist (forgot to load package?)' bindWith: option).
"/Smalltalk exit: 1.
].
report := report new.
parser options addAll: (CmdLineOption optionsFor: report)
]
"Created: / 06-11-2011 / 09:45:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 31-10-2012 / 12:40:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ReportRunner class methodsFor:'defaults'!
allowCoverageMeasurementOption
^false "CoverageReport will do that"
"Created: / 13-01-2012 / 11:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
allowDebugOption
^true
"Created: / 21-07-2011 / 09:48:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ReportRunner class methodsFor:'multiple applications support'!
applicationRegistryPath
"the key under which this application stores its process ID in the registry
as a collection of path-components.
i.e. if #('foo' 'bar' 'baz') is returned here, the current applications ID will be stored
in HKEY_CURRENT_USER\Software\foo\bar\baz\CurrentID.
(would also be used as a relative path for a temporary lock file under unix).
Used to detect if another instance of this application is already running."
^ #('exept' 'smalltallx' 'hdreportrunner')
"Modified: / 21-07-2011 / 09:43:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
applicationUUID
"answer an application-specific unique uuid.
This is used as the name of some exclusive OS-resource, which is used to find out,
if another instance of this application is already running.
Under win32, a mutex is used; under unix, an exclusive file in the tempDir could be used."
^ '99f65c80-b375-11e0-86ad-0013e89c0459' asUUID
"Modified: / 21-07-2011 / 09:44:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ReportRunner class methodsFor:'startup'!
setupToolsForDebug
super setupToolsForDebug.
debugging := true.
"Created: / 06-11-2011 / 22:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
usage
Stderr nextPutAll:'usage: report-runner.';
nextPutAll: (OperatingSystem isMSWINDOWSlike ifTrue:['bat'] ifFalse:['sh']);
nextPutAll: ' [-D <dir>] -r <report> [-p <package1> [-p <package2> [...]]]'; cr.
Stderr nextPutLine:' --help .................. output this message'.
Stderr nextPutLine:' --verbose ............... verbose startup'.
Stderr nextPutLine:' --noBanner .............. no splash screen'.
Stderr nextPutLine:' --newAppInstance ........ start as its own application process (do not reuse a running instance)'.
self allowScriptingOption ifTrue:[
Stderr nextPutLine:' --scripting portNr ...... enable scripting via port (or stdin/stdOut, if 0)'.
].
self allowDebugOption ifTrue:[
Stderr nextPutLine:' --debug ................. enable Debugger'.
].
"/ ' ......................... '
Stderr nextPutLine:' -D <dir>'.
Stderr nextPutLine:' --output-directory=<dir> directory where report files will go'.
Stderr nextPutLine:' -r <report class>'.
Stderr nextPutLine:' --report=<report class> . report to run. available reports:'.
Report available do:[:report|
Stderr nextPutAll:' '; nextPutLine: report name
].
Stderr nextPutLine:' -p <package>'.
Stderr nextPutLine:' --package=<package> ..... package to run report on'.
Stderr nextPutLine:' May be specified multiple times.'.
"
self usage
"
"Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ReportRunner class methodsFor:'startup-to be redefined'!
main:argv
"Process command line arguments"
parser := CmdLineParser new.
[
parser parse: argv for: self.
] on:CmdLineOptionError do:[:ex|
Stderr nextPutLine:'Error when processing options: ', ex description.
debugging ifFalse:[
ex suspendedContext fullPrintAllOn: Stderr.
Stderr nextPutLine:'Exiting'.
Smalltalk exit:1.
] ifTrue:[
ex pass
]
].
[
report run.
debugging ifFalse:[
Smalltalk exit:0.
].
] on: Error do:[:ex|
Stderr nextPutAll:'Error when running tests: '.
Stderr nextPutAll:ex description; cr.
ex suspendedContext printAllOn:Stderr.
debugging ifFalse:[
Smalltalk exit:1.
] ifTrue:[
ex pass
]
]
"Modified: / 13-11-2012 / 09:40:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ReportRunner class methodsFor:'documentation'!
version
^ '$Header$'
!
version_CVS
^ '$Header$'
!
version_SVN
^ '§Id: Builder__ReportRunner.st 289 2011-11-10 15:39:10Z vranyj1 §'
! !
ReportRunner initialize!