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:[
|
|
60 |
each copyFrom:4
|
|
61 |
] ifFalse:[
|
|
62 |
nil
|
|
63 |
].
|
|
64 |
]
|
|
65 |
thenSelect:[:nm | nm notNil]
|
|
66 |
|
|
67 |
"
|
|
68 |
ConfigurableFeatures allFeatures
|
|
69 |
"
|
|
70 |
|
|
71 |
"Created: / 07-09-2011 / 10:51:26 / cg"
|
|
72 |
! !
|
|
73 |
|
|
74 |
!ConfigurableFeatures class methodsFor:'queries-features'!
|
|
75 |
|
|
76 |
hasSubversionSupport
|
|
77 |
|subVersionRepository|
|
|
78 |
|
|
79 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
80 |
subVersionRepository := Smalltalk at: #'SVN::RepositoryManager'.
|
|
81 |
|
|
82 |
^ subVersionRepository notNil
|
|
83 |
|
|
84 |
"
|
|
85 |
ConfigurableFeatures hasSubversionSupport
|
|
86 |
"
|
|
87 |
|
|
88 |
"Created: / 07-09-2011 / 10:40:40 / cg"
|
|
89 |
!
|
|
90 |
|
|
91 |
hasSubversionSupportEnabled
|
|
92 |
|subVersionRepository|
|
|
93 |
|
|
94 |
"/ use Smalltalk-at to trick the dependency/prerequisite generator
|
|
95 |
subVersionRepository := Smalltalk at: #'SVN::RepositoryManager'.
|
|
96 |
|
|
97 |
^ subVersionRepository notNil
|
|
98 |
and:[ subVersionRepository isLoaded
|
|
99 |
and:[ subVersionRepository enabled ]]
|
|
100 |
|
|
101 |
"Created: / 07-09-2011 / 10:41:33 / cg"
|
|
102 |
! !
|
|
103 |
|
|
104 |
!ConfigurableFeatures class methodsFor:'documentation'!
|
|
105 |
|
|
106 |
version
|
|
107 |
^ '$Header: /cvs/stx/stx/libbasic/ConfigurableFeatures.st,v 1.1 2011-09-07 08:54:18 cg Exp $'
|
|
108 |
!
|
|
109 |
|
|
110 |
version_CVS
|
|
111 |
^ '$Header: /cvs/stx/stx/libbasic/ConfigurableFeatures.st,v 1.1 2011-09-07 08:54:18 cg Exp $'
|
|
112 |
! !
|