treequel 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,8 +1,87 @@
1
+ 2011-01-31 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * .hgtags:
4
+ Added tag v1.4.0 for changeset 9a29615cfb6d
5
+ [4826f3621e86] [master, tip]
6
+
7
+ * .hgsigs:
8
+ Added signature for changeset 63270598af6b
9
+ [9a29615cfb6d] [v1.4.0]
10
+
11
+ * History.md, lib/treequel.rb:
12
+ Bumped minor version and updated History file for release.
13
+ [63270598af6b]
14
+
15
+ * lib/treequel/constants.rb, lib/treequel/filter.rb,
16
+ spec/treequel/filter_spec.rb:
17
+ Escape filter metacharacters in simple filter components
18
+ [a4a5a436af47] [github/master]
19
+
20
+ * Rakefile, manual/resources/fonts/GraublauWeb.otf,
21
+ manual/resources/fonts/GraublauWebBold.otf,
22
+ manual/resources/fonts/Inconsolata.otf, manual/src/models.page:
23
+ More work on the 'Models' section of the manual.
24
+ [3029b8c183bf]
25
+
26
+ 2011-01-25 Michael Granger <ged@FaerieMUD.org>
27
+
28
+ * lib/treequel/branch.rb:
29
+ Fixed a bug in Treequel::Branch#copy.
30
+ [7ddaabd492e4]
31
+
32
+ * bin/treequel:
33
+ Adding reconnect support to the treequel shell
34
+ [f4a3b207966d]
35
+
36
+ * lib/treequel/directory.rb, spec/treequel/directory_spec.rb:
37
+ Added a new method: Treequel::Directory#connected?
38
+ [d2c1559a6f28]
39
+
40
+ * spec/treequel/mixins_spec.rb:
41
+ Cleaned up cruft in mixins spec
42
+ [7706be6b8c4c]
43
+
44
+ 2011-01-19 Michael Granger <ged@FaerieMUD.org>
45
+
46
+ * manual/layouts/default.page, manual/layouts/intro.page,
47
+ manual/resources/images/logo-small.png,
48
+ manual/resources/images/logo.png,
49
+ manual/resources/js/jquery-1.3.2.min.js,
50
+ manual/resources/js/jquery.ThickBox.js,
51
+ manual/resources/swf/clipboard.swf:
52
+ Merged with 411:ddbb3c3bdd00
53
+ [ba7895d4e64b]
54
+
1
55
  2011-01-18 Michael Granger <ged@FaerieMUD.org>
2
56
 
57
+ * manual/layouts/default.erb, manual/resources/css/manual.css,
58
+ manual/src/index.page:
59
+ Updating the manual.
60
+ [ddbb3c3bdd00]
61
+
62
+ * LICENSE:
63
+ I meant the README.md file. NOW update the LICENSE file
64
+ [a81be935c179]
65
+
66
+ * README.md:
67
+ Updating the copyright date in the LICENSE file
68
+ [04a457302e85]
69
+
70
+ * .hgtags:
71
+ Added tag v1.3.2 for changeset c6f3bdc3bb57
72
+ [4dc62eaea468]
73
+
74
+ * .hgsigs:
75
+ Added signature for changeset a545351e8cce
76
+ [c6f3bdc3bb57] [v1.3.2]
77
+
78
+ * lib/treequel.rb, lib/treequel/model.rb:
79
+ Bump patch version; simplify Treequel::Model#apply_applicable_mixins
80
+ [a545351e8cce]
81
+
3
82
  * Rakefile:
4
83
  Merged with 400:4caac8976d00
5
- [59944084d362] [github/master, master, tip]
84
+ [59944084d362]
6
85
 
7
86
  * lib/treequel/model.rb:
8
87
  Ensure the entry hash that's passed to
@@ -29,8 +108,18 @@
29
108
  Adding missing dependency
30
109
  [eaf742c5b836]
31
110
 
111
+ 2011-01-14 Michael Granger <ged@FaerieMUD.org>
112
+
113
+ * manual/src/models.page:
114
+ Fixed some invalid api links in the models section
115
+ [7759040905e0]
116
+
32
117
  2011-01-17 Michael Granger <ged@FaerieMUD.org>
33
118
 
119
+ * History.md:
120
+ Updated History
121
+ [9c4db65b40d7]
122
+
34
123
  * .hgtags:
35
124
  Added tag v1.3.1 for changeset a6ea030fc88f
36
125
  [4caac8976d00]
@@ -45,12 +134,6 @@
45
134
  attributes to sometimes be doubled.
46
135
  [fb7ec4e38f66]
47
136
 
48
- 2011-01-14 Michael Granger <ged@FaerieMUD.org>
49
-
50
- * manual/src/models.page:
51
- Fixed some invalid api links in the models section
52
- [7759040905e0]
53
-
54
137
  2011-01-13 Michael Granger <ged@FaerieMUD.org>
55
138
 
56
139
  * .hgtags:
@@ -145,14 +228,14 @@
145
228
  Automated merge with ssh://deveiate/Treequel
146
229
  [62e7348050eb]
147
230
 
148
- * bin/treequel, lib/treequel/model/objectclass.rb:
149
- Aesthetic cleanup
150
- [78e65cb8f30a]
151
-
152
231
  * bin/treequel:
153
232
  More logging constant fixes for the treequel shell.
154
233
  [6e159f32ed07]
155
234
 
235
+ * bin/treequel, lib/treequel/model/objectclass.rb:
236
+ Aesthetic cleanup
237
+ [78e65cb8f30a]
238
+
156
239
  2011-01-04 Michael Granger <ged@FaerieMUD.org>
157
240
 
158
241
  * bin/treequel:
@@ -564,6 +647,13 @@
564
647
  * Merging with 316:33a7dcde80a1
565
648
  [72dd41272f6f]
566
649
 
650
+ * .hgsubstate, lib/treequel/model.rb, spec/treequel/branch_spec.rb,
651
+ spec/treequel/model_spec.rb, spec/treequel/monkeypatches_spec.rb:
652
+ Spec fixes for RSpec 2.0
653
+ * Fix RSpec regex workaround for Treequel::Model#respond_to?
654
+ * Fix monkeypatch Time tests for running outside of PST8PDT
655
+ [9f9460125077]
656
+
567
657
  2010-11-09 Michael Granger <ged@FaerieMUD.org>
568
658
 
569
659
  * .hgsub, .hgsubstate:
@@ -574,17 +664,6 @@
574
664
  Fixing subrepo corruption caused by rollback
575
665
  [fc9ae9f5b034]
576
666
 
577
- 2010-11-11 Michael Granger <ged@FaerieMUD.org>
578
-
579
- * .hgsubstate, lib/treequel/model.rb, spec/treequel/branch_spec.rb,
580
- spec/treequel/model_spec.rb, spec/treequel/monkeypatches_spec.rb:
581
- Spec fixes for RSpec 2.0
582
- * Fix RSpec regex workaround for Treequel::Model#respond_to?
583
- * Fix monkeypatch Time tests for running outside of PST8PDT
584
- [9f9460125077]
585
-
586
- 2010-11-09 Michael Granger <ged@FaerieMUD.org>
587
-
588
667
  * README:
589
668
  Merged with 310:cc7c63ff15a0
590
669
  [c1b750e4e9fc]
@@ -600,18 +679,18 @@
600
679
  test failure
601
680
  [380662d385e0]
602
681
 
603
- 2010-11-08 Michael Granger <ged@FaerieMUD.org>
604
-
605
- * bin/treequel:
606
- Fixed treequel shell's cp to support relative and absolute DNs
607
- [7f20ab74d6b1]
608
-
609
682
  2010-11-03 Michael Granger <ged@FaerieMUD.org>
610
683
 
611
684
  * README, README.md:
612
685
  Converting the README to Markdown
613
686
  [cc7c63ff15a0]
614
687
 
688
+ 2010-11-08 Michael Granger <ged@FaerieMUD.org>
689
+
690
+ * bin/treequel:
691
+ Fixed treequel shell's cp to support relative and absolute DNs
692
+ [7f20ab74d6b1]
693
+
615
694
  2010-10-22 Michael Granger <ged@FaerieMUD.org>
616
695
 
617
696
  * lib/treequel/schema.rb, spec/lib/control_behavior.rb,
@@ -1283,12 +1362,6 @@
1283
1362
  * Re-sorted the OID constants to be in OID order
1284
1363
  [8b2fb7415412]
1285
1364
 
1286
- 2010-01-13 Michael Granger <ged@FaerieMUD.org>
1287
-
1288
- * bin/treequel:
1289
- Make treequel shell's 'cat' command error for non-existant entries
1290
- [84087b01d473]
1291
-
1292
1365
  2010-01-24 Michael Granger <ged@FaerieMUD.org>
1293
1366
 
1294
1367
  * bin/treequel:
@@ -1297,6 +1370,10 @@
1297
1370
 
1298
1371
  2010-01-13 Michael Granger <ged@FaerieMUD.org>
1299
1372
 
1373
+ * bin/treequel:
1374
+ Make treequel shell's 'cat' command error for non-existant entries
1375
+ [84087b01d473]
1376
+
1300
1377
  * bin/treequel:
1301
1378
  Fix the 'grep' command in the Treequel shell.
1302
1379
  [669a09149f48]
@@ -1327,6 +1404,19 @@
1327
1404
  Updated build system
1328
1405
  [00ac1bc4e917]
1329
1406
 
1407
+ 2009-12-22 Michael Granger <ged@FaerieMUD.org>
1408
+
1409
+ * bin/treequel:
1410
+ Reworked LDIF display colors in the shell to be more visible.
1411
+ [d77a0bf26034]
1412
+
1413
+ * bin/treequel:
1414
+ Make the treequel shell fall back to plain connect (with a warning)
1415
+ if TLS fails.
1416
+ [9aeccec1ee84]
1417
+
1418
+ 2010-01-07 Michael Granger <ged@FaerieMUD.org>
1419
+
1330
1420
  * bin/treequel, lib/treequel/branch.rb, lib/treequel/constants.rb,
1331
1421
  lib/treequel/utils.rb:
1332
1422
  Improvements to the treequel shell, fixes for 1.9.1.
@@ -1348,15 +1438,6 @@
1348
1438
 
1349
1439
  2009-12-22 Michael Granger <ged@FaerieMUD.org>
1350
1440
 
1351
- * bin/treequel:
1352
- Reworked LDIF display colors in the shell to be more visible.
1353
- [d77a0bf26034]
1354
-
1355
- * bin/treequel:
1356
- Make the treequel shell fall back to plain connect (with a warning)
1357
- if TLS fails.
1358
- [9aeccec1ee84]
1359
-
1360
1441
  * examples/ldap-monitor.rb, examples/ldap-
1361
1442
  monitor/public/css/master.css, examples/ldap-
1362
1443
  monitor/public/images/card_small.png, examples/ldap-
@@ -1377,6 +1458,27 @@
1377
1458
  Automated merge with ssh://hg@deveiate/Treequel
1378
1459
  [3bdd645530fe]
1379
1460
 
1461
+ 2009-12-18 Michael Granger <ged@FaerieMUD.org>
1462
+
1463
+ * Merged with 5fd4033e1556
1464
+ [9571c9d8e4dd]
1465
+
1466
+ 2009-12-17 Michael Granger <ged@FaerieMUD.org>
1467
+
1468
+ * docs/openldap-oids.txt, lib/treequel/constants.rb,
1469
+ lib/treequel/controls/contentsync.rb,
1470
+ lib/treequel/controls/persistentsearch.rb,
1471
+ lib/treequel/directory.rb:
1472
+ More controls work, started several more control modules.
1473
+ * Adding a breakdown of all the controls the OpenLDAP server I have
1474
+ has, so I know which controls I can test against.
1475
+ * Added some control constants.
1476
+ * Added the ContentSyncControl and the PersistentSearchControl.
1477
+ * Added a Directory#supported_controls method.
1478
+ [ffc2ebacdfd0]
1479
+
1480
+ 2009-12-22 Michael Granger <ged@FaerieMUD.org>
1481
+
1380
1482
  * bin/treequel, examples/ldap-monitor.rb, examples/ldap-
1381
1483
  monitor/public/css/master.css, examples/ldap-
1382
1484
  monitor/public/images/card_small.png, examples/ldap-
@@ -1405,25 +1507,6 @@
1405
1507
  * Bumped the version to 1.0.2.
1406
1508
  [31c326800cc6]
1407
1509
 
1408
- 2009-12-18 Michael Granger <ged@FaerieMUD.org>
1409
-
1410
- * Merged with 5fd4033e1556
1411
- [9571c9d8e4dd]
1412
-
1413
- 2009-12-17 Michael Granger <ged@FaerieMUD.org>
1414
-
1415
- * docs/openldap-oids.txt, lib/treequel/constants.rb,
1416
- lib/treequel/controls/contentsync.rb,
1417
- lib/treequel/controls/persistentsearch.rb,
1418
- lib/treequel/directory.rb:
1419
- More controls work, started several more control modules.
1420
- * Adding a breakdown of all the controls the OpenLDAP server I have
1421
- has, so I know which controls I can test against.
1422
- * Added some control constants.
1423
- * Added the ContentSyncControl and the PersistentSearchControl.
1424
- * Added a Directory#supported_controls method.
1425
- [ffc2ebacdfd0]
1426
-
1427
1510
  2009-12-16 Michael Granger <ged@FaerieMUD.org>
1428
1511
 
1429
1512
  * Rakefile, lib/treequel/mixins.rb, project.yml:
@@ -2518,16 +2601,6 @@
2518
2601
  Merged. Someday I'll get the hang of this.
2519
2602
  [a5e715f5f877]
2520
2603
 
2521
- 2009-07-29 Michael Granger <ged@FaerieMUD.org>
2522
-
2523
- * .hgignore, Rakefile, docs/manual/src/index.page,
2524
- lib/treequel/filter.rb, project.yml, spec/treequel/filter_spec.rb:
2525
- * Adding coverage cache to the ignorefile.
2526
- * Added ruby-ldap dependency. Yay!
2527
- * More work on the manual.
2528
- * Made Treequel::Branch#filter treat a Hash like an array of tuples.
2529
- [46e6dce0c011]
2530
-
2531
2604
  2009-07-28 Michael Granger <ged@FaerieMUD.org>
2532
2605
 
2533
2606
  * .hgignore, Rakefile:
@@ -2538,6 +2611,16 @@
2538
2611
  Manual rewording, .hgignore updates
2539
2612
  [89f74035c67d]
2540
2613
 
2614
+ 2009-07-29 Michael Granger <ged@FaerieMUD.org>
2615
+
2616
+ * .hgignore, Rakefile, docs/manual/src/index.page,
2617
+ lib/treequel/filter.rb, project.yml, spec/treequel/filter_spec.rb:
2618
+ * Adding coverage cache to the ignorefile.
2619
+ * Added ruby-ldap dependency. Yay!
2620
+ * More work on the manual.
2621
+ * Made Treequel::Branch#filter treat a Hash like an array of tuples.
2622
+ [46e6dce0c011]
2623
+
2541
2624
  2009-07-27 Michael Granger <ged@FaerieMUD.org>
2542
2625
 
2543
2626
  * .hgignore, Rakefile:
@@ -2549,10 +2632,6 @@
2549
2632
 
2550
2633
  2009-07-24 Michael Granger <ged@FaerieMUD.org>
2551
2634
 
2552
- * .hgsub, .hgsubstate:
2553
- Unlinking the subrepo, as it doesn't behave well enough quite yet.
2554
- [fc3c3bac2c22]
2555
-
2556
2635
  * .hgsub, .hgsubstate:
2557
2636
  Merging build system fixes
2558
2637
  [b7a919b2ad5d]
@@ -2565,6 +2644,10 @@
2565
2644
  Removing subrepo, as it doesn't work quite the way I'd hoped.
2566
2645
  [f631900a9ad8] <build-system-fixes>
2567
2646
 
2647
+ * .hgsub, .hgsubstate:
2648
+ Unlinking the subrepo, as it doesn't behave well enough quite yet.
2649
+ [fc3c3bac2c22]
2650
+
2568
2651
  * .hgignore, .hgsubstate, Rakefile, Rakefile.local, project.yml:
2569
2652
  Initial commit of Mercurial-based tasks
2570
2653
  [65236b2101e5] <build-system-fixes>
data/History.md CHANGED
@@ -1,3 +1,28 @@
1
+ ## 1.4.0 [2011-01-31] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Enhancements:
4
+
5
+ * Added a new method: Treequel::Directory#connected?
6
+ * Adding reconnect support to the treequel shell
7
+
8
+ Bugfixes:
9
+
10
+ * Fixed a bug in Treequel::Branch#copy.
11
+ * Escape filter metacharacters in simple filter components
12
+
13
+
14
+ ## 1.3.2
15
+
16
+ Bugfix:
17
+
18
+ * Ensure the entry hash that's passed to Treequel::Model#apply_applicable_mixins isn't modified; fixes a bug when modifying a new unsaved Model object.
19
+
20
+
21
+ ## 1.3.1 [2011-01-17] Michael Granger <ged@FaerieMUD.org>
22
+
23
+ Fixed a bug that caused DN attributes in objects created via Treequel::Model.new_from_entry to be doubled.
24
+
25
+
1
26
  ## 1.3.0 [2011-01-13] Michael Granger <ged@FaerieMUD.org>
2
27
 
3
28
  Enhancements:
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008-2010, Michael Granger and Mahlon E. Smith
1
+ Copyright (c) 2008-2011, Michael Granger and Mahlon E. Smith
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -47,7 +47,7 @@ You can submit bug reports, suggestions, and read more about future plans at
47
47
 
48
48
  ## License
49
49
 
50
- Copyright (c) 2008-2010, Michael Granger and Mahlon E. Smith
50
+ Copyright (c) 2008-2011, Michael Granger and Mahlon E. Smith
51
51
  All rights reserved.
52
52
 
53
53
  Redistribution and use in source and binary forms, with or without
data/Rakefile CHANGED
@@ -40,7 +40,7 @@ hoespec = Hoe.spec 'treequel' do
40
40
  " - columnize",
41
41
  " - sysexits",
42
42
  '',
43
- "You can install those automatically if you use the --development flag when",
43
+ "You can install them automatically if you use the --development flag when",
44
44
  "installing Treequel."
45
45
  ].join( "\n" )
46
46
  self.spec_extras[:signing_key] = '/Volumes/Keys/ged-private_gem_key.pem'
data/bin/treequel CHANGED
@@ -256,6 +256,13 @@ class Treequel::Shell
256
256
  self.save_history
257
257
 
258
258
  message "done."
259
+
260
+ rescue => err
261
+ error_message( err.class.name, err.message )
262
+ err.backtrace.each do |frame|
263
+ self.log.debug " " + frame
264
+ end
265
+
259
266
  ensure
260
267
  system( 'stty', @original_tty_settings.chomp )
261
268
  end
@@ -292,15 +299,28 @@ class Treequel::Shell
292
299
  else
293
300
  self.handle_missing_cmd( command )
294
301
  end
302
+ rescue LDAP::ResultError => err
303
+ case err.message
304
+ when /can't contact ldap server/i
305
+ if @dir.connected?
306
+ error_message( "LDAP connection went away." )
307
+ else
308
+ error_message( "Couldn't connect to the server." )
309
+ end
310
+ ask_for_confirmation( "Attempt to reconnect?" ) do
311
+ @dir.reconnect
312
+ end
313
+ retry
295
314
 
296
- rescue => err
297
- error_message( err.class.name, err.message )
298
- err.backtrace.each do |frame|
299
- self.log.debug " " + frame
315
+ when /invalid credentials/i
316
+ error_message( "Authentication failed." )
317
+ else
318
+ raise # Re-raise if it's something else
300
319
  end
301
320
  end
302
321
 
303
322
 
323
+
304
324
  #########
305
325
  protected
306
326
  #########
@@ -440,7 +440,7 @@ class Treequel::Branch
440
440
  self.log.debug "Creating a copy of %p at %p" % [ self.dn, newdn ]
441
441
  newbranch = self.class.new( self.directory, newdn )
442
442
 
443
- attributes = self.entry.merge( attributes )
443
+ attributes = self.entry.merge( stringify_keys(attributes) )
444
444
 
445
445
  self.log.debug " merged attributes: %p" % [ attributes ]
446
446
  self.directory.create( newbranch, attributes )
@@ -240,7 +240,7 @@ module Treequel::Constants
240
240
 
241
241
  ### These are inlined for simplicity
242
242
  # NULL = %x00 ; null (0)
243
- NULL = '\x00'
243
+ NUL = NULL = '\x00'
244
244
 
245
245
  # SPACE = %x20 ; space (" ")
246
246
  SPACE = '\x20'
@@ -588,6 +588,9 @@ module Treequel::Constants
588
588
  # escaped = ESC HEX HEX
589
589
  ESCAPED = %r{ #{ESC} [[:xdigit:]]{2} }x
590
590
 
591
+ # characters which must be escaped in filter values
592
+ UNESCAPED = %r{[#{NUL}#{LPAREN}#{RPAREN}#{ASTERISK}#{ESC}]}
593
+
591
594
  # valueencoding = 0*(normal / escaped)
592
595
  VALUEENCODING = %r{ (?:#{NORMAL} | #{ESCAPED})* }x
593
596
 
@@ -237,6 +237,15 @@ class Treequel::Directory
237
237
  end
238
238
 
239
239
 
240
+ ### Returns +true+ if a connection has been established. This does not necessarily mean
241
+ ### that the connection is still valid, it just means it successfully established one
242
+ ### at some point.
243
+ ### @return [Boolean]
244
+ def connected?
245
+ return @conn ? true : false
246
+ end
247
+
248
+
240
249
  ### Drop the existing connection and establish a new one.
241
250
  ### @return [Boolean] +true+ if the connection was re-established
242
251
  ### @raise [RuntimeError] if the re-connection failed
@@ -196,6 +196,7 @@ class Treequel::Filter
196
196
  ### greater = ">="
197
197
  ### less = "<="
198
198
  class SimpleItemComponent < Treequel::Filter::ItemComponent
199
+ include Treequel::Constants::Patterns
199
200
 
200
201
  # The valid values for +filtertype+ and the equivalent operator
201
202
  FILTERTYPE_OP = {
@@ -277,7 +278,12 @@ class Treequel::Filter
277
278
 
278
279
  ### Stringify the component
279
280
  def to_s
280
- return [ self.attribute, self.filtertype_op, self.value ].join
281
+ # Escape all the filter metacharacters
282
+ escaped_val = self.value.to_s.gsub( UNESCAPED ) do |char|
283
+ '\\' + char.unpack('C*').first.to_s(16)
284
+ end
285
+
286
+ return [ self.attribute, self.filtertype_op, escaped_val ].join
281
287
  end
282
288
 
283
289
  end # class SimpleItemComponent
@@ -330,7 +336,8 @@ class Treequel::Filter
330
336
  ### I N S T A N C E M E T H O D S
331
337
  #############################################################
332
338
 
333
- ### Create a new 'presence' item filter component for the given +attribute+.
339
+ ### Create a new 'substring' item filter component that will match the specified +pattern+
340
+ ### against the given +attribute+.
334
341
  def initialize( attribute, pattern, options=nil )
335
342
  @attribute = attribute
336
343
  @pattern = pattern
@@ -591,10 +598,16 @@ class Treequel::Filter
591
598
  attribute, value = *expression.args
592
599
 
593
600
  # Turn :sn.like( 'bob' ) into (cn~=bob) 'cause it has no asterisks
594
- if op == :like && value !~ /\*/
595
- Treequel.logger.debug \
596
- " turning a LIKE expression with no wildcards into an 'approx' filter"
597
- equivalent = :approx
601
+ if op == :like
602
+ if value.index( '*' )
603
+ Treequel.logger.debug \
604
+ " turning a LIKE expression with an asterisk into a substring filter"
605
+ return Treequel::Filter::SubstringItemComponent.new( attribute, value )
606
+ else
607
+ Treequel.logger.debug \
608
+ " turning a LIKE expression with no wildcards into an 'approx' filter"
609
+ equivalent = :approx
610
+ end
598
611
  end
599
612
 
600
613
  return Treequel::Filter::SimpleItemComponent.new( attribute, value, equivalent )
@@ -604,20 +617,17 @@ class Treequel::Filter
604
617
  return Treequel::Filter::NotComponent.new( contents )
605
618
 
606
619
  elsif op == :'not like'
607
- equivalent = nil
608
- attribute, value = *expression.args
609
620
  Treequel.logger.debug " making a NOT LIKE expression out of: %p" % [ expression ]
621
+ attribute, value = *expression.args
622
+ component = nil
610
623
 
611
- if value !~ /\*/
612
- Treequel.logger.debug \
613
- " turning a NOT LIKE expression with no wildcards into an 'approx' filter"
614
- equivalent = :approx
624
+ if value.index( '*' )
625
+ component = Treequel::Filter::SubstringItemComponent.new( attribute, value )
615
626
  else
616
- equivalent = :equal
627
+ component = Treequel::Filter::SimpleItemComponent.new( attribute, value, :approx )
617
628
  end
618
629
 
619
- comp = Treequel::Filter::SimpleItemComponent.new( attribute, value, equivalent )
620
- filter = Treequel::Filter.new( comp )
630
+ filter = Treequel::Filter.new( component )
621
631
  return Treequel::Filter::NotComponent.new( filter )
622
632
 
623
633
  elsif LOGICAL_COMPONENTS.key?( op )
data/lib/treequel.rb CHANGED
@@ -53,10 +53,10 @@ end
53
53
  module Treequel
54
54
 
55
55
  # Library version
56
- VERSION = '1.3.2'
56
+ VERSION = '1.4.0'
57
57
 
58
58
  # VCS revision
59
- REVISION = %q$Revision: a545351e8cce $
59
+ REVISION = %q$Revision: 63270598af6b $
60
60
 
61
61
  # Common paths for ldap.conf
62
62
  COMMON_LDAP_CONF_PATHS = %w[
@@ -351,6 +351,12 @@ describe Treequel::Directory do
351
351
  end
352
352
 
353
353
 
354
+ it "knows if a connection has been established" do
355
+ @dir.should be_connected()
356
+ @dir.instance_variable_set( :@conn, nil )
357
+ @dir.should_not be_connected()
358
+ end
359
+
354
360
  it "can reconnect if its underlying connection goes away" do
355
361
  @conn.stub( :search_ext2 ).and_raise( LDAP::ResultError.new("Can't contact LDAP server") )
356
362
 
@@ -70,6 +70,11 @@ describe Treequel::Filter do
70
70
  Treequel::Filter.new( :uid, 'bigthung' ).to_s.should == '(uid=bigthung)'
71
71
  end
72
72
 
73
+ it "escapes filter metacharacters in simple item equal filters" do
74
+ Treequel::Filter.new( :nisNetgroupTriple, '(blarney.acme.org,,)' ).to_s.
75
+ should == '(nisNetgroupTriple=\28blarney.acme.org,,\29)'
76
+ end
77
+
73
78
  it "parses a String+value hash as a simple item equal filter" do
74
79
  Treequel::Filter.new( 'uid' => 'bigthung' ).to_s.should == '(uid=bigthung)'
75
80
  end
@@ -29,7 +29,6 @@ include Treequel::Constants
29
29
  #####################################################################
30
30
 
31
31
  describe Treequel, "mixin" do
32
- include Treequel::SpecHelpers
33
32
 
34
33
  describe Treequel::Loggable, "mixed into a class" do
35
34
  before(:each) do
@@ -64,10 +63,6 @@ describe Treequel, "mixin" do
64
63
  end
65
64
  end
66
65
 
67
- #################################################################
68
- ### E X A M P L E S
69
- #################################################################
70
-
71
66
  describe Treequel::HashUtilities do
72
67
  it "includes a function for stringifying Hash keys" do
73
68
  testhash = {
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: treequel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 7
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 2
10
- version: 1.3.2
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Granger
@@ -36,7 +36,7 @@ cert_chain:
36
36
  cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-01-18 00:00:00 -08:00
39
+ date: 2011-01-31 00:00:00 -08:00
40
40
  default_executable:
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
@@ -72,35 +72,35 @@ dependencies:
72
72
  type: :runtime
73
73
  version_requirements: *id002
74
74
  - !ruby/object:Gem::Dependency
75
- name: hoe-mercurial
75
+ name: hoe-yard
76
76
  prerelease: false
77
77
  requirement: &id003 !ruby/object:Gem::Requirement
78
78
  none: false
79
79
  requirements:
80
- - - ~>
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  hash: 31
83
83
  segments:
84
+ - 0
84
85
  - 1
85
86
  - 2
86
- - 0
87
- version: 1.2.0
87
+ version: 0.1.2
88
88
  type: :development
89
89
  version_requirements: *id003
90
90
  - !ruby/object:Gem::Dependency
91
- name: hoe-yard
91
+ name: hoe-manualgen
92
92
  prerelease: false
93
93
  requirement: &id004 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
- - - ">="
96
+ - - ~>
97
97
  - !ruby/object:Gem::Version
98
- hash: 31
98
+ hash: 29
99
99
  segments:
100
100
  - 0
101
+ - 0
101
102
  - 1
102
- - 2
103
- version: 0.1.2
103
+ version: 0.0.1
104
104
  type: :development
105
105
  version_requirements: *id004
106
106
  - !ruby/object:Gem::Dependency
@@ -285,7 +285,7 @@ files:
285
285
  - spec/treequel/schema/table_spec.rb
286
286
  - spec/treequel/schema_spec.rb
287
287
  - spec/treequel_spec.rb
288
- has_rdoc: yard
288
+ has_rdoc: true
289
289
  homepage: http://deveiate.org/projects/Treequel
290
290
  licenses:
291
291
  - BSD
@@ -298,7 +298,7 @@ post_install_message: |-
298
298
  - columnize
299
299
  - sysexits
300
300
 
301
- You can install those automatically if you use the --development flag when
301
+ You can install them automatically if you use the --development flag when
302
302
  installing Treequel.
303
303
  rdoc_options:
304
304
  - --use-cache
@@ -331,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
331
  requirements: []
332
332
 
333
333
  rubyforge_project: treequel
334
- rubygems_version: 1.3.7
334
+ rubygems_version: 1.4.2
335
335
  signing_key:
336
336
  specification_version: 3
337
337
  summary: Treequel is an LDAP toolkit for Ruby
metadata.gz.sig CHANGED
Binary file