author | vrany |
Tue, 13 Mar 2012 18:24:12 +0100 | |
changeset 14059 | 9afc79d37c0c |
parent 13948 | 5c482fe46e20 |
child 14104 | 2c06d704086a |
permissions | -rw-r--r-- |
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 |
|
14059
9afc79d37c0c
changed: #hasSubversionSupport (stc compilation fix)
vrany
parents:
13948
diff
changeset
|
199 |
^ (Smalltalk at: #'SVNSourceCodeManager' ifAbsent:nil) notNil |
13641 | 200 |
|
201 |
" |
|
202 |
ConfigurableFeatures hasSubversionSupport |
|
203 |
" |
|
204 |
||
205 |
"Created: / 07-09-2011 / 10:40:40 / cg" |
|
14059
9afc79d37c0c
changed: #hasSubversionSupport (stc compilation fix)
vrany
parents:
13948
diff
changeset
|
206 |
"Modified: / 13-03-2012 / 17:19:13 / Jan Vrany <jan.vrany.fit.cvut.cz>" |
13641 | 207 |
! |
208 |
||
209 |
hasSubversionSupportEnabled |
|
13944 | 210 |
^ self hasSCMSupportEnabledFor:#'SVNSourceCodeManager' |
13641 | 211 |
|
212 |
"Created: / 07-09-2011 / 10:41:33 / cg" |
|
213 |
! ! |
|
214 |
||
215 |
!ConfigurableFeatures class methodsFor:'documentation'! |
|
216 |
||
217 |
version |
|
14059
9afc79d37c0c
changed: #hasSubversionSupport (stc compilation fix)
vrany
parents:
13948
diff
changeset
|
218 |
^ '$Header: /cvs/stx/stx/libbasic/ConfigurableFeatures.st,v 1.7 2012-03-13 17:24:12 vrany Exp $' |
13641 | 219 |
! |
220 |
||
221 |
version_CVS |
|
14059
9afc79d37c0c
changed: #hasSubversionSupport (stc compilation fix)
vrany
parents:
13948
diff
changeset
|
222 |
^ '$Header: /cvs/stx/stx/libbasic/ConfigurableFeatures.st,v 1.7 2012-03-13 17:24:12 vrany Exp $' |
13641 | 223 |
! ! |