forked from pharo-project/pharo
/
MetacelloVersionLoadDirective.class.st
192 lines (145 loc) · 5.34 KB
/
MetacelloVersionLoadDirective.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
Class {
#name : #MetacelloVersionLoadDirective,
#superclass : #MetacelloDirective,
#instVars : [
'loadDirectives'
],
#category : #'Metacello-MC-Directives'
}
{ #category : #actions }
MetacelloVersionLoadDirective >> add: aDirective [
self loadDirectives add: aDirective
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> directivesDo: aBlock [
aBlock value: self.
self loadDirectives do: [:directive | directive directivesDo: aBlock ].
]
{ #category : #actions }
MetacelloVersionLoadDirective >> finalizeLoad: aGofer [
"nothing special for linear loads"
]
{ #category : #testing }
MetacelloVersionLoadDirective >> isExplicit [
^false
]
{ #category : #printing }
MetacelloVersionLoadDirective >> label [
self spec == nil ifTrue: [ ^'' ].
^self spec label
]
{ #category : #actions }
MetacelloVersionLoadDirective >> loadAtomicLoadDirective: aLoaderDirective gofer: aGofer [
aLoaderDirective loadDirectives do: [:directive | directive loadUsing: aLoaderDirective gofer: aGofer ].
aLoaderDirective finalizeLoad: aGofer.
]
{ #category : #accessing }
MetacelloVersionLoadDirective >> loadDirectives [
loadDirectives == nil ifTrue: [ loadDirectives := OrderedCollection new ].
^ loadDirectives
]
{ #category : #accessing }
MetacelloVersionLoadDirective >> loadDirectives: anObject [
loadDirectives := anObject
]
{ #category : #actions }
MetacelloVersionLoadDirective >> loadExplicitLoadDirective: aLoaderDirective gofer: aGofer [
"load has already been performed, no need to load again"
]
{ #category : #actions }
MetacelloVersionLoadDirective >> loadLinearLoadDirective: aLoaderDirective gofer: aGofer [
aLoaderDirective loadDirectives do: [:directive | directive loadUsing: aLoaderDirective gofer: aGofer ].
aLoaderDirective finalizeLoad: aGofer.
]
{ #category : #loading }
MetacelloVersionLoadDirective >> loadPackageDirective: aPackageLoadDirective gofer: aGofer [
aPackageLoadDirective loader loadingSpecLoader
loadPackageDirective: aPackageLoadDirective
gofer: aGofer
]
{ #category : #loading }
MetacelloVersionLoadDirective >> loadPostloadDirective: aPostloadDirective [
| block |
(block := aPostloadDirective spec postLoadDoItBlock) ~~ nil
ifTrue: [
MetacelloNotification signal: ('Evaluating -> ', aPostloadDirective spec label, ' >> ', aPostloadDirective spec postLoadDoIt value asString).
aPostloadDirective evaluateSupplyingAnswers: [ block valueWithPossibleArgs:
(Array
with: aPostloadDirective loader
with: aPostloadDirective spec) ].
MetacelloNotification signal: ('Evaluated -> ', aPostloadDirective spec label, ' >> ', aPostloadDirective spec postLoadDoIt value asString)]
]
{ #category : #loading }
MetacelloVersionLoadDirective >> loadPreloadDirective: aPreloadDirective [
| block |
(block := aPreloadDirective spec preLoadDoItBlock) ~~ nil
ifTrue: [
aPreloadDirective evaluateSupplyingAnswers: [ block valueWithPossibleArgs:
(Array
with: aPreloadDirective loader
with: aPreloadDirective spec) ].
MetacelloNotification signal: ('Evaluated -> ', aPreloadDirective spec label, ' >> ', aPreloadDirective spec preLoadDoIt value asString)]
]
{ #category : #actions }
MetacelloVersionLoadDirective >> loadWithPolicy: aLoadPolicy [
| gofer |
gofer := MetacelloGofer new.
gofer disablePackageCache.
gofer repository: aLoadPolicy cacheRepository.
self loadUsing: self gofer: gofer
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> packageDirectivesDo: aBlock [
self loadDirectives do: [:directive | directive packageDirectivesDo: aBlock ].
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> packagesDo: aBlock [
self loadDirectives do: [:directive | directive packageDo: aBlock ].
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> prepostLoadDirectivesDo: aBlock [
self loadDirectives do: [:directive | directive prepostLoadDirectivesDo: aBlock ].
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> prepostLoadsDo: aBlock [
self loadDirectives do: [:directive | directive prepostLoadDo: aBlock ].
]
{ #category : #printing }
MetacelloVersionLoadDirective >> printLoadDirectivesOn: aStream indent: indent [
self loadDirectives do: [:each |
aStream cr.
each printOn: aStream indent: indent + 1 ].
]
{ #category : #printing }
MetacelloVersionLoadDirective >> printOn: aStream indent: indent [
super printOn: aStream indent: indent.
self printLoadDirectivesOn: aStream indent: indent
]
{ #category : #accessing }
MetacelloVersionLoadDirective >> spec [
"Expected to be a MetacelloVersionSpec"
(spec == nil and: [ self loader ~~ nil ])
ifTrue: [
^[ self loader spec versionSpec ]
on: MessageNotUnderstood
do: [:ex | ex return: self loader spec ]].
^spec
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> versionDirectivesDepthFirstDo: aBlock [
self loadDirectives do: [:directive | directive versionDirectivesDepthFirstDo: aBlock ].
aBlock value: self.
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> versionDirectivesDo: aBlock [
aBlock value: self.
self loadDirectives do: [:directive | directive versionDirectivesDo: aBlock ].
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> versionDo: aBlock [
aBlock value: self.
]
{ #category : #enumerating }
MetacelloVersionLoadDirective >> versionsDo: aBlock [
self loadDirectives do: [:directive | directive versionDo: aBlock ].
]