treequel 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +5 -2970
- data/Rakefile +4 -1
- data/lib/treequel/branch.rb +6 -1
- data/lib/treequel/directory.rb +3 -2
- data/lib/treequel/model.rb +1 -1
- data/lib/treequel/monkeypatches.rb +21 -0
- data/lib/treequel.rb +3 -3
- data/spec/lib/helpers.rb +1 -0
- data/spec/lib/matchers.rb +1 -0
- data/spec/treequel/branch_spec.rb +337 -359
- data.tar.gz.sig +1 -0
- metadata +35 -5
- metadata.gz.sig +0 -0
data/Rakefile
CHANGED
@@ -15,6 +15,7 @@ hoespec = Hoe.spec 'treequel' do
|
|
15
15
|
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
16
16
|
self.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
|
17
17
|
|
18
|
+
|
18
19
|
self.extra_deps <<
|
19
20
|
['ruby-ldap', '~> 0.9.11']
|
20
21
|
self.extra_dev_deps <<
|
@@ -31,10 +32,12 @@ hoespec = Hoe.spec 'treequel' do
|
|
31
32
|
" - ruby-terminfo",
|
32
33
|
" - columnize",
|
33
34
|
].join( "\n" )
|
35
|
+
self.spec_extras[:signing_key] = '/Volumes/Keys/ged-private_gem_key.pem'
|
34
36
|
|
35
37
|
self.require_ruby_version( '>=1.8.7' )
|
36
38
|
|
37
|
-
self.
|
39
|
+
self.hg_sign_tags = true
|
40
|
+
|
38
41
|
self.yard_opts = [ '--use-cache', '--protected', '--verbose' ]
|
39
42
|
end
|
40
43
|
|
data/lib/treequel/branch.rb
CHANGED
@@ -54,6 +54,7 @@ class Treequel::Branch
|
|
54
54
|
### @return [Treequel::Branch] The new branch object.
|
55
55
|
def self::new_from_entry( entry, directory )
|
56
56
|
entry = Treequel::HashUtilities.stringify_keys( entry )
|
57
|
+
Treequel.logger.debug "Creating Branch from entry: %p in directory: %p" % [ entry, directory ]
|
57
58
|
return self.new( directory, entry['dn'].first, entry )
|
58
59
|
end
|
59
60
|
|
@@ -82,6 +83,8 @@ class Treequel::Branch
|
|
82
83
|
@values = {}
|
83
84
|
|
84
85
|
@include_operational_attrs = self.class.include_operational_attrs?
|
86
|
+
|
87
|
+
self.log.debug "New branch (%s): entry = %p, directory = %p" % [ @dn, @entry, @directory ]
|
85
88
|
end
|
86
89
|
|
87
90
|
|
@@ -109,6 +112,7 @@ class Treequel::Branch
|
|
109
112
|
predicate_attr :include_operational_attrs
|
110
113
|
alias_method :include_operational_attributes?, :include_operational_attrs?
|
111
114
|
|
115
|
+
|
112
116
|
### Change the DN the Branch uses to look up its entry.
|
113
117
|
###
|
114
118
|
### @param [String] newdn The new DN.
|
@@ -792,7 +796,7 @@ class Treequel::Branch
|
|
792
796
|
def get_converted_attribute( attrsym, object )
|
793
797
|
if attribute = self.directory.schema.attribute_types[ attrsym ]
|
794
798
|
self.log.debug "converting %p object to a %p attribute" %
|
795
|
-
[ attrsym, attribute.syntax.
|
799
|
+
[ attrsym, attribute.syntax.desc ]
|
796
800
|
return self.directory.convert_to_attribute( attribute.syntax.oid, object )
|
797
801
|
else
|
798
802
|
self.log.info "no attributeType for %p" % [ attrsym ]
|
@@ -804,6 +808,7 @@ class Treequel::Branch
|
|
804
808
|
### Clear any cached values when the structural state of the object changes.
|
805
809
|
### @return [void]
|
806
810
|
def clear_caches
|
811
|
+
self.log.debug "Clearing entry and values caches."
|
807
812
|
@entry = nil
|
808
813
|
@values.clear
|
809
814
|
end
|
data/lib/treequel/directory.rb
CHANGED
@@ -424,8 +424,9 @@ class Treequel::Directory
|
|
424
424
|
results = []
|
425
425
|
self.conn.search_ext2( base_dn, scope, filter, *parameters ).each do |entry|
|
426
426
|
branch = collectclass.new_from_entry( entry, self )
|
427
|
-
branch.include_operational_attrs =
|
428
|
-
base.respond_to?( :include_operational_attrs? )
|
427
|
+
branch.include_operational_attrs = true if
|
428
|
+
base.respond_to?( :include_operational_attrs? ) &&
|
429
|
+
base.include_operational_attrs?
|
429
430
|
|
430
431
|
if block_given?
|
431
432
|
results << yield( branch )
|
data/lib/treequel/model.rb
CHANGED
@@ -291,7 +291,7 @@ class Treequel::Model < Treequel::Branch
|
|
291
291
|
return lambda {|newvalue| self[attrname] = newvalue }
|
292
292
|
else
|
293
293
|
self.log.debug " attribute isn't SINGLE, so generating an array writer..."
|
294
|
-
return lambda {|*newvalues| self[attrname] = newvalues }
|
294
|
+
return lambda {|*newvalues| self[attrname] = newvalues.flatten }
|
295
295
|
end
|
296
296
|
end
|
297
297
|
|
@@ -26,6 +26,27 @@ class LDAP::Control
|
|
26
26
|
end
|
27
27
|
|
28
28
|
|
29
|
+
### Extensions to LDAP::Mods to make them grok ==.
|
30
|
+
module Treequel::LDAPModExtensions
|
31
|
+
|
32
|
+
### Returns +true+ if the +other+ LDAP::Record is equivalent to the receiver.
|
33
|
+
def ==( other )
|
34
|
+
return ( other.class == self.class ) &&
|
35
|
+
( self.mod_op == other.mod_op ) &&
|
36
|
+
( self.mod_type == other.mod_type ) &&
|
37
|
+
( self.mod_vals == other.mod_vals )
|
38
|
+
end
|
39
|
+
|
40
|
+
end # module Treequel::LDAPModExtensions
|
41
|
+
|
42
|
+
|
43
|
+
# Include Treequel-specific extensions as a mixin.
|
44
|
+
# @private
|
45
|
+
class LDAP::Mod
|
46
|
+
include Treequel::LDAPModExtensions
|
47
|
+
end
|
48
|
+
|
49
|
+
|
29
50
|
### Extensions to the Time class to add LDAP (RFC4517) Generalized Time syntax
|
30
51
|
module Treequel::TimeExtensions
|
31
52
|
|
data/lib/treequel.rb
CHANGED
@@ -25,7 +25,7 @@ end
|
|
25
25
|
|
26
26
|
# A library for interacting with LDAP modelled after Sequel.
|
27
27
|
#
|
28
|
-
# @version 1.2.
|
28
|
+
# @version 1.2.2
|
29
29
|
#
|
30
30
|
# @example
|
31
31
|
# # Connect to the directory at the specified URL
|
@@ -53,10 +53,10 @@ end
|
|
53
53
|
module Treequel
|
54
54
|
|
55
55
|
# Library version
|
56
|
-
VERSION = '1.2.
|
56
|
+
VERSION = '1.2.2'
|
57
57
|
|
58
58
|
# VCS revision
|
59
|
-
REVISION = %q$Revision:
|
59
|
+
REVISION = %q$Revision: 0c2883d2074a $
|
60
60
|
|
61
61
|
# Common paths for ldap.conf
|
62
62
|
COMMON_LDAP_CONF_PATHS = %w[
|
data/spec/lib/helpers.rb
CHANGED
@@ -99,6 +99,7 @@ module Treequel::SpecHelpers
|
|
99
99
|
def get_fixtured_directory( conn )
|
100
100
|
LDAP::SSLConn.stub( :new ).and_return( @conn )
|
101
101
|
conn.stub( :root_dse ).and_return( nil )
|
102
|
+
conn.stub( :set_option )
|
102
103
|
directory = Treequel.directory( TEST_LDAPURI )
|
103
104
|
directory.stub( :schema ).and_return( SCHEMA )
|
104
105
|
|