--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/reports/Builder__ReportExtensionsSourceInfo.st Mon Jul 29 20:26:47 2013 +0200
@@ -0,0 +1,134 @@
+"{ Package: 'stx:goodies/builder/reports' }"
+
+"{ NameSpace: Builder }"
+
+ReportSourceInfo subclass:#ReportExtensionsSourceInfo
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Builder-Reports-Utils'
+!
+
+
+!ReportExtensionsSourceInfo methodsFor:'initialization'!
+
+initializeWithPackage: pkg
+ package := pkg.
+ self setup.
+
+ "Created: / 29-07-2013 / 18:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ReportExtensionsSourceInfo methodsFor:'utilities'!
+
+fileOutOn: streamArg
+ "This code is stupid as it is a copy-paste of several methods here and there that
+ files out an extension.st. But the the original code is so rubbish so I had
+ to do it this way. Sorry."
+
+ | extensions wide stream s methodsSortedByName defClass scmManagerOrNil |
+
+ extensions := ProjectDefinition searchForExtensionsWithProject: package.
+ wide := false.
+ stream := streamArg.
+ extensions do:[:method|
+ wide := wide or:[method source isWideString].
+ ].
+ wide ifTrue:[
+ stream := EncodedStream stream: stream encoder: (CharacterEncoder encoderForUTF8).
+ stream nextPutAll: '"{ Encoding: utf8 }"'; cr;cr.
+ ].
+
+ s := stream.
+
+ s nextPutAll:'"{ Package: '''.
+ s nextPutAll:package asString.
+ s nextPutAll:''' }"'; nextPutChunkSeparator; cr; cr.
+
+ "/ don't write a timestamp. Otherwise we would always generate a new version, even if nothing changed
+ "/ s nextPutAll:(Smalltalk timeStamp).
+ "/ s nextPutChunkSeparator.
+ "/ s cr; cr.
+
+ "/ sort them by name (to avoid conflicts due to SCM merge)
+ methodsSortedByName := extensions asOrderedCollection.
+ methodsSortedByName sort:[:a :b |
+ |clsA clsB|
+
+ clsA := a mclass name.
+ clsB := b mclass name.
+ clsA < clsB ifTrue:[
+ true
+ ] ifFalse:[
+ clsA > clsB ifTrue:[
+ false
+ ] ifFalse:[
+ a selector < b selector
+ ]
+ ]
+ ].
+ methodsSortedByName do:[:aMethod |
+ |cat source privacy aStream|
+
+ aStream := s.
+
+ aStream nextPutChunkSeparator.
+ aMethod mclass name printOn:aStream.
+"/ self printClassNameOn:aStream.
+
+ (privacy := aMethod privacy) ~~ #public ifTrue:[
+ aStream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'.
+ ] ifFalse:[
+ aStream nextPutAll:' methodsFor:'.
+ ].
+
+ cat := aMethod category ? ''.
+ aStream nextPutAll:cat asString storeString.
+ aStream nextPutChunkSeparator; cr; cr.
+
+ SmalltalkChunkFileSourceWriter new fileOutMethod:aMethod on:aStream.
+
+ aStream space.
+ aStream nextPutChunkSeparator.
+ aStream cr.
+ s cr.
+ ].
+
+ scmManagerOrNil := AbstractSourceCodeManager managerForPackage: package.
+ scmManagerOrNil notNil ifTrue:[
+ defClass := ProjectDefinition definitionClassForPackage:package.
+ defClass notNil ifTrue:[
+ "/ make sure, an extensionVersion_XXX method is included...
+ "/ (notice: no need to support a secondary backward compatible non-manager related version method here)
+ (methodsSortedByName contains:[:aMethod | aMethod selector == scmManagerOrNil nameOfVersionMethodForExtensions]) ifFalse:[
+ s nextPutLine:('!!%1 class methodsFor:''documentation''!!' bindWith:defClass name).
+ s cr.
+ s nextChunkPut:
+ (scmManagerOrNil versionMethodTemplateForSmalltalkFor:(scmManagerOrNil nameOfVersionMethodForExtensions)).
+ s space; nextPutChunkSeparator; cr.
+ ].
+ ].
+ ].
+
+ "Modified (comment): / 29-07-2013 / 17:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+validate
+ | file |
+
+ file := (Smalltalk getPackageDirectoryForPackage: package) / 'extensions.st'.
+ ^ self validateAgainstReference: file.
+
+ "Modified: / 29-07-2013 / 14:55:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ReportExtensionsSourceInfo class methodsFor:'documentation'!
+
+version
+ ^ '$Header$'
+!
+
+version_CVS
+ ^ '$Header$'
+! !
+