ad-ldap 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.add_runtime_dependency "net-ldap", "~>0.2.2"
21
21
 
22
- s.add_development_dependency "assert" #TODO: lock the version of assert
23
- s.add_development_dependency "mocha", "=0.9.12"
22
+ s.add_development_dependency "assert", "=0.2.0"
23
+ s.add_development_dependency "mocha", "=0.9.12"
24
24
  end
@@ -80,7 +80,7 @@ module AD
80
80
  # Inspired by https://github.com/tpett/perry logger
81
81
  def run(method, *args)
82
82
  result, time = [ nil, -1 ]
83
- if self.config.run_commands
83
+ if self.config.run_commands || method == :search
84
84
  time = (Benchmark.measure do
85
85
  result = self.adapter.send(method, *args)
86
86
  end).real
@@ -13,11 +13,11 @@ module AD
13
13
  super({
14
14
  :host => self.config.host,
15
15
  :port => self.config.port,
16
- :base => self.config.base,
16
+ :base => self.config.treebase,
17
17
  :encryption => self.config.encryption
18
18
  })
19
19
  if self.config.auth
20
- self.auth(self.config.auth.username, self.config.auth.password)
20
+ self.auth(self.config.auth[:username], self.config.auth[:password])
21
21
  end
22
22
  end
23
23
 
@@ -1,6 +1,8 @@
1
- module AD::LDAP
1
+ module AD
2
+ module LDAP
2
3
 
3
- class Error < StandardError
4
- end
4
+ class Error < StandardError
5
+ end
5
6
 
7
+ end
6
8
  end
@@ -14,7 +14,7 @@ module AD
14
14
  color = "4;32;1"
15
15
  name = "%s (%.1fms)" % [ "LDAP", time ]
16
16
  message = self.generate_message(method, args)
17
- output = " \e[#{color}]#{name} #{message}\e[0m"
17
+ output = " \e[#{color}m#{name} #{message}\e[0m"
18
18
  if self.logger
19
19
  self.logger.debug(output)
20
20
  elsif !self.silent
@@ -20,6 +20,9 @@ module AD
20
20
  conditions[key.to_sym] = value
21
21
  end
22
22
  end
23
+ if !self[:base]
24
+ self[:base] = AD::LDAP.config.treebase
25
+ end
23
26
  if !self[:filter] && (filters = self.build_filters(conditions))
24
27
  self[:filter] = filters ? filters.to_s : nil
25
28
  end
@@ -1,5 +1,5 @@
1
1
  module AD
2
2
  module LDAP
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ class AD::LDAP::SearchArgs
5
5
  class BaseTest < Assert::Context
6
6
  desc "the AD::LDAP::SearchArgs class"
7
7
  setup do
8
+ AD::LDAP.config.treebase = @treebase = "DC=example, DC=com"
8
9
  @search_args = AD::LDAP::SearchArgs.new({})
9
10
  end
10
11
  subject{ @search_args }
@@ -12,6 +13,9 @@ class AD::LDAP::SearchArgs
12
13
  should "be a kind of Hash" do
13
14
  assert_kind_of Hash, subject
14
15
  end
16
+ should "set the base to the configured value for AD::LDAP" do
17
+ assert_equal @treebase, subject[:base]
18
+ end
15
19
  end
16
20
 
17
21
  class WithOnlyLDAPKeysTest < Assert::Context
@@ -75,7 +79,7 @@ class AD::LDAP::SearchArgs
75
79
  @original = { :dn => "something", :objectclass => "top" }
76
80
  first_filter = Net::LDAP::Filter.eq(:dn, @original[:dn])
77
81
  second_filter = Net::LDAP::Filter.eq(:objectclass, @original[:objectclass])
78
- @expected_filter = Net::LDAP::Filter.join(second_filter, first_filter)
82
+ @expected_filter = Net::LDAP::Filter.join(first_filter, second_filter)
79
83
  @search_args = AD::LDAP::SearchArgs.new(@original)
80
84
  end
81
85
  subject{ @search_args }
@@ -13,7 +13,7 @@ module AD::LDAP
13
13
  :search, :bind_as
14
14
  ].each do |method|
15
15
  should "respond to ##{method}" do
16
- assert_respond_to subject, method
16
+ assert_respond_to method, subject
17
17
  end
18
18
  end
19
19
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ad-ldap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
9
+ - 0
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Collin Redding
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-17 00:00:00 -05:00
18
+ date: 2011-08-19 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -40,12 +40,14 @@ dependencies:
40
40
  version_requirements: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ">="
43
+ - - "="
44
44
  - !ruby/object:Gem::Version
45
- hash: 3
45
+ hash: 23
46
46
  segments:
47
47
  - 0
48
- version: "0"
48
+ - 2
49
+ - 0
50
+ version: 0.2.0
49
51
  type: :development
50
52
  requirement: *id002
51
53
  - !ruby/object:Gem::Dependency