1
|
1 |
"{ Package: 'stx:goodies/metacello' }"
|
|
2 |
|
|
3 |
Object subclass:#Metacello
|
|
4 |
instanceVariableNames:'executorSpec statements'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Metacello-Base'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!Metacello class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
classic
|
|
14 |
"set the options such that the load performed will be identical to the classic ConfigurationOf load:
|
|
15 |
(ConfigurationOfExample project version: '1.0') load
|
|
16 |
|
|
17 |
#classic forces Metacello to look at image state to determine which version of a project is loaded instead of using
|
|
18 |
the registry to tell us explicitly which version of a project is loaded .. image state is not PRECISE"
|
|
19 |
|
|
20 |
"useCurrentVersion is a 'private' option for enforcing classic rules, so it's not part of scripting api"
|
|
21 |
|
|
22 |
^ self new
|
|
23 |
onUpgrade: [ :ex | ex allow ];
|
|
24 |
onConflict: [ :ex | ex allow ];
|
|
25 |
addStatement: #'useCurrentVersion:' args: {true};
|
|
26 |
yourself
|
|
27 |
!
|
|
28 |
|
|
29 |
image
|
|
30 |
^ self new
|
|
31 |
executorSpec: #'MetacelloScriptImageExecutor' -> 'batch';
|
|
32 |
yourself
|
|
33 |
!
|
|
34 |
|
|
35 |
registry
|
|
36 |
^ self new
|
|
37 |
executorSpec: #'MetacelloScriptRegistryExecutor' -> 'batch';
|
|
38 |
yourself
|
|
39 |
! !
|
|
40 |
|
|
41 |
!Metacello class methodsFor:'private'!
|
|
42 |
|
|
43 |
scriptExecutorClass
|
|
44 |
^ self scriptExecutorClass: {(#'MetacelloScriptApiExecutor' -> 'batch')}
|
|
45 |
!
|
|
46 |
|
|
47 |
scriptExecutorClass: anExecutorSpec
|
|
48 |
Smalltalk at: anExecutorSpec key ifAbsent: [ ConfigurationOf ensureMetacello: anExecutorSpec value ].
|
|
49 |
^ Smalltalk at: anExecutorSpec key
|
|
50 |
! !
|
|
51 |
|
|
52 |
!Metacello methodsFor:'accessing'!
|
|
53 |
|
|
54 |
executorSpec
|
|
55 |
executorSpec ifNil: [ executorSpec := #'MetacelloScriptApiExecutor' -> 'batch' ].
|
|
56 |
^ executorSpec
|
|
57 |
!
|
|
58 |
|
|
59 |
executorSpec: anAssoc
|
|
60 |
executorSpec := anAssoc
|
|
61 |
!
|
|
62 |
|
|
63 |
scriptExecutor
|
|
64 |
^ (self class scriptExecutorClass: self executorSpec) new
|
|
65 |
!
|
|
66 |
|
|
67 |
statements
|
|
68 |
statements ifNil: [ statements := OrderedCollection new ].
|
|
69 |
^ statements
|
|
70 |
!
|
|
71 |
|
|
72 |
statements: anObject
|
|
73 |
statements := anObject
|
|
74 |
! !
|
|
75 |
|
|
76 |
!Metacello methodsFor:'api actions'!
|
|
77 |
|
|
78 |
fetch
|
|
79 |
self addStatement: #'fetch:' args: #(#()).
|
|
80 |
^ self execute
|
|
81 |
!
|
|
82 |
|
|
83 |
fetch: required
|
|
84 |
self addStatement: #'fetch:' args: {required}.
|
|
85 |
^ self execute
|
|
86 |
!
|
|
87 |
|
|
88 |
get
|
|
89 |
"resolve project name in given repository and return an instance of MetacelloProject resolved from a ConfigurationOf or BaselineOf"
|
|
90 |
|
|
91 |
self addStatement: #'get' args: #().
|
|
92 |
^ self execute
|
|
93 |
!
|
|
94 |
|
|
95 |
list
|
|
96 |
"list projects in registry"
|
|
97 |
|
|
98 |
self addStatement: #'list' args: #().
|
|
99 |
^ self execute
|
|
100 |
!
|
|
101 |
|
|
102 |
load
|
|
103 |
self addStatement: #'load:' args: #(#()).
|
|
104 |
^ self execute
|
|
105 |
!
|
|
106 |
|
|
107 |
load: required
|
|
108 |
self addStatement: #'load:' args: {required}.
|
|
109 |
^ self execute
|
|
110 |
!
|
|
111 |
|
|
112 |
lock
|
|
113 |
"lock projects in registry"
|
|
114 |
|
|
115 |
self addStatement: #'lock' args: #().
|
|
116 |
^ self execute
|
|
117 |
!
|
|
118 |
|
|
119 |
record
|
|
120 |
self addStatement: #'record:' args: #(#()).
|
|
121 |
^ self execute
|
|
122 |
!
|
|
123 |
|
|
124 |
record: required
|
|
125 |
self addStatement: #'record:' args: {required}.
|
|
126 |
^ self execute
|
|
127 |
!
|
|
128 |
|
|
129 |
unlock
|
|
130 |
"unlock projects in registry"
|
|
131 |
|
|
132 |
self addStatement: #'unlock' args: #().
|
|
133 |
^ self execute
|
|
134 |
! !
|
|
135 |
|
|
136 |
!Metacello methodsFor:'api options'!
|
|
137 |
|
|
138 |
cacheRepository: aRepositoryDescription
|
|
139 |
self addStatement: #'cacheRepository:' args: {aRepositoryDescription}
|
|
140 |
!
|
|
141 |
|
|
142 |
ignoreImage
|
|
143 |
"ignore image state"
|
|
144 |
|
|
145 |
self addStatement: #'ignoreImage:' args: {true}
|
|
146 |
!
|
|
147 |
|
|
148 |
onConflict: aBlock
|
|
149 |
self addStatement: #'onConflict:' args: {aBlock}
|
|
150 |
!
|
|
151 |
|
|
152 |
onDowngrade: aBlock
|
|
153 |
self addStatement: #'onDowngrade:' args: {aBlock}
|
|
154 |
!
|
|
155 |
|
|
156 |
onUpgrade: aBlock
|
|
157 |
self addStatement: #'onUpgrade:' args: {aBlock}
|
|
158 |
!
|
|
159 |
|
|
160 |
repositoryOverrides: aRepositoryDescriptionCollection
|
|
161 |
self addStatement: #'repositoryOverrides:' args: {aRepositoryDescriptionCollection}
|
|
162 |
!
|
|
163 |
|
|
164 |
silently
|
|
165 |
"no progress bars"
|
|
166 |
|
|
167 |
self addStatement: #'silently:' args: {true}
|
|
168 |
! !
|
|
169 |
|
|
170 |
!Metacello methodsFor:'api projectSpec'!
|
|
171 |
|
|
172 |
baseline: projectName
|
|
173 |
self addStatement: #'baselineArg:' args: {projectName}
|
|
174 |
!
|
|
175 |
|
|
176 |
className: className
|
|
177 |
self addStatement: #'classNameArg:' args: {className}
|
|
178 |
!
|
|
179 |
|
|
180 |
configuration: projectName
|
|
181 |
self addStatement: #'configurationArg:' args: {projectName}
|
|
182 |
!
|
|
183 |
|
|
184 |
project: projectName
|
|
185 |
self addStatement: #'projectArg:' args: {projectName}
|
|
186 |
!
|
|
187 |
|
|
188 |
repository: repositoryDescription
|
|
189 |
self addStatement: #'repositoryArg:' args: {repositoryDescription}
|
|
190 |
!
|
|
191 |
|
|
192 |
version: versionString
|
|
193 |
self addStatement: #'versionArg:' args: {versionString}
|
|
194 |
! !
|
|
195 |
|
|
196 |
!Metacello methodsFor:'api repository shortcuts'!
|
|
197 |
|
|
198 |
blueplane: projectName
|
|
199 |
self repository: 'http://squeaksource.blueplane.jp/' , projectName
|
|
200 |
!
|
|
201 |
|
|
202 |
croquet: projectName
|
|
203 |
self repository: 'http://hedgehog.software.umn.edu:8888/' , projectName
|
|
204 |
!
|
|
205 |
|
|
206 |
gemsource: projectName
|
|
207 |
self repository: 'http://seaside.gemstone.com/ss/' , projectName
|
|
208 |
!
|
|
209 |
|
|
210 |
impara: projectName
|
|
211 |
self repository: 'http://source.impara.de/' , projectName
|
|
212 |
!
|
|
213 |
|
|
214 |
renggli: projectName
|
|
215 |
self repository: 'http://source.lukas-renggli.ch/' , projectName
|
|
216 |
!
|
|
217 |
|
|
218 |
saltypickle: projectName
|
|
219 |
self repository: 'http://squeak.saltypickle.com/' , projectName
|
|
220 |
!
|
|
221 |
|
|
222 |
squeakfoundation: projectName
|
|
223 |
self repository: 'http://source.squeakfoundation.org/' , projectName
|
|
224 |
!
|
|
225 |
|
|
226 |
squeaksource3: projectName
|
|
227 |
self repository: 'http://ss3.gemstone.com/ss/' , projectName
|
|
228 |
!
|
|
229 |
|
|
230 |
squeaksource: projectName
|
|
231 |
self repository: 'http://www.squeaksource.com/' , projectName
|
|
232 |
!
|
|
233 |
|
|
234 |
ss3: projectName
|
|
235 |
self squeaksource3: projectName
|
|
236 |
!
|
|
237 |
|
|
238 |
wiresong: projectName
|
|
239 |
self repository: 'http://source.wiresong.ca/' , projectName
|
|
240 |
! !
|
|
241 |
|
|
242 |
!Metacello methodsFor:'private'!
|
|
243 |
|
|
244 |
addStatement: selector args: args
|
|
245 |
self statements add: selector -> args
|
|
246 |
!
|
|
247 |
|
|
248 |
execute
|
|
249 |
| script |
|
|
250 |
script := self statements.
|
|
251 |
self statements: nil.
|
|
252 |
^ self scriptExecutor execute: script
|
|
253 |
! !
|
|
254 |
|
|
255 |
!Metacello class methodsFor:'documentation'!
|
|
256 |
|
|
257 |
version_SVN
|
|
258 |
^ '$Id:: $'
|
|
259 |
! !
|