author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 31 May 2018 10:52:50 +0100 | |
branch | jv |
changeset 4330 | 998eb03f0736 |
parent 3011 | 1997ff6e7e55 |
permissions | -rw-r--r-- |
1443 | 1 |
" |
2 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
1675 | 3 |
All Rights Reserved |
1443 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
1229 | 13 |
"{ Package: 'stx:libbasic3' }" |
14 |
||
15 |
"{ NameSpace: Packages }" |
|
16 |
||
17 |
Object subclass:#AbstractPackageManager |
|
18 |
instanceVariableNames:'packages' |
|
19 |
classVariableNames:'' |
|
20 |
poolDictionaries:'' |
|
21 |
category:'Package-Managers' |
|
22 |
! |
|
23 |
||
1443 | 24 |
!AbstractPackageManager class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
1675 | 29 |
All Rights Reserved |
1443 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! ! |
|
1229 | 39 |
|
40 |
!AbstractPackageManager class methodsFor:'instance creation'! |
|
41 |
||
42 |
new |
|
43 |
^ self basicNew initialize |
|
44 |
! ! |
|
45 |
||
46 |
!AbstractPackageManager class methodsFor:'defaults'! |
|
47 |
||
48 |
defaultPackages |
|
49 |
^ Dictionary new. |
|
50 |
! ! |
|
51 |
||
52 |
!AbstractPackageManager class methodsFor:'factory'! |
|
53 |
||
54 |
newDefaultPackage |
|
1675 | 55 |
^ (self newPackageNamed:(Project noProjectID)) mergeFromImage. |
1229 | 56 |
! |
57 |
||
58 |
newPackageNamed:aString |
|
59 |
^ self packageClass named:aString |
|
60 |
! ! |
|
61 |
||
62 |
!AbstractPackageManager methodsFor:'accessing'! |
|
63 |
||
64 |
packages |
|
65 |
^ packages |
|
66 |
! |
|
67 |
||
68 |
packages:something |
|
69 |
"set the value of the instance variable 'packages' (automatically generated)" |
|
70 |
||
71 |
packages := something. |
|
72 |
! ! |
|
73 |
||
74 |
!AbstractPackageManager methodsFor:'api'! |
|
75 |
||
76 |
installPackage:aPackage |
|
77 |
"installs aPackage into the image." |
|
1675 | 78 |
self subclassResponsibility |
1229 | 79 |
! |
80 |
||
81 |
loadPackage:aFilename |
|
82 |
"loads a package ready for installation into the image" |
|
1675 | 83 |
self subclassResponsibility |
1229 | 84 |
! |
85 |
||
86 |
savePackage:aPackage |
|
87 |
"saves package" |
|
1675 | 88 |
self subclassResponsibility |
1229 | 89 |
! |
90 |
||
91 |
savePackage:aPackage as:aFilename |
|
92 |
"saves package" |
|
1675 | 93 |
self subclassResponsibility |
1229 | 94 |
! |
95 |
||
96 |
uninstallPackage:aPackage |
|
97 |
"uninstalls aPackage from the image" |
|
1675 | 98 |
self subclassResponsibility |
1229 | 99 |
! |
100 |
||
101 |
unloadPackage:aPackage |
|
102 |
"unloads the package from the receiver" |
|
1675 | 103 |
self subclassResponsibility |
1229 | 104 |
! ! |
105 |
||
106 |
!AbstractPackageManager methodsFor:'enumerating'! |
|
107 |
||
108 |
packagesDo:aOneArgBlock |
|
109 |
self packagesDo:aOneArgBlock excluding:#(). |
|
110 |
! |
|
111 |
||
1675 | 112 |
packagesDo:aOneArgBlock excluding:aCollectionOrObject |
1229 | 113 |
"iterate through all packages except for aCollection of packages. Return the receiver. |
114 |
also look at #packagesDo: if you dont want to exclude anything" |
|
115 |
(aCollectionOrObject isCollection) ifTrue:[ |
|
1675 | 116 |
self packages do:[:aPackage | |
117 |
(aCollectionOrObject includes:aPackage) ifFalse:[ |
|
118 |
aOneArgBlock value:aPackage. |
|
119 |
]. |
|
120 |
]. |
|
121 |
^ self. |
|
1229 | 122 |
]. |
123 |
||
124 |
self packages do:[:aPackage | |
|
1675 | 125 |
(aCollectionOrObject == aPackage) ifFalse:[ |
126 |
aOneArgBlock value:aPackage. |
|
127 |
]. |
|
1229 | 128 |
]. |
129 |
! ! |
|
130 |
||
131 |
!AbstractPackageManager methodsFor:'initialization'! |
|
132 |
||
133 |
initialize |
|
134 |
packages := self class defaultPackages. |
|
135 |
ChangeSet current addDependent:self. |
|
1268 | 136 |
"/ Smalltalk addDependent:self. |
1229 | 137 |
! |
138 |
||
139 |
uninitialize |
|
140 |
packages := self class defaultPackages. |
|
141 |
ChangeSet current removeDependent:self. |
|
1268 | 142 |
"/ Smalltalk removeDependent:self. |
1229 | 143 |
! ! |
144 |
||
145 |
!AbstractPackageManager methodsFor:'queries'! |
|
146 |
||
147 |
includesPackage:aPackage |
|
148 |
^ packages includesKey:aPackage name |
|
149 |
! |
|
150 |
||
151 |
includesPackageNamed:aPackageName |
|
1675 | 152 |
|
1229 | 153 |
^ packages includesKey:aPackageName |
154 |
! ! |
|
155 |
||
156 |
!AbstractPackageManager class methodsFor:'documentation'! |
|
157 |
||
158 |
version |
|
3011
1997ff6e7e55
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1675
diff
changeset
|
159 |
^ '$Header: /var/local/cvs/stx/libbasic3/packages/AbstractPackageManager.st,v 1.4 2006-08-24 08:39:01 cg Exp $' |
1229 | 160 |
! ! |