Loads the package if not already loaded.
--- a/reports/Builder__Report.st Fri Jan 13 14:01:28 2012 +0100
+++ b/reports/Builder__Report.st Fri Jan 13 14:01:37 2012 +0100
@@ -212,7 +212,10 @@
short: $p;
long: '--package';
description: 'Package in which to run the report';
- action:[:option | self setupForPackages: { option } ]
+ action:[:option |
+ self loadPackageIfNotAlready: option.
+ self setupForPackages: { option }
+ ]
"Created: / 06-11-2011 / 21:49:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
@@ -270,6 +273,24 @@
encodeFilename:arg
^ self class encodeFilename:arg
+!
+
+loadPackageIfNotAlready: pkg
+ "Loads a package, if it is not loaded allready. Raises an error if package cannot be loaded"
+
+ | def |
+ def := ProjectDefinition definitionClassForPackage:pkg.
+ def isNil ifTrue:[
+ (Smalltalk loadPackage:pkg asSymbol) ifFalse:[
+ self error:'Cannot load package: ', pkg.
+ ].
+ def := ProjectDefinition definitionClassForPackage:pkg.
+ ].
+ def isNil ifTrue:[
+ self error:'Package loaded but project definition not found: ', pkg
+ ].
+
+ "Created: / 13-01-2012 / 12:56:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Report methodsFor:'running'!