--- a/MCStXSnapshotPreWriteTransformation.st Thu Apr 23 15:12:09 2015 +0100
+++ b/MCStXSnapshotPreWriteTransformation.st Fri Apr 24 12:49:54 2015 +0100
@@ -1,11 +1,9 @@
-"{ Encoding: utf8 }"
-
"{ Package: 'stx:goodies/monticello' }"
"{ NameSpace: Smalltalk }"
MCStXSnapshotTransformation subclass:#MCStXSnapshotPreWriteTransformation
- instanceVariableNames:'extensionMethodCategoryMap projectDefinition'
+ instanceVariableNames:'extensionMethodCategoryMap projectDefinition includeExtrasForSTX'
classVariableNames:''
poolDictionaries:''
category:'SCM-Monticello-St/X Storing'
@@ -29,6 +27,22 @@
"
! !
+!MCStXSnapshotPreWriteTransformation class methodsFor:'transforming'!
+
+transform: anMCSnapshot
+ "Returns a transformed **copy** of the original snapshot"
+
+ ^self new transform: anMCSnapshot includeExtrasForSTX: true
+
+ "Created: / 23-04-2015 / 23:17:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+transform: anMCSnapshot includeExtrasForSTX: aBoolean
+ ^self new transform: anMCSnapshot includeExtrasForSTX: aBoolean
+
+ "Created: / 23-04-2015 / 23:16:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!MCStXSnapshotPreWriteTransformation methodsFor:'accessing'!
monticelloName
@@ -106,6 +120,7 @@
transform: anMCSnapshot
"Returns a transformed **copy** of the original snapshot"
+ includeExtrasForSTX := anMCSnapshot includeExtrasForSTX.
extensionMethodCategoryMap := OrderedCollection new.
original := anMCSnapshot.
projectDefinition := self projectDefinition.
@@ -138,7 +153,14 @@
^transformed.
"Created: / 31-05-2013 / 00:05:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 12-06-2013 / 09:23:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 24-04-2015 / 12:39:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+transform: anMCSnapshot includeExtrasForSTX: aBoolean
+ includeExtrasForSTX := aBoolean.
+ ^ self transform: anMCSnapshot
+
+ "Created: / 23-04-2015 / 23:17:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!MCStXSnapshotPreWriteTransformation methodsFor:'visiting'!
@@ -153,28 +175,41 @@
class := definition actualClass.
class isProjectDefinition ifTrue:[
- definition
-"/ className:(definition className capitalized);
- superclassName: #Object;
- category: class monticelloName.
+ transformed definitions remove: definition.
+ includeExtrasForSTX ifTrue:[
+ definition
+ "/ className:(definition className capitalized);
+ superclassName: #Object;
+ category: class monticelloName.
- transformed definitions addFirst:
- (MCMethodDefinition
- className: definition className
- classIsMeta: true
- selector: 'monticelloProjectDefinitionTypeName'
- category: 'accessing - monticello'
- timeStamp: 'Generated by ', self class name , ' at ' , Timestamp now printString
- source:
- (self monticelloSmalltalkXProjectType_Code bindWith: (class isApplicationDefinition ifTrue:[#application] ifFalse:[#library]) storeString))
+ transformed definitions addFirst:
+ (MCMethodDefinition
+ className: definition className
+ classIsMeta: true
+ selector: 'monticelloProjectDefinitionTypeName'
+ category: 'accessing - monticello'
+ timeStamp: 'Generated by ', self class name , ' at ' , Timestamp now printString
+ source:
+ (self monticelloSmalltalkXProjectType_Code bindWith: (class isApplicationDefinition ifTrue:[#application] ifFalse:[#library]) storeString))
+ ]
]
"Created: / 29-05-2013 / 12:19:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 20-09-2013 / 00:14:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-04-2015 / 23:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
visitMethodDefinition: definition
- | source|
+ | class source |
+
+ "/ If St/X extras should not be included, then remove all methods
+ "/ that belong to project definition class.
+ includeExtrasForSTX ifFalse:[
+ class := definition actualClass.
+ class == projectDefinition ifTrue:[
+ transformed definitions remove: definition.
+ ^ self.
+ ].
+ ].
source := definition source asStringWithNativeLineEndings asStringCollection withTabs asStringWithSqueakLineEndings.
source := source asSingleByteStringIfPossible.
@@ -195,7 +230,7 @@
].
"Created: / 30-05-2013 / 22:48:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 06-11-2014 / 03:11:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-04-2015 / 23:31:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
visitOrganizationDefinition: defintion