13641
|
1 |
"{ Package: 'stx:libbasic' }"
|
|
2 |
|
|
3 |
Object subclass:#ConfigurableFeatures
|
|
4 |
instanceVariableNames:''
|
|
5 |
classVariableNames:'LoadedFeatures'
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'System-Support'
|
|
8 |
!
|
|
9 |
|
|
10 |
!ConfigurableFeatures class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
|
14 |
being tired of finding '(Smalltalk at:someClass) notNil' all over the place,
|
|
15 |
start to concentrate feature queries to this single class, which might get more
|
|
16 |
feature methods via extensions.
|
|
17 |
Thus, to correctly ask for a feature being present, use:
|
|
18 |
ConfigurableFeature includesFeature:featureName
|
|
19 |
or
|
|
20 |
ConfigurableFeature knownFeatures
|
|
21 |
to ask for a list of features.
|
|
22 |
|
|
23 |
Caveat: just started; more will be moved to this place as time goes by
|
|
24 |
"
|
|
25 |
! !
|
|
26 |
|
|
27 |
!ConfigurableFeatures class methodsFor:'queries'!
|
|
28 |
|
|
29 |
allFeatures
|
|
30 |
"a list of features which are present in that smalltalk configuration"
|
|
31 |
|
|
32 |
^ self knownFeatures select:[:each | self includesFeature:each]
|
|
33 |
|
|
34 |
"
|
|
35 |
ConfigurableFeatures allFeatures
|
|
36 |
"
|
|
37 |
|
|
38 |
"Created: / 07-09-2011 / 10:50:31 / cg"
|
|
39 |
!
|
|
40 |
|
|
41 |
includesFeature:featureName
|
|
42 |
|querySelector|
|
|
43 |
|
|
44 |
querySelector := ('has',featureName asUppercaseFirst) asSymbol.
|
|
45 |
^ self perform:querySelector ifNotUnderstood:false.
|
|
46 |
|
|
47 |
"
|
|
48 |
ConfigurableFeatures includesFeature:#SubversionSupport
|
|
49 |
"
|
|
50 |
|
|
51 |
"Created: / 07-09-2011 / 10:49:08 / cg"
|
|
52 |
!
|
|
53 |
|
|
54 |
knownFeatures
|
|
55 |
"a list of known features; some of them might not be present in that smalltalk configuration"
|
|
56 |
|
|
57 |
^ self class methodDictionary keys
|
|
58 |
collect:[:each |
|
|
59 |
(each startsWith:'has') ifTrue:[
|
13948
|
60 |
(each endsWith:':') ifFalse:[
|
|
61 |
each copyFrom:4
|
|
62 |
]
|
13641
|
63 |
] ifFalse:[
|
|
64 |
nil
|
|
65 |
].
|
|
66 |
]
|
|
67 |
thenSelect:[:nm | nm notNil]
|
|
68 |
|
|
69 |
"
|
|
70 |
ConfigurableFeatures allFeatures
|
|
71 |
"
|
|
72 |
|
|
73 |
"Created: / 07-09-2011 / 10:51:26 / cg"
|
|
74 |
! !
|
|
75 |
|
|
76 |
!ConfigurableFeatures class methodsFor:'queries-features'!
|
|
77 |
|
13888
|
78 |
hasCVSSupport
|
|
79 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
80 |
^ (Smalltalk at: #'CVSSourceCodeManager' ifAbsent:nil) notNil
|
|
81 |
|
|
82 |
"
|
|
83 |
ConfigurableFeatures hasCVSSupport
|
|
84 |
"
|
|
85 |
|
|
86 |
"Created: / 03-01-2012 / 15:36:54 / cg"
|
|
87 |
!
|
|
88 |
|
|
89 |
hasCVSSupportEnabled
|
13944
|
90 |
^ self hasSCMSupportEnabledFor:#'CVSSourceCodeManager'
|
13888
|
91 |
|
|
92 |
"Created: / 03-01-2012 / 15:42:16 / cg"
|
|
93 |
!
|
|
94 |
|
|
95 |
hasDataBaseSourceCodeManagerSupport
|
|
96 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
97 |
^ (Smalltalk at: #'DataBaseSourceCodeManager' ifAbsent:nil) notNil
|
|
98 |
|
13887
|
99 |
"
|
|
100 |
ConfigurableFeatures hasDataBaseSourceCodeManagerSupport
|
|
101 |
"
|
|
102 |
|
|
103 |
"Created: / 03-01-2012 / 15:36:03 / cg"
|
|
104 |
!
|
|
105 |
|
|
106 |
hasDataBaseSourceCodeManagerSupportEnabled
|
13944
|
107 |
^ self hasSCMSupportEnabledFor:#'DataBaseSourceCodeManager'
|
13887
|
108 |
|
|
109 |
"Created: / 03-01-2012 / 15:36:12 / cg"
|
|
110 |
!
|
|
111 |
|
13874
|
112 |
hasFileBasedSourceCodeManagerSupport
|
13888
|
113 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
114 |
^ (Smalltalk at: #'FileBasedSourceCodeManager' ifAbsent:nil) notNil
|
13874
|
115 |
|
|
116 |
"
|
|
117 |
ConfigurableFeatures hasFileBasedSourceCodeManagerSupport
|
|
118 |
"
|
|
119 |
|
|
120 |
"Created: / 21-12-2011 / 17:07:21 / cg"
|
|
121 |
!
|
|
122 |
|
|
123 |
hasFileBasedSourceCodeManagerSupportEnabled
|
13944
|
124 |
^ self hasSCMSupportEnabledFor:#'FileBasedSourceCodeManager'
|
13874
|
125 |
|
|
126 |
"Created: / 21-12-2011 / 17:07:08 / cg"
|
|
127 |
!
|
|
128 |
|
13944
|
129 |
hasMercurialSupport
|
|
130 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
131 |
^ (Smalltalk at: #'MercurialSourceCodeManager' ifAbsent:nil) notNil
|
|
132 |
|
|
133 |
"
|
|
134 |
ConfigurableFeatures hasMercurialSupport
|
|
135 |
"
|
|
136 |
|
|
137 |
"Created: / 18-01-2012 / 10:58:07 / cg"
|
|
138 |
!
|
|
139 |
|
|
140 |
hasMercurialSupportEnabled
|
|
141 |
^ self hasSCMSupportEnabledFor:#'MercurialSourceCodeManager'
|
|
142 |
|
|
143 |
"
|
|
144 |
self hasMercurialSupportEnabled
|
|
145 |
"
|
|
146 |
|
|
147 |
"Created: / 18-01-2012 / 10:58:12 / cg"
|
|
148 |
!
|
|
149 |
|
13888
|
150 |
hasMonticelloSupport
|
|
151 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
152 |
^ (Smalltalk at: #'MonticelloSourceCodeManager' ifAbsent:nil) notNil
|
|
153 |
|
|
154 |
"
|
|
155 |
ConfigurableFeatures hasMonticelloSupport
|
|
156 |
"
|
|
157 |
|
|
158 |
"Created: / 03-01-2012 / 15:44:32 / cg"
|
|
159 |
!
|
|
160 |
|
|
161 |
hasMonticelloSupportEnabled
|
13944
|
162 |
^ self hasSCMSupportEnabledFor:#'MonticelloSourceCodeManager'
|
13888
|
163 |
|
|
164 |
"Created: / 03-01-2012 / 15:44:39 / cg"
|
|
165 |
!
|
|
166 |
|
|
167 |
hasPerforceSupport
|
|
168 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
169 |
^ (Smalltalk at: #'PerforceSourceCodeManager' ifAbsent:nil) notNil
|
|
170 |
|
|
171 |
"
|
|
172 |
ConfigurableFeatures hasPerforceSupport
|
|
173 |
"
|
13641
|
174 |
|
13888
|
175 |
"Created: / 03-01-2012 / 15:43:42 / cg"
|
|
176 |
!
|
|
177 |
|
|
178 |
hasPerforceSupportEnabled
|
13944
|
179 |
^ self hasSCMSupportEnabledFor:#'PerforceSourceCodeManager'
|
13888
|
180 |
|
|
181 |
"Created: / 03-01-2012 / 15:43:28 / cg"
|
|
182 |
!
|
|
183 |
|
13944
|
184 |
hasSCMSupportEnabledFor:aSourceCodeManagerClassName
|
|
185 |
|scm|
|
|
186 |
|
|
187 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
188 |
scm := Smalltalk at:aSourceCodeManagerClassName ifAbsent:nil.
|
|
189 |
|
|
190 |
^ scm notNil
|
|
191 |
and:[ scm isLoaded
|
|
192 |
and:[ scm shownInBrowserMenus ]]
|
|
193 |
|
|
194 |
"Created: / 18-01-2012 / 10:55:58 / cg"
|
|
195 |
!
|
|
196 |
|
13888
|
197 |
hasSubversionSupport
|
|
198 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
13944
|
199 |
^ (Smalltalk at: #'SVN::SVNSourceCodeManager' ifAbsent:nil) notNil
|
13641
|
200 |
|
|
201 |
"
|
|
202 |
ConfigurableFeatures hasSubversionSupport
|
|
203 |
"
|
|
204 |
|
|
205 |
"Created: / 07-09-2011 / 10:40:40 / cg"
|
|
206 |
!
|
|
207 |
|
|
208 |
hasSubversionSupportEnabled
|
13944
|
209 |
^ self hasSCMSupportEnabledFor:#'SVNSourceCodeManager'
|
13641
|
210 |
|
|
211 |
"Created: / 07-09-2011 / 10:41:33 / cg"
|
|
212 |
! !
|
|
213 |
|
|
214 |
!ConfigurableFeatures class methodsFor:'documentation'!
|
|
215 |
|
|
216 |
version
|
13948
|
217 |
^ '$Header: /cvs/stx/stx/libbasic/ConfigurableFeatures.st,v 1.6 2012-01-19 12:09:48 cg Exp $'
|
13641
|
218 |
!
|
|
219 |
|
|
220 |
version_CVS
|
13948
|
221 |
^ '$Header: /cvs/stx/stx/libbasic/ConfigurableFeatures.st,v 1.6 2012-01-19 12:09:48 cg Exp $'
|
13641
|
222 |
! !
|