treequel 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/ChangeLog +354 -0
  2. data/LICENSE +27 -0
  3. data/README +66 -0
  4. data/Rakefile +345 -0
  5. data/Rakefile.local +43 -0
  6. data/bin/treeirb +14 -0
  7. data/bin/treequel +229 -0
  8. data/examples/company-directory.rb +112 -0
  9. data/examples/ldap-monitor.rb +143 -0
  10. data/examples/ldap-monitor/public/css/master.css +328 -0
  11. data/examples/ldap-monitor/public/images/card_small.png +0 -0
  12. data/examples/ldap-monitor/public/images/chain_small.png +0 -0
  13. data/examples/ldap-monitor/public/images/globe_small.png +0 -0
  14. data/examples/ldap-monitor/public/images/globe_small_green.png +0 -0
  15. data/examples/ldap-monitor/public/images/plug.png +0 -0
  16. data/examples/ldap-monitor/public/images/shadows/large-30-down.png +0 -0
  17. data/examples/ldap-monitor/public/images/tick.png +0 -0
  18. data/examples/ldap-monitor/public/images/tick_circle.png +0 -0
  19. data/examples/ldap-monitor/public/images/treequel-favicon.png +0 -0
  20. data/examples/ldap-monitor/views/backends.erb +41 -0
  21. data/examples/ldap-monitor/views/connections.erb +74 -0
  22. data/examples/ldap-monitor/views/databases.erb +39 -0
  23. data/examples/ldap-monitor/views/dump_subsystem.erb +14 -0
  24. data/examples/ldap-monitor/views/index.erb +14 -0
  25. data/examples/ldap-monitor/views/layout.erb +35 -0
  26. data/examples/ldap-monitor/views/listeners.erb +30 -0
  27. data/examples/ldap_state.rb +62 -0
  28. data/lib/treequel.rb +145 -0
  29. data/lib/treequel/branch.rb +589 -0
  30. data/lib/treequel/branchcollection.rb +204 -0
  31. data/lib/treequel/branchset.rb +360 -0
  32. data/lib/treequel/constants.rb +604 -0
  33. data/lib/treequel/directory.rb +541 -0
  34. data/lib/treequel/exceptions.rb +32 -0
  35. data/lib/treequel/filter.rb +704 -0
  36. data/lib/treequel/mixins.rb +325 -0
  37. data/lib/treequel/schema.rb +245 -0
  38. data/lib/treequel/schema/attributetype.rb +252 -0
  39. data/lib/treequel/schema/ldapsyntax.rb +96 -0
  40. data/lib/treequel/schema/matchingrule.rb +124 -0
  41. data/lib/treequel/schema/matchingruleuse.rb +124 -0
  42. data/lib/treequel/schema/objectclass.rb +289 -0
  43. data/lib/treequel/sequel_integration.rb +26 -0
  44. data/lib/treequel/utils.rb +169 -0
  45. data/rake/191_compat.rb +26 -0
  46. data/rake/dependencies.rb +76 -0
  47. data/rake/helpers.rb +434 -0
  48. data/rake/hg.rb +261 -0
  49. data/rake/manual.rb +782 -0
  50. data/rake/packaging.rb +135 -0
  51. data/rake/publishing.rb +318 -0
  52. data/rake/rdoc.rb +30 -0
  53. data/rake/style.rb +62 -0
  54. data/rake/svn.rb +668 -0
  55. data/rake/testing.rb +187 -0
  56. data/rake/verifytask.rb +64 -0
  57. data/rake/win32.rb +190 -0
  58. data/spec/lib/constants.rb +93 -0
  59. data/spec/lib/helpers.rb +100 -0
  60. data/spec/treequel/branch_spec.rb +569 -0
  61. data/spec/treequel/branchcollection_spec.rb +213 -0
  62. data/spec/treequel/branchset_spec.rb +376 -0
  63. data/spec/treequel/directory_spec.rb +487 -0
  64. data/spec/treequel/filter_spec.rb +482 -0
  65. data/spec/treequel/mixins_spec.rb +330 -0
  66. data/spec/treequel/schema/attributetype_spec.rb +237 -0
  67. data/spec/treequel/schema/ldapsyntax_spec.rb +83 -0
  68. data/spec/treequel/schema/matchingrule_spec.rb +158 -0
  69. data/spec/treequel/schema/matchingruleuse_spec.rb +137 -0
  70. data/spec/treequel/schema/objectclass_spec.rb +262 -0
  71. data/spec/treequel/schema_spec.rb +118 -0
  72. data/spec/treequel/utils_spec.rb +49 -0
  73. data/spec/treequel_spec.rb +179 -0
  74. metadata +169 -0
@@ -0,0 +1,354 @@
1
+ 117[tip] e98fb34df0c0 2009-08-13 16:43 -0700 ged
2
+ Adding Branchset#to_hash
3
+
4
+ 116 e18bfe831135 2009-08-13 16:16 -0700 ged
5
+ Updated build system.
6
+
7
+ 115 a8927110eaa6 2009-08-13 15:57 -0700 ged
8
+ Fixed the display in the company directory example template.
9
+
10
+ 114 dddcad307b99 2009-08-13 15:53 -0700 ged
11
+ * Adding some more examples, updating the README.
12
+
13
+ 113 c8fc81f20772 2009-08-13 13:28 -0700 ged
14
+ Some cleanup and additions for release.
15
+
16
+ 112 e352bc86498a 2009-08-13 11:06 -0700 ged
17
+ Bumping version for release.
18
+
19
+ 111 73775f828f6b 2009-08-13 09:35 -0700 ged
20
+ Fixes for Ruby 1.9.1.
21
+
22
+ 110 af19a52bb21a 2009-08-13 07:38 -0700 ged
23
+ More work on the ldap-monitor example.
24
+
25
+ 109 809044df70bd 2009-08-12 10:04 -0700 ged
26
+ * Removing unused deveiate-theme stylesheet.
27
+
28
+ 108 633687b023c4 2009-08-12 08:02 -0700 ged
29
+ Committing CSS I forgot to commit with the last rev
30
+
31
+ 107 f9551821eced 2009-08-11 20:59 -0700 ged
32
+ * Added another real-world example and added a bit more work to the web monitor app.
33
+
34
+ 106 85dadbaf70a9 2009-08-11 08:54 -0700 ged
35
+ * Added my nascent LDAP web monitor sinatra app under examples/
36
+
37
+ 105 c8c4db6916f1 2009-08-10 23:53 -0700 ged
38
+ Stripped SVN constants and headers.
39
+
40
+ 104 3624f71a141d 2009-08-10 14:42 -0700 ged
41
+ * More manual work
42
+
43
+ 103 1b0eaa8f5a64 2009-08-10 08:11 -0700 ged
44
+ Fixes for the manual footer
45
+
46
+ 102 72833e18e4f8 2009-08-10 07:59 -0700 ged
47
+ * Removing Branch#order, since the client-library sort attribute and function don't do
48
+
49
+ 101 bacf91784530 2009-08-05 13:26 -0700 ged
50
+ * Manual headings have a bit more top-margin.
51
+
52
+ 100:99,98 b53d391399ce 2009-08-03 14:18 -0700 ged
53
+ Merged f9ac0e1fa95f
54
+
55
+ 99:97 afeff031274d 2009-08-03 14:17 -0700 ged
56
+ * Finished conversion of the manual to client-side syntax-highlighting instead of
57
+
58
+ 98 f9ac0e1fa95f 2009-08-03 08:41 -0700 ged
59
+ * Adding a prompt mode to the .irbrc for manual example generation.
60
+
61
+ 97 1ddf7d4212c7 2009-08-01 08:31 -0700 ged
62
+ * Added details about Branchset#filter, #scope, #limit, and #select
63
+
64
+ 96 6b5358420802 2009-07-31 08:29 -0700 ged
65
+ Updated build system
66
+
67
+ 95:94,92 a5e715f5f877 2009-07-31 08:13 -0700 ged
68
+ Merged. Someday I'll get the hang of this.
69
+
70
+ 94:93,91 395b7bf6f248 2009-07-28 06:11 -0700 ged
71
+ Merged with 34cc97817266
72
+
73
+ 93:89 89f74035c67d 2009-07-28 06:10 -0700 ged
74
+ Manual rewording, .hgignore updates
75
+
76
+ 92 46e6dce0c011 2009-07-29 13:28 -0700 ged
77
+ * Adding coverage cache to the ignorefile.
78
+
79
+ 91 34cc97817266 2009-07-27 12:06 -0700 ged
80
+ Updated build system
81
+
82
+ 90:86,89 daf0e44c41ac 2009-07-27 11:58 -0700 ged
83
+ Merging work from gont
84
+
85
+ 89:83,88 b7a919b2ad5d 2009-07-24 21:07 -0700 ged
86
+ Merging build system fixes
87
+
88
+ 88 620807d4c6d5 2009-07-24 21:05 -0700 ged
89
+ Updated build system
90
+
91
+ 87:85 f631900a9ad8 2009-07-24 19:33 -0700 ged
92
+ Removing subrepo, as it doesn't work quite the way I'd hoped.
93
+
94
+ 86:83 fc3c3bac2c22 2009-07-24 17:27 -0700 ged
95
+ Unlinking the subrepo, as it doesn't behave well enough quite yet.
96
+
97
+ 85 65236b2101e5 2009-07-24 11:22 -0700 ged
98
+ Initial commit of Mercurial-based tasks
99
+
100
+ 84 76e4c3cc308b 2009-07-23 08:51 -0700 ged
101
+ Started converting svn-specific helpers and tasks to vcs-agnostic ones
102
+
103
+ 83 8be8e94f829d 2009-07-21 18:10 -0700 ged
104
+ Adding experimental .hgsub for the rake tasklibs
105
+
106
+ 82 7bd626d9f0cd 2009-07-21 15:44 +0000 mahlon
107
+ Manual updates for Branches, Branchsets, and Directory.base.
108
+
109
+ 81 8ca3428f711e 2009-07-21 12:51 +0000 ged
110
+ * Treequel::Branch
111
+
112
+ 80 15bfd9785019 2009-07-21 00:16 +0000 ged
113
+ * Fixing Treequel::Branch#copy, which was mistakenly using a modrdn to copy.
114
+
115
+ 79 74b7a9bca977 2009-07-20 22:22 +0000 ged
116
+ * Treequel::Branch: Don't freeze non-Arrays in the cached attribute values hash.
117
+
118
+ 78 3e4105c3ebaa 2009-07-20 17:30 +0000 ged
119
+ * Made the Hash merge function a module_function instead of a constant
120
+
121
+ 77 7a62ac4c346b 2009-07-20 13:20 +0000 ged
122
+ * Added the ability to include operational attributes in Treequel::Branch at the
123
+
124
+ 76 206b077875e5 2009-07-19 18:36 +0000 ged
125
+ Adding missing wrap.png for the manual
126
+
127
+ 75 1505adefc436 2009-07-18 06:28 +0000 ged
128
+ * Make ObjectClass#sup return the corresponding ObjectClass instance.
129
+
130
+ 74 12ec14055953 2009-07-17 22:53 +0000 ged
131
+ Cleaned up the manual syntax-highlighting a bunch. Red logo!
132
+
133
+ 73 8c8193c00a6a 2009-07-17 17:59 +0000 ged
134
+ Use client-side highlighting instead of Ultraviolet.
135
+
136
+ 72 1e2391e73329 2009-07-17 15:40 +0000 mahlon
137
+ * Wrap branch rdn attributes in an array for easy mungin' and merging.
138
+
139
+ 71 96e0654c8652 2009-07-17 13:27 +0000 ged
140
+ * Manual work.
141
+
142
+ 70 3e2835dbe859 2009-07-17 05:14 +0000 ged
143
+ * Logo and other manual work
144
+
145
+ 69 cf1c7d481519 2009-07-17 03:00 +0000 ged
146
+ * Treequel::Branch
147
+
148
+ 68 bf47d67f76f1 2009-07-16 17:04 +0000 mahlon
149
+ * Wrap branch rdn attributes in an array for easy mungin' and merging.
150
+
151
+ 67 7d8dc70f5fe1 2009-07-15 15:50 +0000 ged
152
+ * Order attributes by their key when composing a multi-value RDN from a pair + a Hash for
153
+
154
+ 66 f21be0277b19 2009-07-15 00:41 +0000 ged
155
+ Adding logo
156
+
157
+ 65 e434f63779e5 2009-07-13 17:48 +0000 ged
158
+ * Updated build system
159
+
160
+ 64 f2b47be064b6 2009-07-08 17:38 +0000 ged
161
+ * A bit more hacking on the OHM experiment.
162
+
163
+ 63 57360b9b8143 2009-07-03 00:57 +0000 ged
164
+ * Treequel::Branch
165
+
166
+ 62 1c3bd5a2a4f0 2009-07-02 15:22 +0000 ged
167
+ * Adding experimental Arrow service that uses Treequel to return ou=People records.
168
+
169
+ 61 1853efa345e2 2009-06-30 15:31 +0000 ged
170
+ Removing the call to `Time.today` from the specs, as it requires the loading of 'time'.
171
+
172
+ 60 e5a2a960c89d 2009-06-30 15:08 +0000 ged
173
+ * Added Treequel::Branch#to_ufn
174
+
175
+ 59 9759280f111a 2009-06-29 17:00 +0000 ged
176
+ * Adding the beginnings of an experimental object-mapping (tree-based ORM analogue) for LDAP
177
+
178
+ 58 bc236240ca46 2009-06-27 00:43 +0000 ged
179
+ Updated HTML logger formatter to the latest.
180
+
181
+ 57 35d0872f8b7f 2009-06-25 18:49 +0000 ged
182
+ * Renamed Treequel::Branch#modify to #merge
183
+
184
+ 56 30445a043298 2009-06-24 14:15 +0000 ged
185
+ Fixed some LAIKA references in the manual.
186
+
187
+ 55 6cc39e6befdb 2009-06-23 19:34 +0000 ged
188
+ * Fixed docs on the binding arguments for Treequel::Directory#initialize.
189
+
190
+ 54 3a204e54603e 2009-06-23 14:57 +0000 ged
191
+ * Added delegation to the connection wrapper.
192
+
193
+ 53 6defed90cfcc 2009-06-22 17:09 +0000 ged
194
+ * Fixed RDoc headers.
195
+
196
+ 52 cdbb80f015b6 2009-06-18 18:45 +0000 ged
197
+ * Updated the build system.
198
+
199
+ 51 6da5c8ac1752 2009-06-18 15:29 +0000 ged
200
+ * Adding BranchCollection class.
201
+
202
+ 50 8713fc4b41a9 2009-06-17 18:42 +0000 ged
203
+ * Updated build system
204
+
205
+ 49 d33d81ff8327 2009-06-11 22:17 +0000 ged
206
+ Adding the beginnings of a manual.
207
+
208
+ 48 99d1553532f1 2009-06-11 22:11 +0000 ged
209
+ * Treequel::Branch:
210
+
211
+ 47 3cf7a6589f40 2009-06-11 03:51 +0000 ged
212
+ * Fetch the default baseDN from the directory's root DSE instead of just using
213
+
214
+ 46 decd99bd99e9 2009-06-09 22:54 +0000 ged
215
+ * Added Branch#to_ldif
216
+
217
+ 45 b27a2eb78d02 2009-06-08 17:53 +0000 ged
218
+ * Added datatype conversions for some of the default syntaxes to Directory.
219
+
220
+ 44 4c2477eb2a68 2009-06-04 03:55 +0000 ged
221
+ * Treequel::Branch
222
+
223
+ 43 b02d86bf9162 2009-06-02 15:42 +0000 ged
224
+ * Finished hooking up LDAPSyntax to AttributeType.
225
+
226
+ 42 7617a4b44fd9 2009-06-01 16:17 +0000 ged
227
+ * Finished implementation of matchingRuleUses and ldapSyntaxes.
228
+
229
+ 41 99fd606993ac 2009-06-01 14:27 +0000 ged
230
+ * Checkpoint commit of Treequel::Schema::LDAPSyntax class.
231
+
232
+ 40 3dd18fa1c7fc 2009-05-29 20:57 +0000 ged
233
+ * Adding Treequel::Schema::MatchingRule.
234
+
235
+ 39 cb93500e5d98 2009-05-29 15:28 +0000 ged
236
+ * Treequel::Branch -- Changed the 'value' and 'attribute' attributes to 'rdn_value' and
237
+
238
+ 38 fb415faaeddb 2009-05-29 02:49 +0000 ged
239
+ * Added custom #inspect methods for Schema and Directory.
240
+
241
+ 37 aaef0c5c4703 2009-05-23 21:44 +0000 ged
242
+ * Updated build system
243
+
244
+ 36 3132d19804a1 2009-05-20 19:08 +0000 ged
245
+ * Treequel::Branch
246
+
247
+ 35 e43f57f0f04c 2009-05-19 08:01 +0000 ged
248
+ Include the superior class's name in Treequel::Schema::ObjectClass#inspect output.
249
+
250
+ 34 3ebeec1eacf6 2009-05-19 00:13 +0000 ged
251
+ * Treequel::Branch
252
+
253
+ 33 c615693a11e0 2009-05-18 21:10 +0000 ged
254
+ * Finished up Treequel::Branch#[]=
255
+
256
+ 32 72cd36c693ca 2009-05-18 14:56 +0000 mahlon
257
+ * If a user/pass is supplied via the directory connect URI, bind immediately.
258
+
259
+ 31 a9bcbecb60f3 2009-05-16 00:03 +0000 ged
260
+ * Treequel::Branch
261
+
262
+ 30 72ccdbdccd8d 2009-05-15 16:52 +0000 ged
263
+ * Treequel::Branch:
264
+
265
+ 29 34bce6d3ec1a 2009-05-14 18:43 +0000 ged
266
+ * Finished the initial implementation of the Sequel::Schema::AttributeType class.
267
+
268
+ 28 3a222b303870 2009-05-13 16:38 +0000 ged
269
+ * Replaced the plain Treequel::Directory#schema method with the one that
270
+
271
+ 27 4946985217e9 2009-05-13 01:00 +0000 ged
272
+ * Renamed Treequel::Branch#attr_pair to #rdn.
273
+
274
+ 26 da533735fb9f 2009-05-12 14:22 +0000 ged
275
+ * Unified must/may oids into @must_oids and @may_oids to distinguish between them and
276
+
277
+ 25 44a3834ff324 2009-05-11 23:09 +0000 ged
278
+ * Added name, desc, kind, must, and may attribute normalization to
279
+
280
+ 24 1d9b831d1579 2009-05-11 16:49 +0000 ged
281
+ Checkpoint commit:
282
+
283
+ 23 9a1ba6888856 2009-05-11 13:21 +0000 ged
284
+ Checkpoint commit:
285
+
286
+ 22 fc25616368b8 2009-05-08 01:08 +0000 ged
287
+ More work on parsing objectClasses.
288
+
289
+ 21 2378ca43e383 2009-05-07 19:44 +0000 ged
290
+ Checkpoint commit -- converting schema regexps to match the BNF in RFC 4512 instead of the one from 2252.
291
+
292
+ 20 feedf3cfda8b 2009-04-29 16:59 +0000 ged
293
+ * Added more RFC2252 regexp patterns to constants.rb.
294
+
295
+ 19 f2fef4dea785 2009-04-24 17:03 +0000 ged
296
+ * Starting work on schema support.
297
+
298
+ 18 fa68642a4c6b 2009-04-22 16:21 +0000 ged
299
+ * Fixed .filter( :attribute => value )
300
+
301
+ 17 d009a339d2cd 2009-04-22 13:24 +0000 ged
302
+ * Started filter support for Sequel expressions
303
+
304
+ 16 cb0752ae5ce9 2009-04-21 01:57 +0000 ged
305
+ More filter work.
306
+
307
+ 15 53fef8079a4e 2009-04-20 16:32 +0000 ged
308
+ Finished up initial filter work.
309
+
310
+ 14 621dbbe99418 2009-04-18 08:05 +0000 ged
311
+ * Committing yesterday's work on substring filters before I fall asleep.
312
+
313
+ 13 b71338a3b66f 2009-04-16 16:31 +0000 ged
314
+ * Started work on substring item filter syntax and class.
315
+
316
+ 12 27d7a681eb00 2009-04-16 01:08 +0000 ged
317
+ Checkpoint of more filter work.
318
+
319
+ 11 53cf56feaad8 2009-04-15 15:41 +0000 ged
320
+ Committing this morning's work.
321
+
322
+ 10 ba1440c71f01 2009-04-13 20:15 +0000 ged
323
+ Checkpoint commit of this morning's work.
324
+
325
+ 9 e8fd5884c22f 2009-04-10 16:01 +0000 ged
326
+ Checkpoint commit.
327
+
328
+ 8 6924adc0feb2 2009-04-09 15:58 +0000 ged
329
+ Checkpoint commit.
330
+
331
+ 7 0c1438a9105a 2009-03-30 15:27 +0000 ged
332
+ Checkpoint commit.
333
+
334
+ 6 5f3f334406cf 2009-03-18 00:54 +0000 ged
335
+ * Finished Treequel::Branch.new_from_dn
336
+
337
+ 5 83d533b2987d 2009-03-10 16:49 +0000 ged
338
+ * Checkpoint of the morning's work.
339
+
340
+ 4 27b230b291a3 2009-03-10 05:10 +0000 ged
341
+ * Snapshot of today's work.
342
+
343
+ 3 f73835204ddc 2009-03-09 20:05 +0000 ged
344
+ * Committing the morning's work.
345
+
346
+ 2 7709b9520686 2009-03-09 13:44 +0000 ged
347
+ * Updated build system
348
+
349
+ 1 d8e78b6b4088 2009-03-07 04:37 +0000 ged
350
+ * Started an initial spike and installed build system.
351
+
352
+ 0 b21f833298d6 2008-12-05 19:28 +0000 ged
353
+ Creating repo
354
+
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2008-2009, Michael Granger and Mahlon E. Smith
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ * Neither the name of the author/s, nor the names of the project's
15
+ contributors may be used to endorse or promote products derived from this
16
+ software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README ADDED
@@ -0,0 +1,66 @@
1
+ = Treequel - an honest LDAP library
2
+
3
+ Treequel is an LDAP toolkit for Ruby. It is intended to allow quick, easy
4
+ access to LDAP directories in a manner consistent with LDAP's hierarchical,
5
+ free-form nature.
6
+
7
+ It's inspired by and modeled after Sequel (http://sequel.rubyforge.org/), a
8
+ kick-ass database library.
9
+
10
+
11
+ == Examples
12
+
13
+ Here are a few short examples to whet your appetite:
14
+
15
+ # Connect to the directory at the specified URL
16
+ dir = Treequel.directory( 'ldap://ldap.company.com/dc=company,dc=com' )
17
+
18
+ # Get a list of email addresses of every person in the directory (as
19
+ # long as people are under ou=people)
20
+ dir.ou( :people ).filter( :mail ).map( :mail ).flatten
21
+
22
+ # Get a list of all IP addresses for all hosts in any ou=hosts group
23
+ # in the whole directory:
24
+ dir.filter( :ou => :hosts ).collection.filter( :ipHostNumber ).
25
+ map( :ipHostNumber ).flatten
26
+
27
+ # Get all people in the directory in the form of a hash of names
28
+ # keyed by email addresses
29
+ dir.ou( :people ).filter( :mail ).to_hash( :mail, :cn )
30
+
31
+ More elaborate examples of real-world usage can be found in the examples/
32
+ directory in the distribution. You can also browse them in a web browser
33
+ via the project page:
34
+
35
+ http://deveiate.org/projects/Treequel/browser/examples
36
+
37
+
38
+ == Contributing
39
+
40
+ You can check out the current development source with Mercurial from the
41
+ following URL:
42
+
43
+ http://repo.deveiate.org/Treequel
44
+
45
+ You can submit bug reports, suggestions, and read more about future plans at
46
+ the project page:
47
+
48
+ http://deveiate.org/projects/Treequel
49
+
50
+
51
+ == License
52
+
53
+ See the included LICENSE file for licensing details.
54
+
55
+
56
+ == Authors
57
+
58
+ * Michael Granger
59
+ * Mahlon E. Smith
60
+
61
+
62
+ == Contributors
63
+
64
+ A special thanks to Ben Bleything, who was part of the initial brainstorm that
65
+ led to the creation of this library.
66
+
@@ -0,0 +1,345 @@
1
+ #!rake
2
+ #
3
+ # Treequel rakefile
4
+ #
5
+ # Based on various other Rakefiles, especially one by Ben Bleything
6
+ #
7
+ # Copyright (c) 2007-2009 The FaerieMUD Consortium
8
+ #
9
+ # Authors:
10
+ # * Michael Granger <ged@FaerieMUD.org>
11
+ # * Mahlon E. Smith <mahlon@martini.nu>
12
+ #
13
+
14
+ BEGIN {
15
+ require 'pathname'
16
+ basedir = Pathname.new( __FILE__ ).dirname
17
+
18
+ libdir = basedir + "lib"
19
+ extdir = basedir + "ext"
20
+
21
+ $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
22
+ $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
23
+ }
24
+
25
+ begin
26
+ require 'readline'
27
+ include Readline
28
+ rescue LoadError
29
+ # Fall back to a plain prompt
30
+ def readline( text )
31
+ $stderr.print( text.chomp )
32
+ return $stdin.gets
33
+ end
34
+ end
35
+
36
+ require 'rbconfig'
37
+ require 'rake'
38
+ require 'rake/testtask'
39
+ require 'rake/packagetask'
40
+ require 'rake/clean'
41
+ # require 'rake/191_compat.rb'
42
+
43
+ $dryrun = false
44
+
45
+ ### Config constants
46
+ BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
47
+ BINDIR = BASEDIR + 'bin'
48
+ LIBDIR = BASEDIR + 'lib'
49
+ EXTDIR = BASEDIR + 'ext'
50
+ DOCSDIR = BASEDIR + 'docs'
51
+ PKGDIR = BASEDIR + 'pkg'
52
+ DATADIR = BASEDIR + 'data'
53
+
54
+ MANUALDIR = DOCSDIR + 'manual'
55
+
56
+ PROJECT_NAME = 'Treequel'
57
+ PKG_NAME = PROJECT_NAME.downcase
58
+ PKG_SUMMARY = 'An honest LDAP library'
59
+
60
+ # Cruisecontrol stuff
61
+ CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
62
+ CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
63
+
64
+ VERSION_FILE = LIBDIR + 'treequel.rb'
65
+ if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
66
+ PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
67
+ elsif VERSION_FILE.exist?
68
+ PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
69
+ else
70
+ PKG_VERSION = '0.0.0'
71
+ end
72
+
73
+ PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
74
+ GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
75
+
76
+ # Universal VCS constants
77
+ DEFAULT_EDITOR = 'vi'
78
+ COMMIT_MSG_FILE = 'commit-msg.txt'
79
+ FILE_INDENT = " " * 12
80
+ LOG_INDENT = " " * 3
81
+
82
+ CHANGELOG = BASEDIR + 'ChangeLog'
83
+ EXTCONF = EXTDIR + 'extconf.rb'
84
+
85
+ ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
86
+
87
+ TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README LICENSE] )
88
+ BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
89
+ LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
90
+ EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
91
+ DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
92
+
93
+ SPECDIR = BASEDIR + 'spec'
94
+ SPECLIBDIR = SPECDIR + 'lib'
95
+ SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
96
+
97
+ TESTDIR = BASEDIR + 'tests'
98
+ TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
99
+
100
+ RAKE_TASKDIR = BASEDIR + 'rake'
101
+ RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
102
+ PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
103
+ PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
104
+
105
+ RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
106
+
107
+ LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
108
+
109
+ EXTRA_PKGFILES = Rake::FileList.new
110
+ EXTRA_PKGFILES.include( "#{BASEDIR}/examples/**/*.{rb,erb,css,png}" )
111
+
112
+ RELEASE_FILES = TEXT_FILES +
113
+ SPEC_FILES +
114
+ TEST_FILES +
115
+ BIN_FILES +
116
+ LIB_FILES +
117
+ EXT_FILES +
118
+ DATA_FILES +
119
+ RAKE_TASKLIBS +
120
+ EXTRA_PKGFILES
121
+
122
+
123
+ RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
124
+
125
+ COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
126
+ RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
127
+ RCOV_OPTS = [
128
+ '--exclude', RCOV_EXCLUDES,
129
+ '--xrefs',
130
+ '--save',
131
+ '--callsites',
132
+ #'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
133
+ ]
134
+
135
+
136
+ ### Load some task libraries that need to be loaded early
137
+ if !RAKE_TASKDIR.exist?
138
+ $stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
139
+ ans = readline( "for you? [y]" )
140
+ ans = 'y' if !ans.nil? && ans.empty?
141
+
142
+ if ans =~ /^y/i
143
+ $stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
144
+ system 'hg', 'clone', RAKE_TASKLIBS_URL, RAKE_TASKDIR
145
+ if ! $?.success?
146
+ fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
147
+ end
148
+ else
149
+ $stderr.puts "Then I'm afraid I can't continue. Best of luck."
150
+ fail "Rake tasklibs not present."
151
+ end
152
+
153
+ RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
154
+ end
155
+
156
+ require RAKE_TASKDIR + 'helpers.rb'
157
+
158
+ # Define some constants that depend on the 'svn' tasklib
159
+ if hg = which( 'hg' )
160
+ id = IO.read('|-') or exec hg, 'id', '-q'
161
+ PKG_BUILD = id.chomp
162
+ else
163
+ PKG_BUILD = 0
164
+ end
165
+ SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
166
+ SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
167
+
168
+ # Documentation constants
169
+ RDOCDIR = DOCSDIR + 'api'
170
+ RDOC_OPTIONS = [
171
+ '-w', '4',
172
+ '-HN',
173
+ '-i', '.',
174
+ '-m', 'README',
175
+ '-t', PKG_NAME,
176
+ '-W', 'http://deveiate.org/projects/Treequel/browser/'
177
+ ]
178
+
179
+ # Release constants
180
+ SMTP_HOST = 'mail.faeriemud.org'
181
+ SMTP_PORT = 465 # SMTP + SSL
182
+
183
+ # Project constants
184
+ PROJECT_HOST = 'deveiate'
185
+ PROJECT_PUBDIR = '/usr/local/www/public/code'
186
+ PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
187
+ PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
188
+ PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
189
+
190
+ # Rubyforge stuff
191
+ RUBYFORGE_GROUP = 'deveiate'
192
+ RUBYFORGE_PROJECT = 'treequel'
193
+
194
+ # Gem dependencies: gemname => version
195
+ DEPENDENCIES = {
196
+ 'ruby-ldap' => '>= 0.9.9',
197
+ }
198
+
199
+ # Developer Gem dependencies: gemname => version
200
+ DEVELOPMENT_DEPENDENCIES = {
201
+ 'rake' => '>= 0.8.7',
202
+ 'rcodetools' => '>= 0.7.0.0',
203
+ 'rcov' => '>= 0.8.1.2.0',
204
+ 'rdoc' => '>= 2.4.3',
205
+ 'RedCloth' => '>= 4.0.3',
206
+ 'rspec' => '>= 1.2.6',
207
+ 'rubyforge' => '>= 0',
208
+ 'termios' => '>= 0',
209
+ 'text-format' => '>= 1.0.0',
210
+ 'tmail' => '>= 1.2.3.1',
211
+ }
212
+
213
+ # Non-gem requirements: packagename => version
214
+ REQUIREMENTS = {
215
+ 'ldap' => '>=0',
216
+ }
217
+
218
+ # RubyGem specification
219
+ GEMSPEC = Gem::Specification.new do |gem|
220
+ gem.name = PKG_NAME.downcase
221
+ gem.version = PKG_VERSION
222
+
223
+ gem.summary = PKG_SUMMARY
224
+ gem.description = [
225
+ "A library for interacting with LDAP (modeled after Sequel). It is an attempt to remove",
226
+ "the impedence mismatch of trying to treat LDAP as if it's a relational database, and",
227
+ "instead embrace its hierarchical, free-form nature.",
228
+ ].join( "\n" )
229
+
230
+ gem.authors = "Michael Granger, Mahlon E. Smith"
231
+ gem.email = ["ged@FaerieMUD.org", "mahlon@martini.nu"]
232
+ gem.homepage = 'http://deveiate.org/projects/Treequel'
233
+ gem.rubyforge_project = RUBYFORGE_PROJECT
234
+
235
+ gem.has_rdoc = true
236
+ gem.rdoc_options = RDOC_OPTIONS
237
+ gem.extra_rdoc_files = %w[ChangeLog README LICENSE]
238
+
239
+ gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
240
+ gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
241
+ collect {|pn| File.basename(pn) }
242
+ gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
243
+
244
+ if EXTCONF.exist?
245
+ gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
246
+ end
247
+
248
+ gem.files = RELEASE_FILES
249
+ gem.test_files = SPEC_FILES
250
+
251
+ DEPENDENCIES.each do |name, version|
252
+ version = '>= 0' if version.length.zero?
253
+ gem.add_runtime_dependency( name, version )
254
+ end
255
+
256
+ # # Developmental dependencies don't work as of RubyGems 1.2.0
257
+ # unless Gem::Version.new( Gem::RubyGemsVersion ) <= Gem::Version.new( "1.2.0" )
258
+ # DEVELOPMENT_DEPENDENCIES.each do |name, version|
259
+ # version = '>= 0' if version.length.zero?
260
+ # gem.add_development_dependency( name, version )
261
+ # end
262
+ # end
263
+
264
+ REQUIREMENTS.each do |name, version|
265
+ gem.requirements << [ name, version ].compact.join(' ')
266
+ end
267
+ end
268
+
269
+ $trace = Rake.application.options.trace ? true : false
270
+ $dryrun = Rake.application.options.dryrun ? true : false
271
+
272
+
273
+ # Load any remaining task libraries
274
+ RAKE_TASKLIBS.each do |tasklib|
275
+ next if tasklib.to_s =~ %r{/helpers\.rb$}
276
+ begin
277
+ trace " loading tasklib %s" % [ tasklib ]
278
+ import tasklib
279
+ rescue ScriptError => err
280
+ fail "Task library '%s' failed to load: %s: %s" %
281
+ [ tasklib, err.class.name, err.message ]
282
+ trace "Backtrace: \n " + err.backtrace.join( "\n " )
283
+ rescue => err
284
+ log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
285
+ [ tasklib, err.class.name, err.message ]
286
+ trace "Backtrace: \n " + err.backtrace.join( "\n " )
287
+ end
288
+ end
289
+
290
+ # Load any project-specific rules defined in 'Rakefile.local' if it exists
291
+ import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
292
+
293
+
294
+ #####################################################################
295
+ ### T A S K S
296
+ #####################################################################
297
+
298
+ ### Default task
299
+ task :default => [:clean, :local, :spec, :rdoc, :package]
300
+
301
+ ### Task the local Rakefile can append to -- no-op by default
302
+ task :local
303
+
304
+
305
+ ### Task: clean
306
+ CLEAN.include 'coverage'
307
+ CLOBBER.include 'artifacts', 'coverage.info', PKGDIR
308
+
309
+ ### Task: changelog
310
+ file CHANGELOG do |task|
311
+ log "Updating #{task.name}"
312
+
313
+ changelog = make_changelog()
314
+ File.open( task.name, 'w' ) do |fh|
315
+ fh.print( changelog )
316
+ end
317
+ end
318
+
319
+
320
+ ### Task: cruise (Cruisecontrol task)
321
+ desc "Cruisecontrol build"
322
+ task :cruise => [:clean, 'spec:quiet', :package] do |task|
323
+ raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
324
+ artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
325
+ artifact_dir.mkpath
326
+
327
+ coverage = BASEDIR + 'coverage'
328
+ if coverage.exist? && coverage.directory?
329
+ $stderr.puts "Copying coverage stats..."
330
+ FileUtils.cp_r( 'coverage', artifact_dir )
331
+ end
332
+
333
+ $stderr.puts "Copying packages..."
334
+ FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
335
+ end
336
+
337
+
338
+ desc "Update the build system to the latest version"
339
+ task :update_build do
340
+ log "Updating the build system"
341
+ run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
342
+ log "Updating the Rakefile"
343
+ sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
344
+ end
345
+