1
|
1 |
"{ Package: 'stx:goodies/metacello' }"
|
|
2 |
|
|
3 |
MetacelloAbstractVersionConstructor subclass:#MetacelloBaselineConstructor
|
|
4 |
instanceVariableNames:''
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Metacello-Core-Constructors'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!MetacelloBaselineConstructor class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
on: aConfig
|
|
14 |
^ self new
|
|
15 |
on: aConfig;
|
|
16 |
yourself
|
|
17 |
!
|
|
18 |
|
|
19 |
on: aConfig project: aProject
|
|
20 |
^ self new
|
|
21 |
on: aConfig project: aProject;
|
|
22 |
yourself
|
|
23 |
! !
|
|
24 |
|
|
25 |
!MetacelloBaselineConstructor methodsFor:'accessing'!
|
|
26 |
|
|
27 |
projectClass
|
|
28 |
^ MetacelloMCBaselineProject
|
|
29 |
! !
|
|
30 |
|
|
31 |
!MetacelloBaselineConstructor methodsFor:'initialization'!
|
|
32 |
|
|
33 |
on: aConfig
|
|
34 |
self calculate: aConfig project: nil
|
|
35 |
!
|
|
36 |
|
|
37 |
on: aConfig project: aProject
|
|
38 |
self calculate: aConfig project: aProject
|
|
39 |
! !
|
|
40 |
|
|
41 |
!MetacelloBaselineConstructor methodsFor:'pragma extraction'!
|
|
42 |
|
|
43 |
extractBaselinePragmaFor: aClass
|
|
44 |
| pragmas |
|
|
45 |
pragmas := Pragma allNamed: #'baseline' in: aClass.
|
|
46 |
pragmas isEmpty
|
|
47 |
ifTrue: [ ^ self error: 'No #baseline pragma found' ].
|
|
48 |
^ pragmas first
|
|
49 |
! !
|
|
50 |
|
|
51 |
!MetacelloBaselineConstructor methodsFor:'private'!
|
|
52 |
|
|
53 |
calculate: aConfig project: aProject
|
|
54 |
| pragma versionMap versionSpec |
|
|
55 |
self configuration: aConfig.
|
|
56 |
pragma := self extractBaselinePragmaFor: aConfig class.
|
|
57 |
self
|
|
58 |
setProject:
|
|
59 |
(aProject
|
|
60 |
ifNil: [
|
|
61 |
[ aConfig class project ]
|
|
62 |
on: MessageNotUnderstood
|
|
63 |
do: [ :ex | ex return: nil ] ]).
|
|
64 |
versionSpec := self project versionSpec.
|
|
65 |
self root: versionSpec.
|
|
66 |
self evaluatePragma: pragma.
|
|
67 |
versionMap := Dictionary new.
|
|
68 |
self project attributes
|
|
69 |
do: [ :attribute |
|
|
70 |
| blockList |
|
|
71 |
(blockList := self attributeMap at: attribute ifAbsent: [ ]) ~~ nil
|
|
72 |
ifTrue: [ blockList do: [ :block | self with: versionSpec during: block ] ] ].
|
|
73 |
versionSpec versionString: self project singletonVersionName.
|
|
74 |
versionMap at: versionSpec versionString put: versionSpec createVersion.
|
|
75 |
self project map: versionMap.
|
|
76 |
self project configuration: aConfig
|
|
77 |
! !
|
|
78 |
|
|
79 |
!MetacelloBaselineConstructor class methodsFor:'documentation'!
|
|
80 |
|
|
81 |
version_SVN
|
|
82 |
^ '$Id:: $'
|
|
83 |
! !
|