1
|
1 |
"{ Package: 'stx:goodies/metacello' }"
|
|
2 |
|
|
3 |
MetacelloSpec subclass:#MetacelloVersionSpec
|
|
4 |
instanceVariableNames:'versionString blessing description author timestamp preLoadDoIt
|
8
|
5 |
postLoadDoIt packages'
|
1
|
6 |
classVariableNames:''
|
|
7 |
poolDictionaries:''
|
|
8 |
category:'Metacello-Core-Specs'
|
|
9 |
!
|
|
10 |
|
|
11 |
|
|
12 |
!MetacelloVersionSpec methodsFor:'accessing'!
|
|
13 |
|
|
14 |
author
|
|
15 |
|
|
16 |
author == nil
|
|
17 |
ifTrue: [
|
|
18 |
^self project valueHolderSpec
|
|
19 |
value: '';
|
|
20 |
yourself].
|
|
21 |
^ author
|
|
22 |
!
|
|
23 |
|
|
24 |
author: anObject
|
|
25 |
|
|
26 |
anObject setAuthorInMetacelloVersion: self
|
|
27 |
!
|
|
28 |
|
|
29 |
blessing
|
|
30 |
|
|
31 |
blessing == nil
|
|
32 |
ifTrue: [
|
|
33 |
^self project valueHolderSpec
|
|
34 |
value: self project defaultBlessing;
|
|
35 |
yourself].
|
|
36 |
^ blessing
|
|
37 |
!
|
|
38 |
|
|
39 |
blessing: anObject
|
|
40 |
|
|
41 |
anObject setBlessingInMetacelloVersion: self
|
|
42 |
!
|
|
43 |
|
|
44 |
description
|
|
45 |
|
|
46 |
description == nil
|
|
47 |
ifTrue: [
|
|
48 |
^self project valueHolderSpec
|
|
49 |
value: '';
|
|
50 |
yourself].
|
|
51 |
^ description
|
|
52 |
!
|
|
53 |
|
|
54 |
description: anObject
|
|
55 |
|
|
56 |
anObject setDescriptionInMetacelloVersion: self
|
|
57 |
!
|
|
58 |
|
|
59 |
getAuthor
|
|
60 |
^author
|
|
61 |
!
|
|
62 |
|
|
63 |
getBlessing
|
|
64 |
^blessing
|
|
65 |
!
|
|
66 |
|
|
67 |
getDescription
|
|
68 |
^description
|
|
69 |
!
|
|
70 |
|
|
71 |
getPostLoadDoIt
|
|
72 |
^postLoadDoIt
|
|
73 |
!
|
|
74 |
|
|
75 |
getPreLoadDoIt
|
|
76 |
^preLoadDoIt
|
|
77 |
!
|
|
78 |
|
|
79 |
getTimestamp
|
|
80 |
^timestamp
|
|
81 |
!
|
|
82 |
|
8
|
83 |
packages
|
|
84 |
|
|
85 |
packages == nil ifTrue: [ packages := self project packagesSpec ].
|
|
86 |
^ packages
|
|
87 |
!
|
|
88 |
|
|
89 |
packages:something
|
|
90 |
packages := something.
|
|
91 |
!
|
|
92 |
|
1
|
93 |
postLoadDoIt: anObject
|
|
94 |
|
|
95 |
anObject setPostLoadDoItInMetacelloSpec: self
|
|
96 |
!
|
|
97 |
|
|
98 |
preLoadDoIt: anObject
|
|
99 |
|
|
100 |
anObject setPreLoadDoItInMetacelloSpec: self
|
|
101 |
!
|
|
102 |
|
|
103 |
projectLabel
|
|
104 |
|
|
105 |
^self project label
|
|
106 |
!
|
|
107 |
|
|
108 |
setAuthor: anObject
|
|
109 |
author := anObject
|
|
110 |
!
|
|
111 |
|
|
112 |
setBlessing: anObject
|
|
113 |
blessing := anObject
|
|
114 |
!
|
|
115 |
|
|
116 |
setDescription: anObject
|
|
117 |
description := anObject
|
|
118 |
!
|
|
119 |
|
|
120 |
setPostLoadDoIt: aSymbol
|
|
121 |
|
|
122 |
postLoadDoIt := aSymbol
|
|
123 |
!
|
|
124 |
|
|
125 |
setPreLoadDoIt: aSymbol
|
|
126 |
|
|
127 |
preLoadDoIt := aSymbol
|
|
128 |
!
|
|
129 |
|
|
130 |
setTimestamp: anObject
|
|
131 |
timestamp := anObject
|
|
132 |
!
|
|
133 |
|
|
134 |
timestamp
|
|
135 |
|
|
136 |
timestamp == nil
|
|
137 |
ifTrue: [
|
|
138 |
^self project valueHolderSpec
|
|
139 |
value: '';
|
|
140 |
yourself].
|
|
141 |
^ timestamp
|
|
142 |
!
|
|
143 |
|
|
144 |
timestamp: anObject
|
|
145 |
|
|
146 |
anObject setTimestampInMetacelloVersion: self
|
|
147 |
!
|
|
148 |
|
|
149 |
versionString: anObject
|
|
150 |
versionString := anObject
|
|
151 |
! !
|
|
152 |
|
|
153 |
!MetacelloVersionSpec methodsFor:'construction'!
|
|
154 |
|
|
155 |
author: aBlockOrString constructor: aVersionConstructor
|
|
156 |
aVersionConstructor authorForVersion: aBlockOrString
|
|
157 |
!
|
|
158 |
|
|
159 |
blessing: aBlockOrString constructor: aVersionConstructor
|
|
160 |
aVersionConstructor blessingForVersion: aBlockOrString
|
|
161 |
!
|
|
162 |
|
|
163 |
description: aBlockOrString constructor: aVersionConstructor
|
|
164 |
aVersionConstructor descriptionForVersion: aBlockOrString
|
|
165 |
!
|
|
166 |
|
8
|
167 |
package: aString constructor: aVersionConstructor
|
|
168 |
aVersionConstructor packageForVersion: aString
|
|
169 |
|
|
170 |
"Created: / 05-09-2012 / 19:17:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
171 |
!
|
|
172 |
|
1
|
173 |
postLoadDoIt: aSymbol constructor: aVersionConstructor
|
|
174 |
aVersionConstructor postLoadDoItForVersion: aSymbol
|
|
175 |
!
|
|
176 |
|
|
177 |
preLoadDoIt: aSymbol constructor: aVersionConstructor
|
|
178 |
aVersionConstructor preLoadDoItForVersion: aSymbol
|
|
179 |
!
|
|
180 |
|
|
181 |
repositories: aBlock constructor: aVersionConstructor
|
|
182 |
aVersionConstructor repositoriesForVersion: aBlock
|
|
183 |
!
|
|
184 |
|
|
185 |
repository: anObject constructor: aVersionConstructor
|
|
186 |
aVersionConstructor repositoryForVersion: anObject
|
|
187 |
!
|
|
188 |
|
|
189 |
repository: aString username: username password: password constructor: aVersionConstructor
|
|
190 |
aVersionConstructor repositoryForVersion: aString username: username password: password
|
|
191 |
!
|
|
192 |
|
|
193 |
timestamp: aBlockOrStringOrDateAndTime constructor: aVersionConstructor
|
|
194 |
aVersionConstructor timestampForVersion: aBlockOrStringOrDateAndTime
|
|
195 |
! !
|
|
196 |
|
|
197 |
!MetacelloVersionSpec methodsFor:'copying'!
|
|
198 |
|
|
199 |
postCopy
|
|
200 |
|
|
201 |
super postCopy.
|
|
202 |
blessing := blessing copy.
|
|
203 |
description := description copy.
|
|
204 |
author := author copy.
|
|
205 |
timestamp := timestamp copy.
|
|
206 |
|
|
207 |
! !
|
|
208 |
|
|
209 |
!MetacelloVersionSpec methodsFor:'merging'!
|
|
210 |
|
|
211 |
mergeMap
|
|
212 |
|
|
213 |
| map |
|
|
214 |
map := super mergeMap.
|
|
215 |
map at: #versionString put: versionString.
|
|
216 |
map at: #blessing put: blessing.
|
|
217 |
map at: #description put: description.
|
|
218 |
map at: #author put: author.
|
|
219 |
map at: #timestamp put: timestamp.
|
|
220 |
map at: #preLoadDoIt put: preLoadDoIt.
|
|
221 |
map at: #postLoadDoIt put: postLoadDoIt.
|
|
222 |
^map
|
|
223 |
! !
|
|
224 |
|
|
225 |
!MetacelloVersionSpec methodsFor:'printing'!
|
|
226 |
|
|
227 |
configMethodOn: aStream for: spec selector: selector last: last indent: indent
|
|
228 |
spec == nil
|
|
229 |
ifTrue: [ ^ self ].
|
|
230 |
aStream
|
|
231 |
tab: indent;
|
|
232 |
nextPutAll: 'spec ' , selector , ' [';
|
|
233 |
cr.
|
|
234 |
spec configMethodOn: aStream indent: indent + 1.
|
|
235 |
aStream nextPutAll: ' ].'.
|
|
236 |
last
|
|
237 |
ifFalse: [ aStream cr ]
|
|
238 |
!
|
|
239 |
|
|
240 |
configMethodOn: aStream indent: indent
|
|
241 |
|
|
242 |
self configMethodOn: aStream last: true indent: indent
|
|
243 |
!
|
|
244 |
|
|
245 |
configMethodOn: aStream last: last indent: indent
|
|
246 |
| values lastIndex lastBlock |
|
|
247 |
last
|
|
248 |
ifTrue: [
|
|
249 |
"need to calculate last statement with a value"
|
|
250 |
values := {(self getBlessing).
|
|
251 |
(self getDescription).
|
|
252 |
(self getPreLoadDoIt).
|
|
253 |
(self getPostLoadDoIt).
|
|
254 |
(self getAuthor).
|
|
255 |
(self getTimestamp)}.
|
|
256 |
1 to: values size do: [ :index |
|
|
257 |
(values at: index) ~~ nil
|
|
258 |
ifTrue: [ lastIndex := index ] ].
|
|
259 |
lastBlock := [ :arg | arg = lastIndex ] ]
|
|
260 |
ifFalse: [ lastBlock := [ :arg | false ] ].
|
|
261 |
self
|
|
262 |
configMethodValueOn: aStream
|
|
263 |
for: self getBlessing
|
|
264 |
selector: 'blessing:'
|
|
265 |
last: (lastBlock value: 1)
|
|
266 |
indent: indent.
|
|
267 |
self
|
|
268 |
configMethodValueOn: aStream
|
|
269 |
for: self getDescription
|
|
270 |
selector: 'description:'
|
|
271 |
last: (lastBlock value: 2)
|
|
272 |
indent: indent.
|
|
273 |
self
|
|
274 |
configMethodValueOn: aStream
|
|
275 |
for: self getPreLoadDoIt
|
|
276 |
selector: 'preLoadDoIt:'
|
|
277 |
last: (lastBlock value: 3)
|
|
278 |
indent: indent.
|
|
279 |
self
|
|
280 |
configMethodValueOn: aStream
|
|
281 |
for: self getPostLoadDoIt
|
|
282 |
selector: 'postLoadDoIt:'
|
|
283 |
last: (lastBlock value: 4)
|
|
284 |
indent: indent.
|
|
285 |
self
|
|
286 |
configMethodValueOn: aStream
|
|
287 |
for: self getAuthor
|
|
288 |
selector: 'author:'
|
|
289 |
last: (lastBlock value: 5)
|
|
290 |
indent: indent.
|
|
291 |
self
|
|
292 |
configMethodValueOn: aStream
|
|
293 |
for: self getTimestamp
|
|
294 |
selector: 'timestamp:'
|
|
295 |
last: (lastBlock value: 6)
|
|
296 |
indent: indent
|
|
297 |
!
|
|
298 |
|
|
299 |
configMethodValueOn: aStream for: spec selector: selector last: last indent: indent
|
|
300 |
| valuePrintString |
|
|
301 |
spec == nil
|
|
302 |
ifTrue: [ ^ self ].
|
|
303 |
valuePrintString := spec value isSymbol
|
|
304 |
ifTrue: [ '#' , spec value asString printString ]
|
|
305 |
ifFalse: [ spec value printString ].
|
|
306 |
aStream
|
|
307 |
tab: indent;
|
|
308 |
nextPutAll: 'spec ' , selector , ' ' , valuePrintString , '.'.
|
|
309 |
last
|
|
310 |
ifFalse: [ aStream cr ]
|
|
311 |
!
|
|
312 |
|
|
313 |
configSpawnMethodOn: aStream indent: indent
|
|
314 |
|
|
315 |
self configMethodValueOn: aStream for: self getBlessing selector: 'blessing:' last: false indent: indent.
|
|
316 |
self configMethodValueOn: aStream for: self getAuthor selector: 'author:' last: false indent: indent.
|
|
317 |
self configMethodValueOn: aStream for: self getTimestamp selector: 'timestamp:' last: false indent: indent.
|
|
318 |
|
|
319 |
!
|
|
320 |
|
|
321 |
label
|
|
322 |
|
|
323 |
^self versionString, ' [', self projectLabel, ']'
|
|
324 |
! !
|
|
325 |
|
|
326 |
!MetacelloVersionSpec methodsFor:'private'!
|
|
327 |
|
|
328 |
createVersion
|
|
329 |
|
|
330 |
^self versionClass fromSpec: self
|
|
331 |
!
|
|
332 |
|
|
333 |
versionClass
|
|
334 |
|
|
335 |
^MetacelloVersion
|
|
336 |
!
|
|
337 |
|
|
338 |
versionNumber
|
|
339 |
^ self project versionNumberClass fromString: self versionString
|
|
340 |
! !
|
|
341 |
|
|
342 |
!MetacelloVersionSpec methodsFor:'querying'!
|
|
343 |
|
|
344 |
postLoadDoIt
|
|
345 |
|
|
346 |
^postLoadDoIt
|
|
347 |
!
|
|
348 |
|
|
349 |
preLoadDoIt
|
|
350 |
|
|
351 |
^preLoadDoIt
|
|
352 |
!
|
|
353 |
|
|
354 |
versionString
|
|
355 |
versionString == nil ifTrue: [ ^'' ].
|
|
356 |
^ versionString
|
|
357 |
! !
|
|
358 |
|
|
359 |
!MetacelloVersionSpec methodsFor:'testing'!
|
|
360 |
|
|
361 |
isPartiallyCurrent: notLoadedMatters useEquality: useEquality
|
|
362 |
|
|
363 |
self subclassResponsibility
|
|
364 |
!
|
|
365 |
|
|
366 |
isPossibleBaseline
|
|
367 |
self subclassResponsibility
|
|
368 |
! !
|
|
369 |
|
|
370 |
!MetacelloVersionSpec class methodsFor:'documentation'!
|
|
371 |
|
|
372 |
version_SVN
|
|
373 |
^ '$Id:: $'
|
|
374 |
! !
|