author | Claus Gittinger <cg@exept.de> |
Mon, 26 Oct 2009 20:39:02 +0100 | |
changeset 157 | eed1900fd7a1 |
parent 154 | 8194c64661da |
child 159 | 890c82936065 |
permissions | -rw-r--r-- |
103 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
Object subclass:#MCPackage |
|
4 |
instanceVariableNames:'name' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Monticello-Base' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!MCPackage class methodsFor:'as yet unclassified'! |
|
12 |
||
13 |
named: aString |
|
14 |
^ self new name: aString |
|
15 |
! ! |
|
16 |
||
17 |
!MCPackage methodsFor:'as yet unclassified'! |
|
18 |
||
19 |
= other |
|
20 |
^ other species = self species and: [other name sameAs: name] |
|
21 |
! |
|
22 |
||
23 |
hasWorkingCopy |
|
24 |
^ MCWorkingCopy registry includesKey: self |
|
25 |
! |
|
26 |
||
27 |
hash |
|
28 |
^ name asLowercase hash |
|
29 |
! |
|
30 |
||
31 |
name |
|
32 |
^ name |
|
33 |
! |
|
34 |
||
35 |
name: aString |
|
36 |
name _ aString |
|
37 |
! |
|
38 |
||
39 |
packageInfo |
|
144
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
40 |
Smalltalk isSmalltalkX ifTrue:[ |
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
41 |
^ ProjectDefinition |
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
42 |
definitionClassForMonticelloPackage:name createIfAbsent:true |
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
43 |
] ifFalse:[ |
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
44 |
^ PackageInfo named: name |
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
45 |
]. |
103 | 46 |
! |
47 |
||
48 |
printOn: aStream |
|
49 |
super printOn: aStream. |
|
50 |
aStream |
|
51 |
nextPut: $(; |
|
52 |
nextPutAll: name; |
|
53 |
nextPut: $) |
|
54 |
! |
|
55 |
||
56 |
snapshot |
|
144
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
57 |
| packageInfo definitions categories | |
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
58 |
packageInfo := self packageInfo. |
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
59 |
definitions := OrderedCollection new. |
154 | 60 |
|
61 |
Smalltalk isSmalltalkX ifTrue:[ |
|
62 |
packageInfo |
|
63 |
extensionMethods do: [:each | |
|
64 |
definitions add:( |
|
65 |
MCMethodDefinition |
|
66 |
className: (each mclass name) |
|
67 |
classIsMeta: (each mclass isMeta) |
|
68 |
selector: (each selector) |
|
69 |
category: (each category) |
|
70 |
timeStamp: nil |
|
71 |
source: (each source)) |
|
72 |
]. |
|
157 | 73 |
|
154 | 74 |
packageInfo classes do: [:ea | |
75 |
definitions addAll: ea classDefinitions |
|
76 |
]. |
|
77 |
packageInfo hasPreLoadAction ifTrue: [definitions add: (MCPreambleDefinition from: packageInfo)]. |
|
78 |
packageInfo hasPostLoadAction ifTrue: [definitions add: (MCPostscriptDefinition from: packageInfo)]. |
|
79 |
packageInfo hasPreUnloadAction ifTrue: [definitions add: (MCRemovalPreambleDefinition from: packageInfo)]. |
|
80 |
"/ in ST/X, there is no live after death |
|
81 |
"/ packageInfo hasPostUnloadAction ifTrue: [definitions add: (MCRemovalPostscriptDefinition from: packageInfo)]. |
|
157 | 82 |
|
154 | 83 |
] ifFalse:[ |
84 |
categories := packageInfo systemCategories. |
|
85 |
categories isEmpty ifFalse: [ definitions add: (MCOrganizationDefinition categories: categories) ]. |
|
86 |
packageInfo methods do: [:ea | definitions add: ea asMethodDefinition] displayingProgress: 'Snapshotting methods...'. |
|
87 |
(packageInfo respondsTo: #overriddenMethods) ifTrue: |
|
88 |
[packageInfo overriddenMethods |
|
89 |
do: [:ea | definitions add: |
|
90 |
(packageInfo changeRecordForOverriddenMethod: ea) asMethodDefinition] |
|
91 |
displayingProgress: 'Searching for overrides...']. |
|
92 |
packageInfo classes do: [:ea | definitions addAll: ea classDefinitions] displayingProgress: 'Snapshotting classes...'. |
|
93 |
(packageInfo respondsTo: #hasPreamble) ifTrue: [ |
|
94 |
packageInfo hasPreamble ifTrue: [definitions add: (MCPreambleDefinition from: packageInfo)]. |
|
95 |
packageInfo hasPostscript ifTrue: [definitions add: (MCPostscriptDefinition from: packageInfo)]. |
|
96 |
packageInfo hasPreambleOfRemoval ifTrue: [definitions add: (MCRemovalPreambleDefinition from: packageInfo)]. |
|
97 |
packageInfo hasPostscriptOfRemoval ifTrue: [definitions add: (MCRemovalPostscriptDefinition from: packageInfo)]]. |
|
98 |
]. |
|
144
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
99 |
^ MCSnapshot fromDefinitions: definitions |
103 | 100 |
! |
101 |
||
102 |
storeOn: aStream |
|
103 |
aStream |
|
104 |
nextPutAll: 'MCPackage'; |
|
105 |
space; nextPutAll: 'named: '; store: name. |
|
106 |
! |
|
107 |
||
108 |
unload |
|
109 |
^ self workingCopy unload |
|
110 |
! |
|
111 |
||
112 |
workingCopy |
|
113 |
^ MCWorkingCopy forPackage: self. |
|
114 |
! ! |
|
115 |
||
116 |
!MCPackage class methodsFor:'documentation'! |
|
117 |
||
118 |
version |
|
157 | 119 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCPackage.st,v 1.4 2009-10-26 19:39:02 cg Exp $' |
144
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
120 |
! |
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
121 |
|
b7077cd6a0c3
more porting (but still unfinished)
Claus Gittinger <cg@exept.de>
parents:
103
diff
changeset
|
122 |
version_CVS |
157 | 123 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCPackage.st,v 1.4 2009-10-26 19:39:02 cg Exp $' |
103 | 124 |
! ! |