9
|
1 |
"{ Package: 'stx:goodies/metacello/stx' }"
|
|
2 |
|
|
3 |
MetacelloAbstractPackageSpec subclass:#MetacelloStXPackageSpec
|
|
4 |
instanceVariableNames:'file repositories goferPackage preLoadDoIt postLoadDoIt'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Metacello-St/X-Specs'
|
|
8 |
!
|
|
9 |
|
|
10 |
Collection subclass:#Prerequisites
|
|
11 |
instanceVariableNames:'packageSpec suppressions additions'
|
|
12 |
classVariableNames:''
|
|
13 |
poolDictionaries:''
|
|
14 |
privateIn:MetacelloStXPackageSpec
|
|
15 |
!
|
|
16 |
|
|
17 |
|
|
18 |
!MetacelloStXPackageSpec methodsFor:'accessing'!
|
|
19 |
|
|
20 |
file: aString
|
|
21 |
|
|
22 |
file := aString
|
|
23 |
!
|
|
24 |
|
|
25 |
getFile
|
|
26 |
"raw access to iv"
|
|
27 |
|
|
28 |
^file
|
|
29 |
!
|
|
30 |
|
|
31 |
getName
|
|
32 |
"raw access to iv"
|
|
33 |
|
|
34 |
^ name
|
|
35 |
!
|
|
36 |
|
|
37 |
getRepositories
|
|
38 |
"raw access to iv"
|
|
39 |
|
|
40 |
^ repositories
|
|
41 |
!
|
|
42 |
|
|
43 |
goferLoaderReference
|
|
44 |
|
|
45 |
^file == nil
|
|
46 |
ifTrue: [ GoferPackageReference name: self name ]
|
|
47 |
ifFalse: [
|
|
48 |
"does Monticello-style #versionInfoFromVersionNamed: matching"
|
|
49 |
MetacelloGoferPackage name: self name packageFilename: self file ]
|
|
50 |
!
|
|
51 |
|
|
52 |
goferPackage
|
|
53 |
|
|
54 |
goferPackage == nil
|
|
55 |
ifTrue: [ goferPackage := MetacelloGoferPackage name: self name packageFilename: self file ].
|
|
56 |
^goferPackage
|
|
57 |
!
|
|
58 |
|
|
59 |
info
|
|
60 |
"test compatibility method"
|
|
61 |
|
|
62 |
^self
|
|
63 |
!
|
|
64 |
|
|
65 |
preLoadDoIt: anObject
|
|
66 |
|
|
67 |
anObject setPreLoadDoItInMetacelloSpec: self
|
|
68 |
!
|
|
69 |
|
|
70 |
repository: aStringOrMetacelloRepositorySpec
|
|
71 |
|
|
72 |
self repositories repository: aStringOrMetacelloRepositorySpec
|
|
73 |
!
|
|
74 |
|
|
75 |
repository: aString username: username password: password
|
|
76 |
|
|
77 |
self repositories repository: aString username: username password: password
|
|
78 |
!
|
|
79 |
|
|
80 |
setPostLoadDoIt: aSymbol
|
|
81 |
|
|
82 |
postLoadDoIt := aSymbol
|
|
83 |
!
|
|
84 |
|
|
85 |
setPreLoadDoIt: aSymbol
|
|
86 |
|
|
87 |
preLoadDoIt := aSymbol
|
|
88 |
! !
|
|
89 |
|
|
90 |
!MetacelloStXPackageSpec methodsFor:'construction'!
|
|
91 |
|
|
92 |
file: aString constructor: aVersionConstructor
|
|
93 |
aVersionConstructor fileForPackage: aString
|
|
94 |
!
|
|
95 |
|
|
96 |
includes: anObject constructor: aVersionConstructor
|
|
97 |
aVersionConstructor includesForPackage: anObject
|
|
98 |
!
|
|
99 |
|
|
100 |
postLoadDoIt: aSymbol constructor: aVersionConstructor
|
|
101 |
aVersionConstructor postLoadDoItForPackage: aSymbol
|
|
102 |
!
|
|
103 |
|
|
104 |
preLoadDoIt: aSymbol constructor: aVersionConstructor
|
|
105 |
aVersionConstructor preLoadDoItForPackage: aSymbol
|
|
106 |
!
|
|
107 |
|
|
108 |
repositories: aBlock constructor: aVersionConstructor
|
|
109 |
aVersionConstructor repositoriesForPackage: aBlock
|
|
110 |
!
|
|
111 |
|
|
112 |
repository: anObject constructor: aVersionConstructor
|
|
113 |
aVersionConstructor repositoryForPackage: anObject
|
|
114 |
!
|
|
115 |
|
|
116 |
repository: aString username: username password: password constructor: aVersionConstructor
|
|
117 |
aVersionConstructor repositoryForPackage: aString username: username password: password
|
|
118 |
!
|
|
119 |
|
|
120 |
requires: anObject constructor: aVersionConstructor
|
|
121 |
aVersionConstructor requiresForPackage: anObject
|
|
122 |
!
|
|
123 |
|
|
124 |
supplyingAnswers: anObject constructor: aVersionConstructor
|
|
125 |
aVersionConstructor supplyingAnswersForPackage: anObject
|
|
126 |
! !
|
|
127 |
|
|
128 |
!MetacelloStXPackageSpec methodsFor:'copying'!
|
|
129 |
|
|
130 |
postCopy
|
|
131 |
|
|
132 |
super postCopy.
|
|
133 |
goferPackage := nil.
|
|
134 |
repositories := repositories copy.
|
|
135 |
! !
|
|
136 |
|
|
137 |
!MetacelloStXPackageSpec methodsFor:'development support'!
|
|
138 |
|
|
139 |
copySpecTo: aRepositorySpec
|
|
140 |
"Copy current mcz file to the repository named in aRepositorySpec"
|
|
141 |
|
|
142 |
self loader copySpec: self from: self repositorySpecs to: aRepositorySpec createRepository
|
|
143 |
!
|
|
144 |
|
|
145 |
forceUpdatePackageSpec: updatedSpecs using: anMCLoader
|
|
146 |
|
|
147 |
self updatePackageSpec: updatedSpecs force: true using: anMCLoader
|
|
148 |
!
|
|
149 |
|
|
150 |
goferBranchPackage: branchName message: commitMessage
|
|
151 |
"uses gofer to do commit ... non-interactive"
|
|
152 |
|
|
153 |
| latestFile pkgSpec |
|
|
154 |
(file notNil and: [ (self name, '.', branchName) = self file ])
|
|
155 |
ifTrue: [
|
|
156 |
latestFile := self loader latestPackage: self file fromRepository: self repositorySpecs.
|
|
157 |
pkgSpec := self copy.
|
|
158 |
latestFile ~~ nil
|
|
159 |
ifTrue: [
|
|
160 |
pkgSpec file: latestFile.
|
|
161 |
pkgSpec goferCommitPackage: commitMessage.
|
|
162 |
^ self ] ].
|
|
163 |
self loader goferCommitBranchPackage: branchName using: self repositorySpecs commitMessage: commitMessage
|
|
164 |
!
|
|
165 |
|
|
166 |
goferCommitPackage: commitMessage
|
|
167 |
"uses gofer to do commit ... non-interactive"
|
|
168 |
|
|
169 |
| latestFile pkgSpec |
|
|
170 |
^(file notNil and: [ self name = self file ])
|
|
171 |
ifTrue: [
|
|
172 |
latestFile := self loader latestPackage: self name fromRepository: self repositorySpecs.
|
|
173 |
pkgSpec := self copy.
|
|
174 |
pkgSpec file: latestFile.
|
|
175 |
pkgSpec goferCommitPackage: commitMessage ]
|
|
176 |
ifFalse: [ self loader goferCommitPackageUsing: self repositorySpecs commitMessage: commitMessage ]
|
|
177 |
!
|
|
178 |
|
|
179 |
packagesNeedSavingVisited: visitedProjects using: repos into: aCollection
|
|
180 |
|
|
181 |
^self loader packagesNeedSavingUsing: repos into: aCollection
|
|
182 |
!
|
|
183 |
|
|
184 |
savePackage
|
|
185 |
"Interactive save ... prompted for commit message and package name unless MCVersionNameAndMessageRequest handled"
|
|
186 |
|
|
187 |
| latestFile pkgSpec |
|
|
188 |
^(file notNil and: [ self name = self file ])
|
|
189 |
ifTrue: [
|
|
190 |
latestFile := self loader latestPackage: self name fromRepository: self repositorySpecs.
|
|
191 |
pkgSpec := self copy.
|
|
192 |
pkgSpec file: latestFile.
|
|
193 |
pkgSpec savePackage ]
|
|
194 |
ifFalse: [ self loader savePackageUsing: self repositorySpecs ]
|
|
195 |
!
|
|
196 |
|
|
197 |
updateForSpawnMethod: sourceSpec
|
|
198 |
"This means that this spec was used in a baseline and will be used in a version .... drop all information that isn't useful"
|
|
199 |
|
|
200 |
| nm fl |
|
|
201 |
nm := name.
|
|
202 |
fl := file.
|
|
203 |
sourceSpec ~~ nil ifTrue: [ fl := sourceSpec file ].
|
|
204 |
super updateForSpawnMethod: sourceSpec.
|
|
205 |
file := repositories := goferPackage := preLoadDoIt := postLoadDoIt := nil.
|
|
206 |
name := nm.
|
|
207 |
file := fl.
|
|
208 |
!
|
|
209 |
|
|
210 |
updatePackageRepositories: repositorySpecs
|
|
211 |
|
|
212 |
| resolvedPackageRef |
|
|
213 |
Transcript cr; show: ' Looking up version -> ', self file.
|
|
214 |
resolvedPackageRef := self loader resolveSpec: self from: repositorySpecs.
|
|
215 |
Transcript cr; show: 'Update repositoryGroup -> ', resolvedPackageRef name, ' ' , resolvedPackageRef repository description.
|
|
216 |
resolvedPackageRef version workingCopy repositoryGroup addRepository: resolvedPackageRef repository
|
|
217 |
!
|
|
218 |
|
|
219 |
updatePackageRepositoriesFor: aVersionSpec
|
|
220 |
"Don't update the repository unless the package is loaded in the image"
|
|
221 |
|
|
222 |
self workingCopy == nil ifTrue: [ ^self ].
|
|
223 |
self updatePackageRepositories: self repositorySpecs, aVersionSpec repositorySpecs.
|
|
224 |
!
|
|
225 |
|
|
226 |
updatePackageSpec: updatedSpecs force: force using: anMCLoader
|
|
227 |
"Add pkg copy to updatedSpecs if the file in current image is different from the receiver's file"
|
|
228 |
|
|
229 |
| viName |
|
|
230 |
(force not and: [ self getFile == nil ])
|
|
231 |
ifTrue: [ ^ self ]. "no file explicitly specified in this spec"
|
|
232 |
(viName := self workingCopyNameFor: anMCLoader) == nil
|
|
233 |
ifTrue: [ ^ self ]. "no working copy"
|
|
234 |
viName ~= self file
|
|
235 |
ifTrue: [
|
|
236 |
| spec |
|
|
237 |
spec := self copy.
|
|
238 |
spec file: viName.
|
|
239 |
updatedSpecs at: spec name put: spec ]
|
|
240 |
ifFalse: [ updatedSpecs at: self name put: #uptodate ]
|
|
241 |
!
|
|
242 |
|
|
243 |
updatePackageSpec: updatedSpecs using: anMCLoader
|
|
244 |
"Add pkg copy to updatedSpecs if the file in current image is different from the receiver's file"
|
|
245 |
|
|
246 |
self updatePackageSpec: updatedSpecs force: false using: anMCLoader
|
|
247 |
! !
|
|
248 |
|
|
249 |
!MetacelloStXPackageSpec methodsFor:'loading'!
|
|
250 |
|
|
251 |
ensureLoadUsing: mcLoader
|
|
252 |
self explicitLoadUsing: mcLoader ensureSpecLoader
|
|
253 |
!
|
|
254 |
|
|
255 |
ensureLoadedForDevelopmentUsing: mcLoader
|
|
256 |
"noop"
|
|
257 |
|
|
258 |
^true
|
|
259 |
!
|
|
260 |
|
|
261 |
explicitLoadUsing: mcLoader
|
|
262 |
|
|
263 |
| wc fetchingSpecLoader |
|
|
264 |
((wc := self workingCopy) ~~ nil and: [ wc needsSaving ])
|
|
265 |
ifTrue: [
|
|
266 |
(MetacelloSkipDirtyPackageLoad signal: self)
|
|
267 |
ifTrue: [
|
|
268 |
Transcript cr; show: 'Skipping load of modified package: ', self file.
|
|
269 |
^self]
|
|
270 |
ifFalse: [Transcript cr; show: 'Load over modified package: ', self file] ].
|
|
271 |
"fetch and explicitly load it"
|
|
272 |
fetchingSpecLoader := mcLoader fetchingSpecLoader.
|
|
273 |
fetchingSpecLoader
|
|
274 |
explicitLoadPackageSpecs: (Array with: self)
|
|
275 |
repositories: (fetchingSpecLoader repositoriesFrom: self repositorySpecs).
|
|
276 |
!
|
|
277 |
|
|
278 |
fetch
|
|
279 |
|
|
280 |
self fetchUsing: self loader
|
|
281 |
!
|
|
282 |
|
|
283 |
fetchPackage: aLoaderPolicy
|
|
284 |
|
|
285 |
self fetchUsing:
|
|
286 |
(self loader
|
|
287 |
loaderPolicy: aLoaderPolicy;
|
|
288 |
yourself)
|
|
289 |
!
|
|
290 |
|
|
291 |
fetchUsing: mcLoader
|
|
292 |
|
|
293 |
| fetchingSpecLoader |
|
|
294 |
fetchingSpecLoader := mcLoader fetchingSpecLoader.
|
|
295 |
fetchingSpecLoader
|
|
296 |
linearLoadPackageSpecs: (Array with: self)
|
|
297 |
repositories: (fetchingSpecLoader repositoriesFrom: self repositorySpecs).
|
|
298 |
!
|
|
299 |
|
|
300 |
load
|
|
301 |
|
|
302 |
self explicitLoadUsing: self loader
|
|
303 |
!
|
|
304 |
|
|
305 |
loadUsing: mcLoader
|
|
306 |
|
|
307 |
self loader doingLoads: [ self explicitLoadUsing: mcLoader ]
|
|
308 |
!
|
|
309 |
|
|
310 |
loadUsing: aLoader gofer: gofer
|
|
311 |
|
|
312 |
^aLoader linearLoadPackageSpec: self gofer: gofer
|
|
313 |
!
|
|
314 |
|
|
315 |
packageSpecsInLoadOrder
|
|
316 |
|
|
317 |
^{ self. }
|
|
318 |
!
|
|
319 |
|
|
320 |
postLoadDoIt: anObject
|
|
321 |
|
|
322 |
anObject setPostLoadDoItInMetacelloSpec: self
|
|
323 |
!
|
|
324 |
|
|
325 |
repositoryDescriptions
|
|
326 |
^ self repositorySpecs collect: [ :repoSpec | repoSpec description ]
|
|
327 |
!
|
|
328 |
|
|
329 |
repositorySpecs
|
|
330 |
|
|
331 |
^self repositories map values
|
|
332 |
! !
|
|
333 |
|
|
334 |
!MetacelloStXPackageSpec methodsFor:'merging'!
|
|
335 |
|
|
336 |
mergeMap
|
|
337 |
|
|
338 |
| map |
|
|
339 |
map := super mergeMap.
|
|
340 |
map at: #file put: file.
|
|
341 |
map at: #repositories put: self repositories.
|
|
342 |
map at: #preLoadDoIt put: preLoadDoIt.
|
|
343 |
map at: #postLoadDoIt put: postLoadDoIt.
|
|
344 |
^map
|
|
345 |
!
|
|
346 |
|
|
347 |
mergeSpec: anotherSpec
|
|
348 |
|
|
349 |
| newSpec map anotherPackages anotherRepositories |
|
|
350 |
newSpec := super mergeSpec: anotherSpec.
|
|
351 |
map := anotherSpec mergeMap.
|
|
352 |
(anotherRepositories := map at: #repositories) notEmpty
|
|
353 |
ifTrue: [
|
|
354 |
newSpec
|
|
355 |
repositories: (self repositories isEmpty
|
|
356 |
ifTrue: [ anotherRepositories ]
|
|
357 |
ifFalse: [ self repositories mergeSpec: anotherRepositories ]) ].
|
|
358 |
^newSpec
|
|
359 |
!
|
|
360 |
|
|
361 |
nonOverridable
|
|
362 |
|
|
363 |
^super nonOverridable, #( repositories)
|
|
364 |
! !
|
|
365 |
|
|
366 |
!MetacelloStXPackageSpec methodsFor:'printing'!
|
|
367 |
|
|
368 |
configMethodBodyOn: aStream hasName: hasName indent: indent
|
|
369 |
|
|
370 |
| hasFile hasRepositories hasPreLoadDoIt hasPostLoadDoIt hasRequiresOrIncludesOrAnswers |
|
|
371 |
hasFile := file ~~ nil.
|
|
372 |
hasRepositories := self repositorySpecs size > 0.
|
|
373 |
hasPreLoadDoIt := self getPreLoadDoIt ~~ nil.
|
|
374 |
hasPostLoadDoIt := self getPostLoadDoIt ~~ nil.
|
|
375 |
hasRequiresOrIncludesOrAnswers := (self requires isEmpty and: [ self includes isEmpty and: [self answers isEmpty ]]) not.
|
|
376 |
hasRequiresOrIncludesOrAnswers
|
|
377 |
ifTrue: [
|
|
378 |
self
|
|
379 |
configMethodBodyOn: aStream
|
|
380 |
hasName: hasName
|
|
381 |
cascading: hasFile | hasRepositories | hasPreLoadDoIt | hasPostLoadDoIt
|
|
382 |
indent: indent ].
|
|
383 |
self
|
|
384 |
configMethodOn: aStream
|
|
385 |
for: file
|
|
386 |
selector: 'file: '
|
|
387 |
cascading: hasName | hasRepositories | hasPreLoadDoIt | hasPostLoadDoIt | hasRequiresOrIncludesOrAnswers
|
|
388 |
cascade: hasRepositories | hasPreLoadDoIt | hasPostLoadDoIt
|
|
389 |
indent: indent.
|
|
390 |
hasRepositories
|
|
391 |
ifTrue: [
|
|
392 |
(self repositorySpecs size > 1)
|
|
393 |
ifTrue: [
|
|
394 |
hasName | hasFile | hasPreLoadDoIt | hasPostLoadDoIt | hasRequiresOrIncludesOrAnswers
|
|
395 |
ifTrue: [
|
|
396 |
aStream cr;
|
|
397 |
tab: indent. ].
|
|
398 |
aStream
|
|
399 |
nextPutAll: 'repositories: [';
|
|
400 |
cr;
|
|
401 |
tab: indent + 1;
|
|
402 |
nextPutAll: 'spec';
|
|
403 |
cr.
|
|
404 |
self repositories configMethodCascadeOn: aStream indent: indent + 1.
|
|
405 |
aStream nextPutAll: ' ]' ]
|
|
406 |
ifFalse: [
|
|
407 |
hasName | hasFile | hasPreLoadDoIt | hasPostLoadDoIt | hasRequiresOrIncludesOrAnswers
|
|
408 |
ifTrue: [ aStream cr; tab: indent ].
|
|
409 |
self repositories configMethodCascadeOn: aStream indent: indent ].
|
|
410 |
hasPreLoadDoIt | hasPostLoadDoIt ifTrue: [ aStream nextPut: $; ] ].
|
|
411 |
self
|
|
412 |
configMethodOn: aStream
|
|
413 |
for: self getPreLoadDoIt
|
|
414 |
selector: 'preLoadDoIt: '
|
|
415 |
cascading: hasName | hasFile | hasRepositories | hasPostLoadDoIt | hasRequiresOrIncludesOrAnswers
|
|
416 |
cascade: hasPostLoadDoIt
|
|
417 |
indent: indent.
|
|
418 |
self
|
|
419 |
configMethodOn: aStream
|
|
420 |
for: self getPostLoadDoIt
|
|
421 |
selector: 'postLoadDoIt: '
|
|
422 |
cascading: hasName | hasFile | hasRepositories | hasPreLoadDoIt | hasRequiresOrIncludesOrAnswers
|
|
423 |
cascade: false
|
|
424 |
indent: indent.
|
|
425 |
aStream nextPut: $.
|
|
426 |
!
|
|
427 |
|
|
428 |
configMethodCascadeOn: aStream member: aMember last: lastCascade indent: indent
|
|
429 |
|
|
430 |
aMember methodUpdateSelector == #remove:
|
|
431 |
ifTrue: [ aStream nextPutAll: 'removePackage: ', self name printString ]
|
|
432 |
ifFalse: [ self configShortCutMethodBodyOn: aStream member: aMember indent: indent ].
|
|
433 |
lastCascade
|
|
434 |
ifTrue: [ aStream nextPut: $. ]
|
|
435 |
ifFalse: [ aStream nextPut: $;; cr ]
|
|
436 |
!
|
|
437 |
|
|
438 |
configMethodOn: aStream indent: indent
|
|
439 |
|
|
440 |
| hasRepositories hasPreLoadDoIt hasPostLoadDoIt hasRequiresOrIncludesOrAnswers hasFile |
|
|
441 |
hasFile := file ~~ nil.
|
|
442 |
hasRepositories := self repositorySpecs size > 0.
|
|
443 |
hasPreLoadDoIt := self getPreLoadDoIt ~~ nil.
|
|
444 |
hasPostLoadDoIt := self getPostLoadDoIt ~~ nil.
|
|
445 |
hasRequiresOrIncludesOrAnswers := (self requires isEmpty and: [ self includes isEmpty and: [self answers isEmpty ]]) not.
|
|
446 |
aStream tab: indent; nextPutAll: 'spec '.
|
|
447 |
hasFile | hasRepositories | hasPreLoadDoIt | hasPostLoadDoIt | hasRequiresOrIncludesOrAnswers
|
|
448 |
ifTrue: [
|
|
449 |
aStream cr; tab: indent + 1; nextPutAll: 'name: ', self name printString; nextPut: $;.
|
|
450 |
self configMethodBodyOn: aStream hasName: true indent: indent + 1 ]
|
|
451 |
ifFalse: [
|
|
452 |
aStream nextPutAll: 'name: ', self name printString ]
|
|
453 |
!
|
|
454 |
|
|
455 |
configShortCutMethodBodyOn: aStream member: aMember indent: indent
|
|
456 |
|
|
457 |
| hasFile hasRepositories hasPreLoadDoIt hasPostLoadDoIt hasRequiresOrIncludesOrAnswers |
|
|
458 |
hasFile := file ~~ nil.
|
|
459 |
hasRepositories := self repositorySpecs size > 0.
|
|
460 |
hasPreLoadDoIt := self getPreLoadDoIt ~~ nil.
|
|
461 |
hasPostLoadDoIt := self getPostLoadDoIt ~~ nil.
|
|
462 |
hasRequiresOrIncludesOrAnswers := (self requires isEmpty and: [ self includes isEmpty and: [self answers isEmpty ]]) not.
|
|
463 |
hasRepositories | hasPreLoadDoIt | hasPostLoadDoIt | hasRequiresOrIncludesOrAnswers
|
|
464 |
ifTrue: [
|
|
465 |
aStream
|
|
466 |
nextPutAll: 'package: ', self name printString, ' ';
|
|
467 |
nextPutAll: aMember methodUpdateSelector asString, ' ['; cr.
|
|
468 |
aStream tab: indent + 1; nextPutAll: 'spec '.
|
|
469 |
self configMethodBodyOn: aStream hasName: false indent: indent + 2.
|
|
470 |
aStream nextPutAll: ' ]'.
|
|
471 |
^self ].
|
|
472 |
aStream nextPutAll: 'package: ', self name printString.
|
|
473 |
hasFile
|
|
474 |
ifTrue: [ aStream nextPutAll: ' with: ', file printString ]
|
|
475 |
! !
|
|
476 |
|
|
477 |
!MetacelloStXPackageSpec methodsFor:'private'!
|
|
478 |
|
|
479 |
extractNameFromFile
|
|
480 |
|
|
481 |
file == nil ifTrue: [ ^nil ].
|
|
482 |
^(self loader nameComponentsFrom: self file) first
|
|
483 |
!
|
|
484 |
|
|
485 |
includesForPackageOrdering
|
|
486 |
|
|
487 |
^self includes
|
|
488 |
!
|
|
489 |
|
|
490 |
resolveToPackagesIn: aVersionSpec visited: visited
|
|
491 |
|
|
492 |
^{ self }
|
|
493 |
!
|
|
494 |
|
|
495 |
setRequires: aCollection
|
|
496 |
|
|
497 |
self breakPoint: #jv.
|
|
498 |
|
|
499 |
requires := aCollection
|
|
500 |
|
|
501 |
"Created: / 05-09-2012 / 19:47:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
502 |
! !
|
|
503 |
|
|
504 |
!MetacelloStXPackageSpec methodsFor:'querying'!
|
|
505 |
|
|
506 |
file
|
|
507 |
|
|
508 |
file == nil ifTrue: [ ^self name ].
|
|
509 |
^file
|
|
510 |
!
|
|
511 |
|
|
512 |
getPostLoadDoIt
|
|
513 |
|
|
514 |
^postLoadDoIt
|
|
515 |
!
|
|
516 |
|
|
517 |
getPreLoadDoIt
|
|
518 |
|
|
519 |
^preLoadDoIt
|
|
520 |
!
|
|
521 |
|
|
522 |
isPackageLoaded
|
|
523 |
|
|
524 |
^self isPackageLoaded: self loader
|
|
525 |
!
|
|
526 |
|
|
527 |
isPackageLoaded: aLoader
|
|
528 |
|
|
529 |
^(self workingCopyNameFor: aLoader) ~~ nil
|
|
530 |
!
|
|
531 |
|
|
532 |
name
|
|
533 |
|
|
534 |
name == nil ifTrue: [ name := self extractNameFromFile ].
|
|
535 |
^name
|
|
536 |
!
|
|
537 |
|
|
538 |
postLoadDoIt
|
|
539 |
|
|
540 |
^postLoadDoIt
|
|
541 |
!
|
|
542 |
|
|
543 |
preLoadDoIt
|
|
544 |
|
|
545 |
^preLoadDoIt
|
|
546 |
!
|
|
547 |
|
|
548 |
repositories
|
|
549 |
|
|
550 |
repositories == nil ifTrue: [ repositories := self project repositoriesSpec ].
|
|
551 |
^ repositories
|
|
552 |
!
|
|
553 |
|
|
554 |
repositories: anObject
|
|
555 |
repositories := anObject
|
|
556 |
!
|
|
557 |
|
|
558 |
repository
|
|
559 |
self deprecated: 'Use repositories or repositorySpecs'.
|
|
560 |
self repositorySpecs isEmpty
|
|
561 |
ifTrue: [ ^ nil ].
|
|
562 |
^ self repositorySpecs first
|
|
563 |
!
|
|
564 |
|
|
565 |
requires
|
|
566 |
|
|
567 |
requires == nil ifTrue: [
|
|
568 |
requires := Prerequisites for: self.
|
|
569 |
].
|
|
570 |
^requires
|
|
571 |
|
|
572 |
"Created: / 05-09-2012 / 19:47:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
573 |
! !
|
|
574 |
|
|
575 |
!MetacelloStXPackageSpec methodsFor:'testing'!
|
|
576 |
|
|
577 |
compareCurrentVersion: anOperator targetVersionStatus: statusIgnored using: anMCLoader
|
|
578 |
|
|
579 |
self
|
|
580 |
currentPackageLoaded: [:bool | ^bool ]
|
|
581 |
comparing: anOperator
|
|
582 |
notLoaded: [:ignored | ^false ]
|
|
583 |
using: anMCLoader
|
|
584 |
!
|
|
585 |
|
|
586 |
compareRelativeCurrentVersion: anOperator targetVersionStatus: statusIgnored using: anMCLoader
|
|
587 |
|
|
588 |
^self compareCurrentVersion: anOperator targetVersionStatus: statusIgnored using: anMCLoader
|
|
589 |
!
|
|
590 |
|
|
591 |
compareWorkingCopyNamed: wcName using: comarisonOperator
|
|
592 |
| fileRef wcRef |
|
|
593 |
fileRef := GoferResolvedReference name: self file.
|
|
594 |
wcRef := GoferResolvedReference name: wcName.
|
|
595 |
^ wcRef compare: fileRef using: comarisonOperator
|
|
596 |
!
|
|
597 |
|
|
598 |
currentPackageLoaded: loadedBlock comparing: comarisonOperator notLoaded: notLoadedBlock using: anMCLoader
|
|
599 |
"Use currentVersionInfoFor: because it involves the loader and returns versionInfo for a planned load
|
|
600 |
(atomic loaders) or currently loaded package"
|
|
601 |
|
|
602 |
| wcName vis |
|
|
603 |
vis := anMCLoader ancestorsFor: self.
|
|
604 |
vis notNil
|
|
605 |
ifTrue: [
|
|
606 |
| fileRef wcRef |
|
|
607 |
self getFile == nil
|
|
608 |
ifTrue: [ ^ loadedBlock value: false ].
|
|
609 |
vis
|
|
610 |
do: [ :vi |
|
|
611 |
wcName := vi name.
|
|
612 |
fileRef := GoferResolvedReference name: self file.
|
|
613 |
wcRef := GoferResolvedReference name: wcName.
|
|
614 |
(wcRef compare: fileRef using: comarisonOperator)
|
|
615 |
ifTrue: [ ^ loadedBlock value: true ] ].
|
|
616 |
^ loadedBlock value: false ].
|
|
617 |
^ notLoadedBlock value: true
|
|
618 |
!
|
|
619 |
|
|
620 |
currentPackageLoaded: loadedBlock notLoaded: notLoadedBlock using: anMCLoader
|
|
621 |
"Use currentVersionInfoFor: because it involves the loader and returns versionInfo for a planned load
|
|
622 |
(atomic loaders) or currently loaded package"
|
|
623 |
|
|
624 |
| wcName vis |
|
|
625 |
vis := anMCLoader ancestorsFor: self.
|
|
626 |
vis notNil
|
|
627 |
ifTrue: [
|
|
628 |
self getFile == nil
|
|
629 |
ifTrue: [ ^ loadedBlock value: #() value: self file ].
|
|
630 |
^ loadedBlock value: vis value: self file ].
|
|
631 |
^ notLoadedBlock value
|
|
632 |
!
|
|
633 |
|
|
634 |
hasRepository
|
|
635 |
^ self repositorySpecs notEmpty
|
|
636 |
! !
|
|
637 |
|
|
638 |
!MetacelloStXPackageSpec methodsFor:'visiting'!
|
|
639 |
|
|
640 |
projectDo: projectBlock packageDo: packageBlock groupDo: groupBlock
|
|
641 |
|
|
642 |
packageBlock value: self
|
|
643 |
!
|
|
644 |
|
|
645 |
visitingWithPackages: packages
|
|
646 |
|
|
647 |
packages at: self name put: self
|
|
648 |
! !
|
|
649 |
|
|
650 |
!MetacelloStXPackageSpec::Prerequisites class methodsFor:'instance creation'!
|
|
651 |
|
|
652 |
for: spec
|
|
653 |
^self new initializeFor: spec
|
|
654 |
|
|
655 |
"Created: / 05-09-2012 / 19:49:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
656 |
! !
|
|
657 |
|
|
658 |
!MetacelloStXPackageSpec::Prerequisites methodsFor:'adding & removing'!
|
|
659 |
|
|
660 |
add:anObject
|
|
661 |
"add the argument, anObject to the receiver.
|
|
662 |
If the receiver is ordered, the position of the new element is undefined
|
|
663 |
(i.e. don't depend on where it will be put).
|
|
664 |
An error is raised here - it is to be implemented by a concrete subclass."
|
|
665 |
|
|
666 |
^ self shouldImplement
|
|
667 |
!
|
|
668 |
|
|
669 |
addFirst:anObject
|
|
670 |
"add the argument, anObject to the receiver.
|
|
671 |
If the receiver is ordered, the new element will be added at the beginning.
|
|
672 |
An error is raised here - it is to be implemented by a concrete subclass."
|
|
673 |
|
|
674 |
^ self shouldImplement
|
|
675 |
!
|
|
676 |
|
|
677 |
remove:anObject ifAbsent:exceptionBlock
|
|
678 |
"search for the first element, which is equal to anObject;
|
|
679 |
if found, remove and return it.
|
|
680 |
If not found, return the the value of the exceptionBlock.
|
|
681 |
Uses equality compare (=) to search for the occurrence.
|
|
682 |
An error is raised here - it is to be implemented by a concrete subclass."
|
|
683 |
|
|
684 |
^ self shouldImplement
|
|
685 |
!
|
|
686 |
|
|
687 |
removeIdentical:anObject ifAbsent:exceptionBlock
|
|
688 |
"search for the first element, which is identical to anObject;
|
|
689 |
if found, remove and return it.
|
|
690 |
If not found, return the the value of the exceptionBlock.
|
|
691 |
Uses identity compare (==) to search for the occurrence.
|
|
692 |
An error is raised here - it is to be implemented by a concrete subclass."
|
|
693 |
|
|
694 |
^ self shouldImplement
|
|
695 |
!
|
|
696 |
|
|
697 |
removeLast
|
|
698 |
"remove the last element from the receiver.
|
|
699 |
Return the removed element.
|
|
700 |
An error is raised here - it is to be implemented by a concrete subclass."
|
|
701 |
|
|
702 |
^ self shouldImplement
|
|
703 |
! !
|
|
704 |
|
|
705 |
!MetacelloStXPackageSpec::Prerequisites methodsFor:'enumerating'!
|
|
706 |
|
|
707 |
do:aBlock
|
|
708 |
"evaluate the argument, aBlock for each element"
|
|
709 |
|
|
710 |
| def |
|
|
711 |
|
|
712 |
def := ProjectDefinition definitionClassForPackage: packageSpec name.
|
|
713 |
def preRequisites do:[:each|
|
|
714 |
aBlock value: each
|
|
715 |
]
|
|
716 |
|
|
717 |
"Modified: / 05-09-2012 / 19:53:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
718 |
!
|
|
719 |
|
|
720 |
reverseDo:aBlock
|
|
721 |
"evaluate the argument, aBlock for each element in reverse order."
|
|
722 |
|
|
723 |
^ self do: aBlock
|
|
724 |
|
|
725 |
"Modified: / 05-09-2012 / 19:51:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
726 |
! !
|
|
727 |
|
|
728 |
!MetacelloStXPackageSpec::Prerequisites methodsFor:'growing'!
|
|
729 |
|
|
730 |
grow:howBig
|
|
731 |
"change the receivers size"
|
|
732 |
|
|
733 |
^ self shouldImplement
|
|
734 |
! !
|
|
735 |
|
|
736 |
!MetacelloStXPackageSpec::Prerequisites methodsFor:'initialization'!
|
|
737 |
|
|
738 |
initializeFor: aMetacelloStXPackageSpec
|
|
739 |
packageSpec := aMetacelloStXPackageSpec
|
|
740 |
|
|
741 |
"Created: / 05-09-2012 / 19:48:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
742 |
! !
|
|
743 |
|
|
744 |
!MetacelloStXPackageSpec class methodsFor:'documentation'!
|
|
745 |
|
|
746 |
version_SVN
|
|
747 |
^ '$Id:: $'
|
|
748 |
! !
|