--- a/AbstractSourceCodeManager.st Wed Feb 05 18:52:06 2014 +0100
+++ b/AbstractSourceCodeManager.st Wed Feb 05 18:52:08 2014 +0100
@@ -196,7 +196,7 @@
ManagerPerModule do:[:each |
|packageMatch|
- packageMatch := each pattern.
+ packageMatch := each package.
(packageMatch = aPackageIDMatchString) ifTrue:[
each manager:aSourceCodeManagerClass.
^ self
@@ -215,7 +215,7 @@
"
"Created: / 18-04-2011 / 19:48:19 / cg"
- "Modified: / 09-07-2011 / 15:05:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-07-2013 / 10:40:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
managerForPackage:aPackageID
@@ -982,6 +982,82 @@
"Modified: / 24-07-2011 / 07:13:58 / cg"
!
+checkTabSpaceConventionIn: aStream
+ "This method checks whether data in given stream follows
+ tab-space discipline.
+
+ More precisely, this checks that each line starts with zero or more
+ tabs (16r9) followed by 0-7 spaces (16r32) followed by non-space non-tab
+ character.
+ "
+
+ | checkStream |
+
+ aStream isFileStream ifTrue:[
+ aStream flush.
+ checkStream := aStream pathName asFilename readStream .
+ ] ifFalse:[
+ aStream isExternalStream not ifTrue:[
+ checkStream := aStream contents asString readStream.
+ ].
+ ].
+ [
+ [ checkStream atEnd ] whileFalse:[
+ | line done nspaces |
+
+ nspaces := 0.
+ line := checkStream nextLine readStream.
+ done := line atEnd.
+ [ done ] whileFalse:[
+ | c |
+
+ c := line next.
+ c == Character space ifTrue:[
+ nspaces := nspaces + 1.
+ nspaces == 8 ifTrue:[
+"/ self breakPoint: #jv info: 'Oops, every consecutive 8 spaces should be a tab!! CHECK THE CALLER NOW!!!!!!'.
+"/
+ "/ There are only two solutions: either (i) relax the rule and do not make any conversion
+ "/ (ii) or write a sed script to fix all sources, commit and then debug why it is so,
+ "/ Otherwise, we merging will forever be pain in the...
+ self breakPoint: #cg info: 'Oops, every consecutive 8 spaces should be a tab!! CHECK THE CALLER NOW!!!!!!'.
+ ].
+ ].
+ c == Character tab ifTrue:[
+ nspaces ~~ 0 ifTrue:[
+"/ self breakPoint: #jv info: 'Oops, spaces followed by tab!! CHECK THE CALLER NOW!!!!!!'.
+
+ "/ There are only two solutions: either (i) relax the rule and do not make any conversion
+ "/ (ii) or write a sed script to fix all sources, commit and then debug why it is so,
+ "/ Otherwise, we merging will forever be pain in the...
+ self breakPoint: #cg info: 'Oops, spaces followed by tab!! CHECK THE CALLER NOW!!!!!!'.
+ ].
+ ].
+ done := (c ~~ Character space and:[c ~~ Character tab ]) or:[line atEnd].
+ ].
+ ].
+ ] ensure:[
+ checkStream close.
+ ].
+
+ "
+ Good:
+ AbstractSourceCodeManager checkTabSpaceConventionIn: #[9 32 32 32 32 97 ] readStream
+ AbstractSourceCodeManager checkTabSpaceConventionIn: #[97 10 10 10 9 32 32 32 32 97 ] readStream
+
+ Bad:
+ AbstractSourceCodeManager checkTabSpaceConventionIn: #[32 32 32 32 32 32 32 32 97 ] readStream
+ AbstractSourceCodeManager checkTabSpaceConventionIn: #[97 10 10 10 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 97 ] readStream
+ AbstractSourceCodeManager checkTabSpaceConventionIn: #[97 10 10 10 9 32 32 32 32 32 32 32 32 97 ] readStream
+ AbstractSourceCodeManager checkTabSpaceConventionIn: #[97 10 10 10 32 32 32 32 9 97 ] readStream
+
+
+ "
+
+ "Created: / 29-11-2013 / 12:01:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 29-11-2013 / 14:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
compileVersionMethod:methodName of:aClass for:newRevisionString
|cls mthd code|
@@ -1826,11 +1902,12 @@
it would get expanded by the sourcecodemanager, which we do not want here"
^
-'function ',aSelector,'() {
- return "$' , 'Header' , '$"
+"'function ',"aSelector,'() {
+ return "$' , self versionMethodKeyword , '$";
}'
"Created: / 19-08-2011 / 01:20:56 / cg"
+ "Modified: / 20-09-2012 / 12:13:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
versionMethodTemplateForRuby
@@ -2485,81 +2562,36 @@
fileOutSourceCodeExtensions: extensions package: package on: stream
"File out extension methods for given package on stream.
- Not programming-language safe - can only handle smalltalk methods.
- "
+ Not programming-language safe - can handle smalltalk methods."
+
+ ^self fileOutSourceCodeExtensions: extensions package: package on: stream version: true.
+
+ "Created: / 02-02-2012 / 15:30:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-11-2012 / 23:51:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fileOutSourceCodeExtensions: extensions package: pkg on: stream version: versionIt
+ "File out extension methods for given package on stream.
+ Not programming-language safe - can handle smalltalk methods."
| source |
- "/ all must be scmalltalk code
- self assert: (extensions conform:[:m | m programmingLanguage isSmalltalk]).
-
- source := self utilities sourceCodeForExtensions:extensions package:package forManager:self.
+ self assert: (extensions allSatisfy:[:m|m programmingLanguage isSmalltalk]).
+ source := self utilities sourceCodeForExtensions:extensions package:pkg forManager:self.
source isWideString ifTrue:[
| s |
- s := EncodedStream stream: stream encoder: (CharacterEncoder encoderForUTF8).
+ s:= EncodedStream stream: stream encoder: (CharacterEncoder encoderForUTF8).
s nextPutAll: '"{ Encoding: utf8 }"'; cr;cr.
s nextPutAll: source.
] ifFalse:[
stream nextPutAll: source.
].
-"/
-"/ NOTE: method body taken from
-"/ SourceCodeManagerUtilities>>checkinExtensionMethods:forPackage:withInfo:
-"/ CVS revision 1.240
-"/ "
-"/
-"/ | methodsSortedByName defClass |
-"/
-"/ self withSourceRewriteHandlerDo:[
-"/ stream nextPutAll:'"{ Package: '''.
-"/ stream nextPutAll:package asString.
-"/ stream nextPutAll:''' }"'; nextPutChunkSeparator; cr; cr.
-"/
-"/"/ s nextPutAll:(Smalltalk timeStamp).
-"/"/ s nextPutChunkSeparator.
-"/"/ s cr; cr.
-"/
-"/ "/ sort them by name (to avoid conflict due to CVS 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 |
-"/ self assert: aMethod package = package.
-"/ self assert: aMethod programmingLanguage isSmalltalk.
-"/ aMethod mclass fileOutMethod:aMethod on:stream.
-"/ stream cr.
-"/ ].
-"/
-"/ 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 == self nameOfVersionMethodForExtensions]) ifFalse:[
-"/ stream nextPutLine:('!!%1 class methodsFor:''documentation''!!' bindWith:defClass name).
-"/ stream cr.
-"/ stream nextChunkPut:
-"/ (self versionMethodTemplateForSmalltalkFor:(self nameOfVersionMethodForExtensions)).
-"/ stream space; nextPutChunkSeparator.
-"/ ].
-"/ ].
-"/ ].
-"/
-"/ "Created: / 02-02-2012 / 15:30:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ self checkTabSpaceConventionIn: stream.
+
+ "Created: / 07-11-2012 / 23:50:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 29-11-2013 / 13:10:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fileOutSourceCodeOf:aClass on:aStream
@@ -2593,7 +2625,9 @@
methodFilter:filter.
].
- "Modified: / 02-02-2012 / 15:53:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ self checkTabSpaceConventionIn: aStream.
+
+ "Modified: / 29-11-2013 / 12:01:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
getExistingContainersInModule:aModule directory:aPackage
@@ -3839,15 +3873,15 @@
!AbstractSourceCodeManager class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.318 2013-11-14 15:34:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.319 2014-02-05 17:52:08 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.318 2013-11-14 15:34:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.319 2014-02-05 17:52:08 cg Exp $'
!
version_SVN
- ^ '$Id: AbstractSourceCodeManager.st,v 1.318 2013-11-14 15:34:21 stefan Exp $'
+ ^ '$Id: AbstractSourceCodeManager.st,v 1.319 2014-02-05 17:52:08 cg Exp $'
! !