71
|
1 |
"{ Package: 'stx:goodies/monticello' }"
|
|
2 |
|
|
3 |
Object subclass:#MCVersionLoader
|
|
4 |
instanceVariableNames:'versions'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Monticello-Loading'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
221
|
11 |
!MCVersionLoader class methodsFor:'initialization'!
|
|
12 |
|
|
13 |
new
|
|
14 |
^self basicNew initialize
|
|
15 |
! !
|
|
16 |
|
71
|
17 |
!MCVersionLoader class methodsFor:'as yet unclassified'!
|
|
18 |
|
|
19 |
loadVersion: aVersion
|
|
20 |
self new
|
|
21 |
addVersion: aVersion;
|
|
22 |
load
|
|
23 |
! !
|
|
24 |
|
434
|
25 |
!MCVersionLoader methodsFor:'*gofer-core-accessing'!
|
|
26 |
|
|
27 |
goferHasVersions
|
|
28 |
^ versions isEmpty not
|
|
29 |
!
|
|
30 |
|
|
31 |
goferVersions
|
|
32 |
^ versions
|
|
33 |
! !
|
|
34 |
|
|
35 |
!MCVersionLoader methodsFor:'*metacello-mc'!
|
|
36 |
|
|
37 |
versions
|
|
38 |
|
|
39 |
^versions
|
|
40 |
! !
|
|
41 |
|
71
|
42 |
!MCVersionLoader methodsFor:'checking'!
|
|
43 |
|
|
44 |
checkForModifications
|
|
45 |
| modifications |
|
221
|
46 |
modifications := versions select: [:ea | ea package workingCopy modified].
|
71
|
47 |
modifications isEmpty ifFalse: [self warnAboutLosingChangesTo: modifications].
|
|
48 |
!
|
|
49 |
|
|
50 |
checkIfDepIsOlder: aDependency
|
|
51 |
^ aDependency isOlder not
|
|
52 |
or: [self confirm: 'load older dependency ', aDependency versionInfo name , '?']
|
|
53 |
!
|
|
54 |
|
|
55 |
confirmMissingDependency: aDependency
|
|
56 |
| name |
|
|
57 |
name := aDependency versionInfo name.
|
|
58 |
(self confirm: 'Can''t find dependency ', name, '. ignore?')
|
|
59 |
ifFalse: [self error: 'Can''t find dependency ', name]
|
|
60 |
!
|
|
61 |
|
|
62 |
depAgeIsOk: aDependency
|
|
63 |
^ aDependency isOlder not
|
|
64 |
or: [self confirm: 'load older dependency ', aDependency versionInfo name , '?']
|
|
65 |
!
|
|
66 |
|
|
67 |
warnAboutLosingChangesTo: versionCollection
|
|
68 |
self notify: (String streamContents: [:s |
|
|
69 |
s nextPutAll: 'You are about to load new versions of the following packages that have unsaved changes in the image. If you continue, you will lose these changes.'; cr.
|
|
70 |
versionCollection do:
|
|
71 |
[:ea |
|
|
72 |
s cr; space; space; nextPutAll: ea package name]])
|
|
73 |
! !
|
|
74 |
|
221
|
75 |
!MCVersionLoader methodsFor:'initialization'!
|
71
|
76 |
|
|
77 |
initialize
|
221
|
78 |
super initialize.
|
|
79 |
versions := OrderedCollection new
|
71
|
80 |
! !
|
|
81 |
|
|
82 |
!MCVersionLoader methodsFor:'loading'!
|
|
83 |
|
|
84 |
addDependency: aDependency
|
|
85 |
| dep |
|
|
86 |
aDependency isCurrent ifTrue: [^ self].
|
|
87 |
(self depAgeIsOk: aDependency) ifFalse: [^ self].
|
|
88 |
dep := aDependency resolve.
|
|
89 |
dep
|
|
90 |
ifNil: [self confirmMissingDependency: aDependency]
|
|
91 |
ifNotNil: [(versions includes: dep) ifFalse: [self addVersion: dep]]
|
|
92 |
!
|
|
93 |
|
|
94 |
addVersion: aVersion
|
|
95 |
aVersion dependencies do: [ :ea | self addDependency: ea].
|
|
96 |
versions add: aVersion.
|
221
|
97 |
|
71
|
98 |
!
|
|
99 |
|
|
100 |
load
|
221
|
101 |
self loadWithNameLike: versions first info name.
|
|
102 |
|
|
103 |
!
|
|
104 |
|
|
105 |
loadWithNameLike: aString
|
|
106 |
| loader |
|
|
107 |
self checkForModifications.
|
|
108 |
loader := versions size > 1
|
|
109 |
ifTrue: [MCMultiPackageLoader new]
|
|
110 |
ifFalse: [MCPackageLoader new].
|
|
111 |
versions do: [:ea |
|
|
112 |
ea canOptimizeLoading
|
|
113 |
ifTrue: [ea patch applyTo: loader]
|
|
114 |
ifFalse: [loader updatePackage: ea package withSnapshot: ea snapshot]].
|
|
115 |
"/MCStXPackageQuery answer: versions first package name do: [
|
|
116 |
loader loadWithNameLike: aString.
|
|
117 |
"/].
|
|
118 |
versions do: [:ea | ea workingCopy loaded: ea]
|
|
119 |
|
|
120 |
"Modified: / 09-11-2010 / 17:27:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
71
|
121 |
! !
|
|
122 |
|
|
123 |
!MCVersionLoader class methodsFor:'documentation'!
|
|
124 |
|
|
125 |
version
|
434
|
126 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCVersionLoader.st,v 1.4 2011-08-20 17:45:54 cg Exp $'
|
221
|
127 |
!
|
|
128 |
|
|
129 |
version_CVS
|
434
|
130 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCVersionLoader.st,v 1.4 2011-08-20 17:45:54 cg Exp $'
|
221
|
131 |
!
|
|
132 |
|
|
133 |
version_SVN
|
|
134 |
^ '§Id: MCVersionLoader.st 25 2010-11-09 18:50:31Z vranyj1 §'
|
71
|
135 |
! !
|