79
|
1 |
"{ Package: 'stx:goodies/monticello' }"
|
|
2 |
|
|
3 |
Object subclass:#MCRepositoryGroup
|
|
4 |
instanceVariableNames:'repositories'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Monticello-Versioning'
|
|
8 |
!
|
|
9 |
|
|
10 |
MCRepositoryGroup class instanceVariableNames:'default'
|
|
11 |
|
|
12 |
"
|
|
13 |
No other class instance variables are inherited by this class.
|
|
14 |
"
|
|
15 |
!
|
|
16 |
|
|
17 |
MCRepositoryGroup comment:'A singleton class, holds the list of repositories. Can look for a requested VersionInfo among its repositories.'
|
|
18 |
!
|
|
19 |
|
|
20 |
|
|
21 |
!MCRepositoryGroup class methodsFor:'as yet unclassified'!
|
|
22 |
|
|
23 |
default
|
|
24 |
^ default ifNil: [default _ self new]
|
|
25 |
!
|
|
26 |
|
|
27 |
new
|
|
28 |
^ self basicNew initialize
|
|
29 |
! !
|
|
30 |
|
|
31 |
!MCRepositoryGroup methodsFor:'as yet unclassified'!
|
|
32 |
|
|
33 |
addRepository: aRepository
|
|
34 |
((repositories includes: aRepository) or: [aRepository == MCCacheRepository default])
|
|
35 |
ifFalse: [repositories add: aRepository.
|
|
36 |
self class default addRepository: aRepository].
|
|
37 |
self changed: #repositories
|
|
38 |
!
|
|
39 |
|
|
40 |
includes: aRepository
|
|
41 |
^ self repositories includes: aRepository
|
|
42 |
!
|
|
43 |
|
|
44 |
includesVersionNamed: aString
|
|
45 |
self repositoriesDo: [:ea | (ea includesVersionNamed: aString) ifTrue: [^ true]].
|
|
46 |
^ false
|
|
47 |
!
|
|
48 |
|
|
49 |
initialize
|
|
50 |
repositories _ OrderedCollection new
|
|
51 |
!
|
|
52 |
|
|
53 |
removeRepository: aRepository
|
|
54 |
repositories remove: aRepository ifAbsent: [].
|
|
55 |
self changed: #repositories
|
|
56 |
!
|
|
57 |
|
|
58 |
repositories
|
|
59 |
^ ((Array with: MCCacheRepository default), repositories) select: [ :ea | ea isValid ]
|
|
60 |
!
|
|
61 |
|
|
62 |
repositoriesDo: aBlock
|
|
63 |
self repositories do: [:ea | [aBlock value: ea] on: Error do: []]
|
|
64 |
!
|
|
65 |
|
|
66 |
versionWithInfo: aVersionInfo
|
|
67 |
^self versionWithInfo: aVersionInfo ifNone: [ self error: 'Could not find version ', aVersionInfo name printString,'. Maybe you need to add a repository?' ]
|
|
68 |
!
|
|
69 |
|
|
70 |
versionWithInfo: aVersionInfo ifNone: aBlock
|
|
71 |
self repositoriesDo: [:ea | (ea versionWithInfo: aVersionInfo) ifNotNilDo: [:v | ^ v]].
|
|
72 |
^aBlock value
|
|
73 |
! !
|
|
74 |
|
|
75 |
!MCRepositoryGroup class methodsFor:'documentation'!
|
|
76 |
|
|
77 |
version
|
|
78 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCRepositoryGroup.st,v 1.1 2006-11-22 13:15:57 cg Exp $'
|
|
79 |
! !
|