treequel 1.0.1 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +176 -14
- data/LICENSE +1 -1
- data/Rakefile +61 -45
- data/Rakefile.local +20 -0
- data/bin/treequel +502 -269
- data/examples/ldap-rack-auth.rb +2 -0
- data/lib/treequel.rb +221 -18
- data/lib/treequel/branch.rb +410 -201
- data/lib/treequel/branchcollection.rb +25 -13
- data/lib/treequel/branchset.rb +42 -40
- data/lib/treequel/constants.rb +233 -3
- data/lib/treequel/control.rb +95 -0
- data/lib/treequel/controls/contentsync.rb +138 -0
- data/lib/treequel/controls/pagedresults.rb +162 -0
- data/lib/treequel/controls/sortedresults.rb +216 -0
- data/lib/treequel/directory.rb +212 -65
- data/lib/treequel/exceptions.rb +11 -12
- data/lib/treequel/filter.rb +1 -12
- data/lib/treequel/mixins.rb +83 -47
- data/lib/treequel/monkeypatches.rb +29 -0
- data/lib/treequel/schema.rb +23 -19
- data/lib/treequel/schema/attributetype.rb +33 -3
- data/lib/treequel/schema/ldapsyntax.rb +0 -11
- data/lib/treequel/schema/matchingrule.rb +0 -11
- data/lib/treequel/schema/matchingruleuse.rb +0 -11
- data/lib/treequel/schema/objectclass.rb +36 -10
- data/lib/treequel/schema/table.rb +159 -0
- data/lib/treequel/sequel_integration.rb +7 -7
- data/lib/treequel/utils.rb +4 -66
- data/rake/documentation.rb +89 -0
- data/rake/helpers.rb +375 -307
- data/rake/hg.rb +16 -2
- data/rake/manual.rb +11 -6
- data/rake/packaging.rb +20 -35
- data/rake/publishing.rb +22 -62
- data/spec/lib/constants.rb +20 -0
- data/spec/lib/control_behavior.rb +44 -0
- data/spec/lib/matchers.rb +51 -0
- data/spec/treequel/branch_spec.rb +88 -29
- data/spec/treequel/branchcollection_spec.rb +24 -1
- data/spec/treequel/branchset_spec.rb +123 -51
- data/spec/treequel/control_spec.rb +48 -0
- data/spec/treequel/controls/contentsync_spec.rb +38 -0
- data/spec/treequel/controls/pagedresults_spec.rb +138 -0
- data/spec/treequel/controls/sortedresults_spec.rb +171 -0
- data/spec/treequel/directory_spec.rb +186 -16
- data/spec/treequel/mixins_spec.rb +42 -3
- data/spec/treequel/schema/attributetype_spec.rb +22 -20
- data/spec/treequel/schema/objectclass_spec.rb +67 -46
- data/spec/treequel/schema/table_spec.rb +134 -0
- data/spec/treequel_spec.rb +277 -15
- metadata +89 -108
- data/bin/treequel.orig +0 -963
- data/examples/ldap-monitor.rb +0 -143
- data/examples/ldap-monitor/public/css/master.css +0 -328
- data/examples/ldap-monitor/public/images/card_small.png +0 -0
- data/examples/ldap-monitor/public/images/chain_small.png +0 -0
- data/examples/ldap-monitor/public/images/globe_small.png +0 -0
- data/examples/ldap-monitor/public/images/globe_small_green.png +0 -0
- data/examples/ldap-monitor/public/images/plug.png +0 -0
- data/examples/ldap-monitor/public/images/shadows/large-30-down.png +0 -0
- data/examples/ldap-monitor/public/images/tick.png +0 -0
- data/examples/ldap-monitor/public/images/tick_circle.png +0 -0
- data/examples/ldap-monitor/public/images/treequel-favicon.png +0 -0
- data/examples/ldap-monitor/views/backends.erb +0 -41
- data/examples/ldap-monitor/views/connections.erb +0 -74
- data/examples/ldap-monitor/views/databases.erb +0 -39
- data/examples/ldap-monitor/views/dump_subsystem.erb +0 -14
- data/examples/ldap-monitor/views/index.erb +0 -14
- data/examples/ldap-monitor/views/layout.erb +0 -35
- data/examples/ldap-monitor/views/listeners.erb +0 -30
- data/rake/rdoc.rb +0 -30
- data/rake/win32.rb +0 -190
data/examples/ldap-monitor.rb
DELETED
@@ -1,143 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
BEGIN {
|
4
|
-
require 'pathname'
|
5
|
-
basedir = Pathname( __FILE__ ).dirname.parent
|
6
|
-
libdir = basedir + 'lib'
|
7
|
-
|
8
|
-
$LOAD_PATH.unshift( libdir.to_s )
|
9
|
-
}
|
10
|
-
|
11
|
-
require 'rubygems'
|
12
|
-
require 'sinatra'
|
13
|
-
require 'treequel'
|
14
|
-
require 'erb'
|
15
|
-
|
16
|
-
include ERB::Util
|
17
|
-
|
18
|
-
# The real data is all in operational attributes, so fetch them by default
|
19
|
-
Treequel::Branch.include_operational_attrs = true
|
20
|
-
|
21
|
-
configure do
|
22
|
-
set :root, Pathname( __FILE__ ).dirname + 'ldap-monitor'
|
23
|
-
end
|
24
|
-
|
25
|
-
before do
|
26
|
-
@monitor ||= Treequel.directory( 'ldap://localhost/cn=Monitor',
|
27
|
-
:bind_dn => 'cn=admin,cn=Monitor', :pass => 'monitor' )
|
28
|
-
end
|
29
|
-
|
30
|
-
helpers do
|
31
|
-
|
32
|
-
### Return a string describing the amount of time in the given number of
|
33
|
-
### seconds in terms a human can understand easily.
|
34
|
-
def time_delta_string( start_time )
|
35
|
-
start = Time.parse( start_time ) or return "some time"
|
36
|
-
seconds = Time.now - start
|
37
|
-
|
38
|
-
return 'less than a minute' if seconds < 60
|
39
|
-
|
40
|
-
if seconds < 50 * 60
|
41
|
-
return "%d minute%s" % [seconds / 60, seconds/60 == 1 ? '' : 's']
|
42
|
-
end
|
43
|
-
|
44
|
-
return 'about an hour' if seconds < 90 * MINUTES
|
45
|
-
return "%d hours" % [seconds / HOURS] if seconds < 18 * HOURS
|
46
|
-
return 'one day' if seconds < 1 * DAYS
|
47
|
-
return 'about a day' if seconds < 2 * DAYS
|
48
|
-
return "%d days" % [seconds / DAYS] if seconds < 1 * WEEKS
|
49
|
-
return 'about a week' if seconds < 2 * WEEKS
|
50
|
-
return "%d weeks" % [seconds / WEEKS] if seconds < 3 * MONTHS
|
51
|
-
return "%d months" % [seconds / MONTHS] if seconds < 2 * YEARS
|
52
|
-
return "%d years" % [seconds / YEARS]
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
### GET /
|
58
|
-
get '/' do
|
59
|
-
erb :index,
|
60
|
-
:locals => {
|
61
|
-
:server_info => @monitor.base['monitoredInfo'],
|
62
|
-
:datapoints => @monitor.children,
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
#
|
68
|
-
# Subsystems
|
69
|
-
#
|
70
|
-
|
71
|
-
get '/backends' do
|
72
|
-
subsystem = @monitor.cn( :backends )
|
73
|
-
backends = subsystem.
|
74
|
-
filter( :objectClass => :monitoredObject ).
|
75
|
-
select( :+, :* )
|
76
|
-
|
77
|
-
erb :backends,
|
78
|
-
:locals => {
|
79
|
-
:subsystem => subsystem,
|
80
|
-
:backends => backends,
|
81
|
-
}
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
get '/connections' do
|
86
|
-
subsystem = @monitor.cn( :connections )
|
87
|
-
connections = subsystem.
|
88
|
-
filter( :objectClass => :monitorConnection ).
|
89
|
-
select( :+, :* )
|
90
|
-
|
91
|
-
erb :connections,
|
92
|
-
:locals => {
|
93
|
-
:subsystem => subsystem,
|
94
|
-
:total => subsystem.cn( :total ),
|
95
|
-
:current => subsystem.cn( :current ),
|
96
|
-
:connections => connections.all,
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
get '/databases' do
|
102
|
-
subsystem = @monitor.cn( :databases )
|
103
|
-
databases = subsystem.
|
104
|
-
filter( :objectClass => :monitoredObject ).
|
105
|
-
select( :+, :* )
|
106
|
-
|
107
|
-
erb :databases,
|
108
|
-
:locals => {
|
109
|
-
:subsystem => subsystem,
|
110
|
-
:databases => databases,
|
111
|
-
}
|
112
|
-
end
|
113
|
-
|
114
|
-
|
115
|
-
get '/listeners' do
|
116
|
-
subsystem = @monitor.cn( :listeners )
|
117
|
-
listeners = subsystem.
|
118
|
-
filter( :objectClass => :monitoredObject ).
|
119
|
-
select( :+, :* )
|
120
|
-
|
121
|
-
erb :listeners,
|
122
|
-
:locals => {
|
123
|
-
:subsystem => subsystem,
|
124
|
-
:listeners => listeners,
|
125
|
-
}
|
126
|
-
end
|
127
|
-
|
128
|
-
|
129
|
-
### Fallback handler for subsystems
|
130
|
-
get '/:subsystem' do
|
131
|
-
subsystem = @monitor.cn( params[:subsystem] )
|
132
|
-
contents = subsystem.
|
133
|
-
filter( :objectClass => :monitoredObject ).
|
134
|
-
select( :+, :* )
|
135
|
-
|
136
|
-
erb :dump_subsystem,
|
137
|
-
:locals => {
|
138
|
-
:subsystem => subsystem,
|
139
|
-
:contents => contents,
|
140
|
-
}
|
141
|
-
end
|
142
|
-
|
143
|
-
|
@@ -1,328 +0,0 @@
|
|
1
|
-
/* @override http://gont.ljc.laika.com:9191/css/master.css */
|
2
|
-
|
3
|
-
/*
|
4
|
-
* LDAP Web Monitor Stylesheet
|
5
|
-
*
|
6
|
-
* Authors:
|
7
|
-
* * Michael Granger <mgranger@laika.com>
|
8
|
-
*
|
9
|
-
*/
|
10
|
-
|
11
|
-
/* @group Entity styles */
|
12
|
-
html {
|
13
|
-
font: 14px/1.4em "Helvetica Neue", Verdana, sans-serif;
|
14
|
-
margin: 0;
|
15
|
-
padding: 0;
|
16
|
-
text-align: left;
|
17
|
-
line-height: 1.5em;
|
18
|
-
border-left: 2px solid #908558;
|
19
|
-
min-height: 100%;
|
20
|
-
background-color: #a8a8a9;
|
21
|
-
}
|
22
|
-
|
23
|
-
body {
|
24
|
-
background: #f0f0f2;
|
25
|
-
margin: 0;
|
26
|
-
min-width: 620px;
|
27
|
-
}
|
28
|
-
|
29
|
-
h1,h2,h3,h4,h5,h6 {
|
30
|
-
margin-top: 1em;
|
31
|
-
margin-bottom: 0;
|
32
|
-
color: #333;
|
33
|
-
font-weight: bold;
|
34
|
-
}
|
35
|
-
|
36
|
-
h1 {
|
37
|
-
font-family: "Helvetica Neue UltraLight", sans-serif;
|
38
|
-
font-size: 340%;
|
39
|
-
text-shadow: 1px 1px 2px #666;
|
40
|
-
padding-bottom: 0.25em;
|
41
|
-
border-bottom: 1px solid #3f6217;
|
42
|
-
margin-top: 0;
|
43
|
-
}
|
44
|
-
|
45
|
-
h2 {
|
46
|
-
font-family: "Helvetica Neue Condensed Bold", Verdana, sans-serif;
|
47
|
-
font-size: 180%;
|
48
|
-
}
|
49
|
-
|
50
|
-
h3 {
|
51
|
-
font-size: 120%;
|
52
|
-
border-left: 1em solid;
|
53
|
-
padding-left: 0.5em;
|
54
|
-
}
|
55
|
-
|
56
|
-
h4 {
|
57
|
-
font-size: 110%;
|
58
|
-
}
|
59
|
-
|
60
|
-
h5 {
|
61
|
-
font-variant: small-caps;
|
62
|
-
}
|
63
|
-
|
64
|
-
h6 {
|
65
|
-
font-style: italic;
|
66
|
-
}
|
67
|
-
|
68
|
-
input, textarea, button, select {
|
69
|
-
font: 12px/1.2em "Helvetica Neue Condensed Bold", Verdana, sans-serif;
|
70
|
-
padding: 1px;
|
71
|
-
border: 1px solid #CDCABD;
|
72
|
-
background: #E5E1D2;
|
73
|
-
color: #3a3a2b;
|
74
|
-
}
|
75
|
-
textarea {
|
76
|
-
width: 100%;
|
77
|
-
}
|
78
|
-
textarea.code {
|
79
|
-
font: 12px/1.2em "Vera Sans Mono", monospace;
|
80
|
-
}
|
81
|
-
|
82
|
-
input:focus, textarea:focus, select:focus, button:focus {
|
83
|
-
background: #AED5E3;
|
84
|
-
border: 1px solid #6894B4;
|
85
|
-
}
|
86
|
-
|
87
|
-
input[type=submit], input[type=reset], button {
|
88
|
-
cursor: pointer;
|
89
|
-
}
|
90
|
-
|
91
|
-
input[type=submit]:hover, input[type=reset]:hover, button:hover {
|
92
|
-
|
93
|
-
}
|
94
|
-
|
95
|
-
button {
|
96
|
-
font-size: 1.1em;
|
97
|
-
padding: 0.2em 1em;
|
98
|
-
-webkit-border-radius: 5px;
|
99
|
-
-moz-border-radius: 5px;
|
100
|
-
border-color: #918474;
|
101
|
-
-webkit-box-shadow: 1px 1px 2px rgba(35,35,35,0.4);
|
102
|
-
box-shadow: 1px 1px 2px #333;
|
103
|
-
}
|
104
|
-
|
105
|
-
form {
|
106
|
-
margin: 0 auto;
|
107
|
-
background: #FAF8F1;
|
108
|
-
border: none;
|
109
|
-
padding: 0.4em 1em;
|
110
|
-
-webkit-border-radius: 5px;
|
111
|
-
-moz-border-radius: 5px;
|
112
|
-
-webkit-box-shadow: 1px 1px 5px rgba(55,55,55,0.4);
|
113
|
-
-moz-box-shadow: 1px 1px 5px 2px #999;
|
114
|
-
}
|
115
|
-
|
116
|
-
fieldset {
|
117
|
-
margin: 0.2em auto;
|
118
|
-
border: none;
|
119
|
-
}
|
120
|
-
|
121
|
-
legend {
|
122
|
-
font-weight: bold;
|
123
|
-
color: #616253;
|
124
|
-
font-size: 140%;
|
125
|
-
}
|
126
|
-
|
127
|
-
fieldset.nodisplay {
|
128
|
-
border: 0;
|
129
|
-
margin: 0;
|
130
|
-
background: inherit;
|
131
|
-
-webkit-box-shadow: none;
|
132
|
-
}
|
133
|
-
|
134
|
-
fieldset.nodisplay legend {
|
135
|
-
display: none;
|
136
|
-
}
|
137
|
-
|
138
|
-
a {
|
139
|
-
color: #3f6217;
|
140
|
-
font-weight: bold;
|
141
|
-
text-decoration: none;
|
142
|
-
border-bottom: 1px dotted;
|
143
|
-
}
|
144
|
-
|
145
|
-
th a {
|
146
|
-
color: inherit;
|
147
|
-
}
|
148
|
-
|
149
|
-
a:visited {
|
150
|
-
color: #3a3a2b;
|
151
|
-
}
|
152
|
-
|
153
|
-
a:hover {
|
154
|
-
border-bottom: 1px solid;
|
155
|
-
}
|
156
|
-
|
157
|
-
a:hover img {
|
158
|
-
border: 0;
|
159
|
-
}
|
160
|
-
|
161
|
-
ul {
|
162
|
-
padding-left: 25px;
|
163
|
-
}
|
164
|
-
|
165
|
-
ul li {
|
166
|
-
padding-left: 0;
|
167
|
-
margin-left: 0;
|
168
|
-
}
|
169
|
-
|
170
|
-
img {
|
171
|
-
border: 0;
|
172
|
-
}
|
173
|
-
|
174
|
-
table caption {
|
175
|
-
margin: 15px 5px 0;
|
176
|
-
font-size: 10px;
|
177
|
-
padding: 5px 0 2px;
|
178
|
-
}
|
179
|
-
|
180
|
-
table {
|
181
|
-
border-collapse: collapse;
|
182
|
-
margin: 1em 0;
|
183
|
-
-webkit-box-shadow: 1px 1px 5px rgba(25,25,25,0.7);
|
184
|
-
box-shadow: 1px 1px 5px #333;
|
185
|
-
}
|
186
|
-
table thead,
|
187
|
-
table tbody {
|
188
|
-
border: 1px solid #c1c1c1;
|
189
|
-
}
|
190
|
-
table th {
|
191
|
-
vertical-align: bottom;
|
192
|
-
text-align: center;
|
193
|
-
}
|
194
|
-
table.horizontal tbody th {
|
195
|
-
vertical-align: top;
|
196
|
-
text-align: right;
|
197
|
-
}
|
198
|
-
table td {
|
199
|
-
padding: 2px 0.5em;
|
200
|
-
vertical-align: top;
|
201
|
-
}
|
202
|
-
table td.numeric {
|
203
|
-
text-align: right;
|
204
|
-
}
|
205
|
-
table td.icon {
|
206
|
-
vertical-align: top;
|
207
|
-
text-align: center;
|
208
|
-
}
|
209
|
-
table td.icon img {
|
210
|
-
margin: 0 auto;
|
211
|
-
}
|
212
|
-
|
213
|
-
table th {
|
214
|
-
padding: 1px 0.5em;
|
215
|
-
}
|
216
|
-
table th.odd {
|
217
|
-
background-color: #f6f6f6;
|
218
|
-
}
|
219
|
-
table th.even {
|
220
|
-
background-color: #e5e5e5;
|
221
|
-
}
|
222
|
-
|
223
|
-
table tr.odd {
|
224
|
-
background-color: #f6ecbf;
|
225
|
-
}
|
226
|
-
table tr.odd td.even {
|
227
|
-
background-color: #e6ddb2;
|
228
|
-
}
|
229
|
-
table tr.even {
|
230
|
-
background-color: #decda8;
|
231
|
-
}
|
232
|
-
table tr.even td.even {
|
233
|
-
background-color: #c8b897;
|
234
|
-
}
|
235
|
-
|
236
|
-
dl {
|
237
|
-
|
238
|
-
}
|
239
|
-
|
240
|
-
dt {
|
241
|
-
font-weight: bold;
|
242
|
-
border-bottom: 1px solid #999;
|
243
|
-
color: #3f6217;
|
244
|
-
}
|
245
|
-
|
246
|
-
dt a {
|
247
|
-
border: none;
|
248
|
-
color: inherit;
|
249
|
-
}
|
250
|
-
|
251
|
-
dd {
|
252
|
-
margin: 0;
|
253
|
-
}
|
254
|
-
|
255
|
-
dd + dt {
|
256
|
-
margin-top: 1em;
|
257
|
-
}
|
258
|
-
|
259
|
-
p code, li code, dd code {
|
260
|
-
color: #333;
|
261
|
-
background-color: #e4e0d2;
|
262
|
-
border: 1px dotted #acaa92;
|
263
|
-
}
|
264
|
-
|
265
|
-
pre code {
|
266
|
-
color: inherit;
|
267
|
-
background-color: transparent;
|
268
|
-
border: none;
|
269
|
-
}
|
270
|
-
|
271
|
-
/* @end */
|
272
|
-
|
273
|
-
/* @group IDed page elements */
|
274
|
-
|
275
|
-
#content {
|
276
|
-
position: relative;
|
277
|
-
z-index: 0;
|
278
|
-
padding: 4em;
|
279
|
-
}
|
280
|
-
|
281
|
-
#homelink {
|
282
|
-
position: absolute;
|
283
|
-
top: 4em;
|
284
|
-
right: 4em;
|
285
|
-
}
|
286
|
-
|
287
|
-
#footer {
|
288
|
-
font-size: 0.8em;
|
289
|
-
background: url(../images/shadows/large-30-down.png) repeat-x 0 bottom;
|
290
|
-
margin: 0;
|
291
|
-
padding: 3em 2em 1em;
|
292
|
-
}
|
293
|
-
|
294
|
-
#footer p {
|
295
|
-
margin: 0;
|
296
|
-
}
|
297
|
-
|
298
|
-
table#connection-list {
|
299
|
-
font-size: 0.9em;
|
300
|
-
}
|
301
|
-
|
302
|
-
/* @end */
|
303
|
-
|
304
|
-
|
305
|
-
/* @group classed page elements */
|
306
|
-
|
307
|
-
.dn, .oid, .uri, .socket {
|
308
|
-
padding-left: 18px;
|
309
|
-
padding-right: 0.2em;
|
310
|
-
background-color: #e8d9b7;
|
311
|
-
border: 1px solid #a38e2b;
|
312
|
-
-webkit-border-radius: 5px;
|
313
|
-
}
|
314
|
-
.dn {
|
315
|
-
background: url(../images/chain_small.png) no-repeat 2px;
|
316
|
-
}
|
317
|
-
.oid {
|
318
|
-
background: url(../images/card_small.png) no-repeat 2px;
|
319
|
-
}
|
320
|
-
.uri {
|
321
|
-
background: url(../images/globe_small_green.png) no-repeat 2px;
|
322
|
-
}
|
323
|
-
.socket {
|
324
|
-
padding-left: 22px;
|
325
|
-
background: url(../images/plug.png) no-repeat 4px;
|
326
|
-
}
|
327
|
-
|
328
|
-
/* @end */
|