author | convert-repo |
Tue, 09 Aug 2016 03:35:19 +0000 | |
changeset 1012 | 6c2b1a2886d5 |
parent 975 | 9d3047664305 |
child 995 | 92bb466548a9 |
child 1041 | 4e3b40303d42 |
permissions | -rw-r--r-- |
429 | 1 |
"{ Package: 'stx:goodies/monticello' }"! |
2 |
||
3 |
!Annotation class methodsFor:'instance creation'! |
|
395 | 4 |
|
5 |
mctimestamp: aString |
|
6 |
||
7 |
^MCTimestampAnnotation new timestamp: aString |
|
8 |
||
9 |
"Created: / 14-09-2010 / 15:35:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10 |
! ! |
|
11 |
||
429 | 12 |
!Behavior methodsFor:'*monticello-squeakCompatibility'! |
395 | 13 |
|
14 |
traitCompositionString |
|
15 |
^ '{}' |
|
16 |
||
17 |
"Created: / 26-08-2009 / 12:43:23 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
18 |
! ! |
|
19 |
||
429 | 20 |
!Behavior methodsFor:'*monticello-squeakCompatibility'! |
150 | 21 |
|
22 |
typeOfClass |
|
395 | 23 |
"Answer a symbol uniquely describing the type of the receiver" |
24 |
"self instSpec = CompiledMethod instSpec ifTrue:[^#compiledMethod]." "Very special!!" |
|
25 |
self isBytes ifTrue:[^#bytes]. |
|
26 |
(self isWords and:[self isPointers not]) ifTrue:[^#words]. |
|
27 |
self isWeakPointers ifTrue:[^#weak]. |
|
28 |
self isVariable ifTrue:[^#variable]. |
|
29 |
^#normal. |
|
30 |
||
31 |
"Created: / 26-08-2009 / 12:45:50 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
32 |
! ! |
|
33 |
||
429 | 34 |
!Change methodsFor:'accessing'! |
395 | 35 |
|
36 |
mcDefinition |
|
37 |
||
38 |
^self objectAttributeAt: #mcDefinition |
|
39 |
||
40 |
"Created: / 08-11-2010 / 17:56:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
41 |
! ! |
|
42 |
||
429 | 43 |
!Change methodsFor:'accessing'! |
395 | 44 |
|
45 |
mcDefinition: aMCDefinition |
|
46 |
||
47 |
^self objectAttributeAt: #mcDefinition put: aMCDefinition |
|
48 |
||
49 |
"Created: / 08-11-2010 / 17:56:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
150 | 50 |
! ! |
136 | 51 |
|
436
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
52 |
!CharacterArray methodsFor:'*monticello-squeakCompatibility'! |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
53 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
54 |
asStringWithNativeLineEndings |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
55 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
56 |
^self copyReplaceAll:Character return with: Character cr |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
57 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
58 |
"Created: / 12-09-2010 / 16:00:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
59 |
"Modified: / 13-10-2010 / 17:27:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
60 |
! ! |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
61 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
62 |
!CharacterArray methodsFor:'*monticello-squeakCompatibility'! |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
63 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
64 |
asStringWithSqueakLineEndings |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
65 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
66 |
^self copyReplaceAll:Character cr with: Character return |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
67 |
|
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
68 |
"Created: / 12-09-2010 / 16:00:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
69 |
"Modified: / 13-10-2010 / 17:28:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
70 |
! ! |
436066f63a27
moved asStringWith*LineEndings to CharacterArray
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
429
diff
changeset
|
71 |
|
429 | 72 |
!Class methodsFor:'*monticello'! |
136 | 73 |
|
74 |
asClassDefinition |
|
395 | 75 |
^ MCClassDefinition |
76 |
name: self name |
|
736
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
77 |
superclassName: (self superclass isNil ifTrue:['nil'] ifFalse:[self superclass name]) |
395 | 78 |
traitComposition: self traitCompositionString |
79 |
classTraitComposition: self class traitCompositionString |
|
80 |
category: self category |
|
81 |
instVarNames: self instVarNames |
|
82 |
classVarNames: self classVarNames |
|
83 |
poolDictionaryNames: self poolDictionaryNames |
|
84 |
classInstVarNames: self class instVarNames |
|
85 |
type: self typeOfClass |
|
86 |
comment: (self organization classComment ? '') asStringWithSqueakLineEndings |
|
87 |
commentStamp: self organization commentStamp |
|
88 |
||
89 |
"Modified: / 12-09-2010 / 17:19:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
136 | 90 |
! ! |
91 |
||
429 | 92 |
!Class methodsFor:'*monticello'! |
136 | 93 |
|
94 |
classDefinitions |
|
888
f5d285e135d2
Fix in ProjectDefinition>>monticelloName.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
883
diff
changeset
|
95 |
self isLoaded ifFalse:[self autoload]. |
136 | 96 |
^ Array with: self asClassDefinition |
97 |
! ! |
|
98 |
||
429 | 99 |
!Class methodsFor:'*monticello'! |
136 | 100 |
|
101 |
poolDictionaryNames |
|
160 | 102 |
^ self sharedPools "/ collect: [:ea | ea name "self environment keyAtIdentityValue: ea"] |
136 | 103 |
! ! |
104 |
||
429 | 105 |
!ClassDescription methodsFor:'*monticello-squeakCompatibility'! |
395 | 106 |
|
107 |
mcDefinition |
|
108 |
||
109 |
|s| |
|
110 |
||
111 |
s := WriteStream on:(String new). |
|
112 |
self |
|
113 |
basicFileOutDefinitionOn:s |
|
114 |
withNameSpace:false |
|
115 |
withPackage:false. |
|
116 |
s position: s position - 1. |
|
117 |
||
118 |
^ s contents |
|
119 |
||
120 |
"Created: / 11-09-2010 / 18:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
121 |
! ! |
|
122 |
||
429 | 123 |
!Object methodsFor:'*monticello'! |
136 | 124 |
|
125 |
isConflict |
|
126 |
^false |
|
127 |
! ! |
|
128 |
||
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
129 |
!PackageInfo methodsFor:'testing'! |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
130 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
131 |
isMCStXPackageInfo |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
132 |
^ false |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
133 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
134 |
"Created: / 29-05-2013 / 01:08:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
135 |
! ! |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
136 |
|
429 | 137 |
!ProjectDefinition class methodsFor:'code generation'! |
395 | 138 |
|
452
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
139 |
monticelloAncestry_code |
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
140 |
|
459
cae7224c4ab3
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
452
diff
changeset
|
141 |
^'#()' |
452
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
142 |
|
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
143 |
"Created: / 25-08-2011 / 16:49:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
144 |
! ! |
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
145 |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
146 |
!ProjectDefinition class methodsFor:'accessing - monticello'! |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
147 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
148 |
monticelloName |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
149 |
"Return name of the package for Monticello. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
150 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
151 |
Historically, Monticello package membership is based on |
878 | 152 |
naming conventions. All classes whose category name starts with |
153 |
package name are considerer as belonging to the package, others |
|
154 |
do not. If classes' category does not match this naming convention, |
|
155 |
the package will fail to load back properly. |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
156 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
157 |
Here, infer such prefix. Individual packages may override this method |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
158 |
and return a string to enforce a particular name." |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
159 |
|
878 | 160 |
| cats longest prefix index nm | |
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
161 |
|
889
329193445e6f
Funny, previous fix does not work. This code does.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
888
diff
changeset
|
162 |
cats := (self classes collect:[:each | each autoload; category ]) asSet. |
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
163 |
cats remove:#'* Projects & Packages *'. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
164 |
cats size == 1 ifTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
165 |
^ cats anElement |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
166 |
]. |
878 | 167 |
cats isEmpty ifTrue:[ |
168 |
^ 'Misc_Changes' |
|
169 |
]. |
|
975 | 170 |
longest := cats |
171 |
inject:cats anElement |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
172 |
into:[:cat :each | |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
173 |
each size > cat size ifTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
174 |
each |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
175 |
] ifFalse:[ cat ] |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
176 |
]. |
975 | 177 |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
178 |
prefix := ''. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
179 |
[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
180 |
(index := longest indexOf:$- startingAt:prefix size + 2) ~~ 0 |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
181 |
] whileTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
182 |
prefix := longest copyTo:index - 1. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
183 |
(cats allSatisfy:[:each | each startsWith:prefix ]) ifTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
184 |
nm := prefix. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
185 |
]. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
186 |
]. |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
187 |
nm notNil ifTrue:[ |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
188 |
^ nm |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
189 |
]. |
975 | 190 |
^ self package asString copyReplaceAny:':/' with:$_. |
191 |
||
192 |
"/ self |
|
193 |
"/ error:'Cannot infer Monticello package name from class categories. Please define #mcName explicitly' |
|
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
194 |
|
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
195 |
"Created: / 29-05-2013 / 01:36:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
888
f5d285e135d2
Fix in ProjectDefinition>>monticelloName.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
883
diff
changeset
|
196 |
"Modified: / 23-06-2013 / 21:12:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
839
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
197 |
! ! |
73bbd675ef17
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
786
diff
changeset
|
198 |
|
883
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
199 |
!ProjectDefinition class methodsFor:'accessing - monticello'! |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
200 |
|
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
201 |
monticelloNameForMCZ |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
202 |
"Return the name of package used to build .mcz file. |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
203 |
Defaults to sanitized monticelloName" |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
204 |
|
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
205 |
^self monticelloName asString copy replaceAll: $/ with: $_; replaceAll: $: with: $_ |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
206 |
|
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
207 |
"Created: / 07-06-2013 / 01:48:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
208 |
! ! |
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
209 |
|
452
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
210 |
!ProjectDefinition class methodsFor:'code generation'! |
cbc2f85f11f8
fixes for remembering Monticello metadata
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
437
diff
changeset
|
211 |
|
395 | 212 |
monticelloTimestamps_code |
213 |
||
214 |
| methodsWithTimestamp | |
|
215 |
methodsWithTimestamp := OrderedCollection new. |
|
216 |
||
217 |
self classes do:[:cls| |
|
218 |
cls methodsDo:[:mthd| |
|
219 |
(mthd hasAnnotation: #mctimestamp:) ifTrue:[ |
|
220 |
methodsWithTimestamp add: mthd |
|
221 |
] |
|
222 |
]. |
|
223 |
]. |
|
224 |
self extensionMethods do:[:mthd| |
|
225 |
(mthd hasAnnotation: #mctimestamp:) ifTrue:[ |
|
226 |
methodsWithTimestamp add: mthd |
|
227 |
] |
|
228 |
]. |
|
229 |
||
230 |
^self monticelloTimestamps_codeFor: methodsWithTimestamp |
|
231 |
||
232 |
" |
|
233 |
stx_goodies_mondrian_core monticelloTimestamps_code |
|
234 |
" |
|
235 |
||
236 |
"Created: / 09-11-2010 / 18:23:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
237 |
! ! |
|
238 |
||
429 | 239 |
!ProjectDefinition class methodsFor:'code generation'! |
395 | 240 |
|
241 |
monticelloTimestamps_codeFor: methods |
|
242 |
||
243 |
| code | |
|
244 |
code := String new writeStream. |
|
245 |
code nextPutAll:'monticelloTimestamps |
|
246 |
||
247 |
^#('. |
|
248 |
methods do:[:mthd| |
|
249 |
code |
|
250 |
tab; tab; |
|
251 |
nextPut:$(; |
|
252 |
nextPutAll: mthd mclass fullName; |
|
253 |
space; |
|
254 |
nextPutAll: mthd selector; |
|
255 |
space; |
|
256 |
nextPutAll: (mthd annotationAt: #mctimestamp:) timestamp storeString; |
|
257 |
nextPut:$); |
|
258 |
cr. |
|
259 |
]. |
|
260 |
code nextPutAll:' |
|
261 |
)'. |
|
262 |
||
263 |
^code contents |
|
264 |
||
265 |
" |
|
266 |
stx_goodies_mondrian_core mcTimestamps_code |
|
267 |
" |
|
268 |
||
269 |
"Created: / 09-11-2010 / 18:27:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
270 |
! ! |
|
271 |
||
429 | 272 |
!SequenceableCollection methodsFor:'*monticello-squeakCompatibility'! |
395 | 273 |
|
274 |
copyReplaceAll: oldSubstring with: newSubstring asTokens: ifTokens |
|
275 |
"Answer a copy of the receiver in which all occurrences of |
|
276 |
oldSubstring have been replaced by newSubstring. |
|
277 |
ifTokens (valid for Strings only) specifies that the characters |
|
278 |
surrounding the recplacement must not be alphanumeric. |
|
279 |
Bruce Simth, must be incremented by 1 and not |
|
280 |
newSubstring if ifTokens is true. See example below. " |
|
281 |
||
282 |
| aString startSearch currentIndex endIndex | |
|
283 |
(ifTokens and: [(self isString) not]) |
|
284 |
ifTrue: [(self isKindOf: Text) ifFalse: [ |
|
285 |
self error: 'Token replacement only valid for Strings']]. |
|
286 |
aString := self. |
|
287 |
startSearch := 1. |
|
288 |
[(currentIndex := aString indexOfSubCollection: oldSubstring startingAt: startSearch) |
|
289 |
> 0] |
|
290 |
whileTrue: |
|
291 |
[endIndex := currentIndex + oldSubstring size - 1. |
|
292 |
(ifTokens not |
|
293 |
or: [(currentIndex = 1 |
|
294 |
or: [(aString at: currentIndex-1) isAlphaNumeric not]) |
|
295 |
and: [endIndex = aString size |
|
296 |
or: [(aString at: endIndex+1) isAlphaNumeric not]]]) |
|
297 |
ifTrue: [aString := aString |
|
298 |
copyReplaceFrom: currentIndex |
|
299 |
to: endIndex |
|
300 |
with: newSubstring. |
|
301 |
startSearch := currentIndex + newSubstring size] |
|
302 |
ifFalse: [ |
|
303 |
ifTokens |
|
304 |
ifTrue: [startSearch := currentIndex + 1] |
|
305 |
ifFalse: [startSearch := currentIndex + newSubstring size]]]. |
|
306 |
^ aString |
|
307 |
||
308 |
"Test case: |
|
309 |
'test te string' copyReplaceAll: 'te' with: 'longone' asTokens: true " |
|
310 |
||
311 |
"Created: / 26-08-2009 / 12:40:34 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
312 |
! ! |
|
313 |
||
429 | 314 |
!Stream methodsFor:'*monticello'! |
136 | 315 |
|
316 |
isMessageStream |
|
317 |
^ false |
|
318 |
! ! |
|
319 |
||
429 | 320 |
!String methodsFor:'*monticello'! |
136 | 321 |
|
322 |
extractNumber |
|
323 |
^ ('0', self select: [:ea | ea isDigit]) asNumber |
|
324 |
! ! |
|
325 |
||
429 | 326 |
!String methodsFor:'*monticello-squeakCompatibility'! |
395 | 327 |
|
328 |
withSqueakLineEndings |
|
329 |
"Answer a copy of myself in which all sequences of <CR><LF> or <LF> have been changed to <CR>" |
|
330 |
| newText | |
|
331 |
(self includes: Character lf) ifFalse: [ ^self copy ]. |
|
332 |
newText := self copyReplaceAll: String crlf with: String cr. |
|
333 |
(newText asString includes: Character lf) ifFalse: [ ^newText ]. |
|
334 |
^newText copyReplaceAll: String lf with: String cr asTokens: false. |
|
335 |
||
336 |
"Created: / 26-08-2009 / 11:35:56 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
337 |
! ! |
|
338 |
||
429 | 339 |
!StringCollection methodsFor:'converting'! |
395 | 340 |
|
341 |
asStringWithNativeLineEndings |
|
342 |
||
343 |
^self asString |
|
344 |
||
345 |
"Created: / 12-09-2010 / 15:58:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
346 |
! ! |
|
347 |
||
429 | 348 |
!StringCollection methodsFor:'converting'! |
395 | 349 |
|
350 |
asStringWithSqueakLineEndings |
|
351 |
||
352 |
^ self |
|
353 |
asStringWith:Character return |
|
354 |
from:1 to:(self size) |
|
355 |
compressTabs:false |
|
356 |
final:nil |
|
357 |
||
358 |
"Created: / 12-09-2010 / 15:58:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
359 |
! ! |
|
360 |
||
429 | 361 |
!Symbol methodsFor:'*monticello-squeakCompatibility'! |
395 | 362 |
|
363 |
isDoIt |
|
364 |
^ (self == #DoIt) or:[ self == #DoItIn: ]. |
|
365 |
||
366 |
"Created: / 26-08-2009 / 11:46:44 / Jaroslav Havlin <havlij6@fel.cvut.cz>" |
|
367 |
! ! |
|
368 |
||
429 | 369 |
!Timestamp class methodsFor:'*monticello-instance creation'! |
395 | 370 |
|
371 |
fromMethodTimeStamp: aString |
|
372 |
| stream | |
|
373 |
stream := ReadStream on: aString. |
|
374 |
stream skipSeparators. |
|
375 |
stream skipTo: Character space. |
|
376 |
^self readFrom: stream. |
|
377 |
! ! |
|
378 |
||
429 | 379 |
!Tools::NewSystemBrowser methodsFor:'menu actions-monticello'! |
395 | 380 |
|
381 |
projectMenuMonticelloCommit |
|
736
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
382 |
| packageName package workingCopy | |
395 | 383 |
|
384 |
packageName := self theSingleSelectedProject. |
|
736
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
385 |
packageName isNil ifTrue:[ |
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
386 |
Dialog information:'Please select a single project'. |
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
387 |
^ self. |
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
388 |
]. |
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
389 |
|
943 | 390 |
self withWaitCursorDo:[ |
391 |
SourceCodeManagerUtilities basicNew |
|
392 |
validateConsistencyOfPackage:packageName |
|
393 |
doClasses:true |
|
394 |
doExtensions:true. |
|
786
8c0dffd42eb8
class: Tools::NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
395 |
|
943 | 396 |
package := MCPackage named: packageName. |
397 |
workingCopy := package workingCopy. |
|
398 |
MCCommitDialog new |
|
399 |
workingCopy: workingCopy; |
|
400 |
open |
|
401 |
]. |
|
395 | 402 |
|
403 |
"Created: / 14-09-2010 / 22:54:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
404 |
! ! |
|
405 |
||
736
43645227af41
care for nil superclass in Class >> asClassDefinition
Claus Gittinger <cg@exept.de>
parents:
732
diff
changeset
|
406 |
!UndefinedObject methodsFor:'* monticello'! |
150 | 407 |
|
408 |
typeOfClass |
|
409 |
"Necessary to support disjoint class hierarchies." |
|
410 |
||
411 |
^#normal |
|
412 |
! ! |
|
413 |
||
554 | 414 |
!UserPreferences methodsFor:'accessing-scm-monticello'! |
395 | 415 |
|
416 |
mcEnabled |
|
554 | 417 |
"/ needed for MCSettingsApp |
395 | 418 |
|
419 |
^self at: #mcEnabled ifAbsent: [true]. |
|
420 |
||
421 |
"Created: / 16-09-2010 / 09:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
422 |
"Modified: / 16-09-2010 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
554 | 423 |
"Modified (comment): / 15-01-2012 / 14:12:53 / cg" |
395 | 424 |
! ! |
425 |
||
554 | 426 |
!UserPreferences methodsFor:'accessing-scm-monticello'! |
395 | 427 |
|
428 |
mcEnabled: aBoolean |
|
554 | 429 |
"/ needed for MCSettingsApp |
395 | 430 |
|
431 |
self at: #mcEnabled put: aBoolean. |
|
432 |
||
433 |
"Created: / 16-09-2010 / 09:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
571 | 434 |
"Modified: / 27-08-2012 / 11:54:43 / cg" |
395 | 435 |
! ! |
436 |
||
554 | 437 |
!UserPreferences methodsFor:'accessing-scm-monticello'! |
395 | 438 |
|
439 |
mcRepositories |
|
562
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
440 |
"Returns a list of MCRepository as in LITERAL ARRAY ENCODING" |
395 | 441 |
|
562
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
442 |
^self at: #mcRepositories ifAbsent:[#(Array)]. |
395 | 443 |
|
444 |
" |
|
562
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
445 |
UserPreferences current mcRepositories |
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
446 |
UserPreferences current mcRepositories: #(Array) |
395 | 447 |
" |
448 |
||
449 |
"Created: / 16-09-2010 / 09:47:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
562
d48401867000
Fixes in preferences reading/storing
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
554
diff
changeset
|
450 |
"Modified (comment): / 04-04-2012 / 11:08:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
395 | 451 |
! ! |
452 |
||
571 | 453 |
!UserPreferences methodsFor:'accessing-scm-monticello'! |
454 |
||
455 |
mcRepositories: aCollection |
|
456 |
"/ needed for MCSettingsApp |
|
457 |
||
458 |
self at: #mcRepositories put: aCollection. |
|
459 |
||
460 |
"Created: / 27-08-2012 / 11:54:34 / cg" |
|
461 |
! ! |
|
462 |
||
429 | 463 |
!VersionInfo methodsFor:'accessing'! |
395 | 464 |
|
465 |
timeStamp |
|
466 |
||
467 |
^Timestamp |
|
468 |
fromDate: (Date fromString: date) |
|
469 |
andTime: (Time fromString: time) |
|
470 |
||
471 |
"Created: / 09-09-2010 / 15:20:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
472 |
! ! |
|
473 |
||
429 | 474 |
!stx_goodies_monticello class methodsFor:'documentation'! |
182 | 475 |
|
476 |
extensionsVersion_CVS |
|
975 | 477 |
^ '$Header: /cvs/stx/stx/goodies/monticello/extensions.st,v 1.27 2015-02-25 00:14:48 cg Exp $' |
786
8c0dffd42eb8
class: Tools::NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
478 |
! ! |
883
3b1947942911
Added ProjectDefinition>>monticelloNameForMCZ
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
878
diff
changeset
|
479 |