17865
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
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 |
"
|
17859
|
12 |
"{ Package: 'stx:libbasic' }"
|
|
13 |
|
|
14 |
Object subclass:#ConfigurableFeatures
|
|
15 |
instanceVariableNames:''
|
|
16 |
classVariableNames:'LoadedFeatures'
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'System-Support'
|
|
19 |
!
|
|
20 |
|
|
21 |
!ConfigurableFeatures class methodsFor:'documentation'!
|
|
22 |
|
17865
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
17859
|
37 |
documentation
|
|
38 |
"
|
|
39 |
being tired of finding '(Smalltalk at:someClass) notNil' all over the place,
|
|
40 |
start to concentrate feature queries to this single class, which might get more
|
|
41 |
feature methods via extensions.
|
|
42 |
Thus, to correctly ask for a feature being present, use:
|
|
43 |
ConfigurableFeature includesFeature:featureName
|
|
44 |
or
|
|
45 |
ConfigurableFeature knownFeatures
|
|
46 |
to ask for a list of features.
|
|
47 |
|
|
48 |
Caveat: just started; more will be moved to this place as time goes by
|
|
49 |
"
|
|
50 |
! !
|
|
51 |
|
|
52 |
!ConfigurableFeatures class methodsFor:'queries'!
|
|
53 |
|
|
54 |
allFeatures
|
|
55 |
"a list of features which are present in that smalltalk configuration"
|
|
56 |
|
|
57 |
^ self knownFeatures select:[:each | self includesFeature:each]
|
|
58 |
|
|
59 |
"
|
|
60 |
ConfigurableFeatures allFeatures
|
|
61 |
"
|
|
62 |
|
|
63 |
"Created: / 07-09-2011 / 10:50:31 / cg"
|
|
64 |
!
|
|
65 |
|
|
66 |
includesFeature:featureName
|
|
67 |
|querySelector|
|
|
68 |
|
|
69 |
querySelector := ('has',featureName asUppercaseFirst) asSymbol.
|
|
70 |
^ self perform:querySelector ifNotUnderstood:false.
|
|
71 |
|
|
72 |
"
|
|
73 |
ConfigurableFeatures includesFeature:#SubversionSupport
|
|
74 |
"
|
|
75 |
|
|
76 |
"Created: / 07-09-2011 / 10:49:08 / cg"
|
|
77 |
!
|
|
78 |
|
|
79 |
knownFeatures
|
|
80 |
"a list of known features; some of them might not be present in that smalltalk configuration"
|
|
81 |
|
|
82 |
^ self class methodDictionary keys
|
|
83 |
collect:[:each |
|
|
84 |
(each startsWith:'has') ifTrue:[
|
|
85 |
each copyFrom:4
|
|
86 |
] ifFalse:[
|
|
87 |
nil
|
|
88 |
].
|
|
89 |
]
|
|
90 |
thenSelect:[:nm | nm notNil]
|
|
91 |
|
|
92 |
"
|
|
93 |
ConfigurableFeatures allFeatures
|
|
94 |
"
|
|
95 |
|
|
96 |
"Created: / 07-09-2011 / 10:51:26 / cg"
|
|
97 |
! !
|
|
98 |
|
|
99 |
!ConfigurableFeatures class methodsFor:'queries-features'!
|
|
100 |
|
17907
|
101 |
hasFileBasedSourceCodeManagerSupport
|
|
102 |
|mgr|
|
|
103 |
|
|
104 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
105 |
^ (mgr := Smalltalk at: #'FileBasedSourceCodeManager') notNil
|
|
106 |
and:[ mgr enabled ]
|
|
107 |
"
|
|
108 |
ConfigurableFeatures hasFileBasedSourceCodeManagerSupport
|
|
109 |
"
|
|
110 |
|
|
111 |
"Created: / 21-12-2011 / 17:07:21 / cg"
|
|
112 |
!
|
|
113 |
|
|
114 |
hasFileBasedSourceCodeManagerSupportEnabled
|
|
115 |
|repository|
|
|
116 |
|
|
117 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
118 |
repository := Smalltalk at: #'FileBasedSourceCodeManager'.
|
|
119 |
|
|
120 |
^ repository notNil
|
|
121 |
and:[ repository isLoaded
|
|
122 |
and:[ repository enabled ]]
|
|
123 |
|
|
124 |
"Created: / 21-12-2011 / 17:07:08 / cg"
|
|
125 |
!
|
|
126 |
|
17859
|
127 |
hasSubversionSupport
|
|
128 |
|subVersionRepository|
|
|
129 |
|
|
130 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
131 |
subVersionRepository := Smalltalk at: #'SVN::RepositoryManager'.
|
|
132 |
|
|
133 |
^ subVersionRepository notNil
|
|
134 |
|
|
135 |
"
|
|
136 |
ConfigurableFeatures hasSubversionSupport
|
|
137 |
"
|
|
138 |
|
|
139 |
"Created: / 07-09-2011 / 10:40:40 / cg"
|
|
140 |
!
|
|
141 |
|
|
142 |
hasSubversionSupportEnabled
|
|
143 |
|subVersionRepository|
|
|
144 |
|
|
145 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
146 |
subVersionRepository := Smalltalk at: #'SVN::RepositoryManager'.
|
|
147 |
|
|
148 |
^ subVersionRepository notNil
|
|
149 |
and:[ subVersionRepository isLoaded
|
|
150 |
and:[ subVersionRepository enabled ]]
|
|
151 |
|
|
152 |
"Created: / 07-09-2011 / 10:41:33 / cg"
|
|
153 |
! !
|
|
154 |
|
|
155 |
!ConfigurableFeatures class methodsFor:'documentation'!
|
|
156 |
|
|
157 |
version
|
17907
|
158 |
^ '$Header: /cvs/stx/stx/libbasic/ConfigurableFeatures.st,v 1.2 2011/12/21 18:19:57 cg Exp $'
|
17859
|
159 |
!
|
|
160 |
|
|
161 |
version_CVS
|
17907
|
162 |
^ 'Header: /cvs/stx/stx/libbasic/ConfigurableFeatures.st,v 1.2 2011/12/21 18:19:57 cg Exp '
|
17865
|
163 |
!
|
|
164 |
|
|
165 |
version_SVN
|
17907
|
166 |
^ '$Id: ConfigurableFeatures.st 10751 2011-12-21 22:04:49Z vranyj1 $'
|
17865
|
167 |
! !
|
17892
|
168 |
|
17907
|
169 |
|