ambitious-activeldap 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +18 -0
- data/Manifest +4 -1
- data/README +48 -0
- data/ambitious-activeldap.gemspec +21 -14
- data/lib/ambition/adapters/active_ldap.rb +8 -0
- data/lib/ambition/adapters/active_ldap/query.rb +5 -7
- data/test/helper.rb +1 -0
- metadata +62 -52
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright (c) 2007 Chris Wanstrath & Matthew King
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
lib/ambition/adapters/active_ldap/base.rb
|
2
2
|
lib/ambition/adapters/active_ldap/query.rb
|
3
3
|
lib/ambition/adapters/active_ldap/select.rb
|
4
|
+
lib/ambition/adapters/active_ldap.rb
|
5
|
+
LICENSE
|
6
|
+
Manifest
|
7
|
+
README
|
4
8
|
test/enumerable_test.rb
|
5
9
|
test/helper.rb
|
6
10
|
test/integration_test.rb
|
7
11
|
test/select_test.rb
|
8
|
-
Manifest
|
data/README
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
h2. An Ambitious ActiveLdap Adapter
|
2
|
+
|
3
|
+
Write LDAP search filters in Ruby. Awesomeness courtesy of Chris Wanstrath's Ambition library.
|
4
|
+
|
5
|
+
You must be using ActiveLdap 0.9 or greater.
|
6
|
+
|
7
|
+
h2. Get It
|
8
|
+
|
9
|
+
@$ sudo gem install ambitious-activeldap@
|
10
|
+
|
11
|
+
|
12
|
+
<pre>
|
13
|
+
require 'rubygems'
|
14
|
+
require 'ambition/adapters/active_ldap'
|
15
|
+
</pre>
|
16
|
+
|
17
|
+
h2. Examples
|
18
|
+
|
19
|
+
Let @User@ be a subclass of @ActiveLdap::Base@
|
20
|
+
|
21
|
+
<ruby>
|
22
|
+
User.select { |u| u.givenName == 'Severian' }.each do |user|
|
23
|
+
puts user.name
|
24
|
+
end
|
25
|
+
</ruby>
|
26
|
+
|
27
|
+
Queries don't run until you kick them. This adapter supports only the basic kicker methods: @each@, @each_with_index@, @map@, @entries@, @to_a@.
|
28
|
+
|
29
|
+
This adapter also doesn't support the methods that require sorting, slicing, or counting, because ActiveLdap effectively doesn't support such things. ActiveLdap lets you _request_ sorted and sliced result sets, but it does the work in Ruby, so you might as well do it yourself.
|
30
|
+
|
31
|
+
You can call @to_s@, but not @to_hash@ on a query. @to_s@ returns the LDAP search filter as a string.
|
32
|
+
|
33
|
+
<ruby>
|
34
|
+
>> User.select { |m| m.givenName == 'Jonas' }.to_s
|
35
|
+
=> "(givenName=Jonas)"
|
36
|
+
</ruby>
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
h2. Issues.find(:all, :filter => "(type=bug)")
|
41
|
+
|
42
|
+
Bug me: "http://rubyforge.org/users/automatthew/":http://rubyforge.org/users/automatthew/
|
43
|
+
|
44
|
+
More information on Ambition:
|
45
|
+
|
46
|
+
* "http://ambition.rubyforge.org":http://ambition.rubyforge.org
|
47
|
+
* "http://groups.google.com/group/ambition-rb/":http://groups.google.com/group/ambition-rb/
|
48
|
+
|
@@ -1,21 +1,28 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Ambitious-activeldap-0.1.
|
2
|
+
# Gem::Specification for Ambitious-activeldap-0.1.1
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{ambitious-activeldap}
|
7
|
-
s.version = "0.1.
|
8
|
-
|
9
|
-
s.
|
10
|
-
|
11
|
-
s.
|
12
|
-
s.
|
7
|
+
s.version = "0.1.1"
|
8
|
+
|
9
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Matthew King"]
|
13
|
+
s.date = %q{2008-01-31}
|
13
14
|
s.description = %q{An ambitious adapter for ActiveLDAP}
|
15
|
+
s.email = %q{automatthew@gmail.com}
|
16
|
+
s.files = ["lib/ambition/adapters/active_ldap/base.rb", "lib/ambition/adapters/active_ldap/query.rb", "lib/ambition/adapters/active_ldap/select.rb", "lib/ambition/adapters/active_ldap.rb", "LICENSE", "Manifest", "README", "test/enumerable_test.rb", "test/helper.rb", "test/integration_test.rb", "test/select_test.rb", "ambitious-activeldap.gemspec"]
|
14
17
|
s.has_rdoc = true
|
15
|
-
s.
|
16
|
-
s.
|
18
|
+
s.homepage = %q{http://ambition.rubyforge.org/}
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.rubyforge_project = %q{ambition}
|
21
|
+
s.rubygems_version = %q{1.0.1}
|
22
|
+
s.summary = %q{An ambitious adapter for ActiveLDAP}
|
17
23
|
s.test_files = ["test/enumerable_test.rb", "test/integration_test.rb", "test/select_test.rb"]
|
18
|
-
|
24
|
+
|
25
|
+
s.add_dependency(%q<activeldap>, [">= 0.9"])
|
19
26
|
s.add_dependency(%q<ambition>, [">= 0.5.0"])
|
20
27
|
end
|
21
28
|
|
@@ -24,7 +31,7 @@ end
|
|
24
31
|
#
|
25
32
|
# require 'rake'
|
26
33
|
#
|
27
|
-
# Version = '0.1.
|
34
|
+
# Version = '0.1.1'
|
28
35
|
#
|
29
36
|
# begin
|
30
37
|
# require 'rubygems'
|
@@ -33,10 +40,10 @@ end
|
|
33
40
|
# require 'echoe'
|
34
41
|
#
|
35
42
|
# Echoe.new('ambitious-activeldap') do |p|
|
36
|
-
# p.dependencies << '
|
43
|
+
# p.dependencies << 'activeldap >=0.9'
|
37
44
|
# p.summary = "An ambitious adapter for ActiveLDAP"
|
38
|
-
# p.author = '
|
39
|
-
# p.email = "
|
45
|
+
# p.author = 'Matthew King'
|
46
|
+
# p.email = "automatthew@gmail.com"
|
40
47
|
#
|
41
48
|
# p.project = 'ambition'
|
42
49
|
# p.url = "http://ambition.rubyforge.org/"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'ambition'
|
2
|
+
require 'active_ldap'
|
3
|
+
require 'ambition/adapters/active_ldap/query'
|
4
|
+
require 'ambition/adapters/active_ldap/base'
|
5
|
+
require 'ambition/adapters/active_ldap/select'
|
6
|
+
|
7
|
+
ActiveLdap::Base.extend Ambition::API
|
8
|
+
ActiveLdap::Base.ambition_adapter = Ambition::Adapters::ActiveLdap
|
@@ -4,23 +4,21 @@ module Ambition
|
|
4
4
|
class Query
|
5
5
|
|
6
6
|
def kick
|
7
|
-
|
7
|
+
options = {}
|
8
|
+
string = to_s
|
9
|
+
options[:filter] = string unless string.empty?
|
10
|
+
owner.find(:all, options)
|
8
11
|
end
|
9
12
|
|
10
13
|
def size
|
11
14
|
raise "Not Implemented"
|
12
15
|
end
|
13
16
|
|
14
|
-
def to_hash
|
15
|
-
hash = {}
|
16
|
-
hash[:filter] = to_s unless to_s.empty?
|
17
|
-
hash
|
18
|
-
end
|
19
|
-
|
20
17
|
def to_s
|
21
18
|
Array(clauses[:select]).join
|
22
19
|
clauses[:select].first.to_s
|
23
20
|
end
|
21
|
+
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,73 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: ambitious-activeldap
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2008-01-29 00:00:00 -08:00
|
8
|
-
summary: An ambitious adapter for ActiveLDAP
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: chris@ozmm.org
|
12
|
-
homepage: http://ambition.rubyforge.org/
|
13
|
-
rubyforge_project: ambition
|
14
|
-
description: An ambitious adapter for ActiveLDAP
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.1.1
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
|
-
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- lib/ambition/adapters/active_ldap/select.rb
|
35
|
-
- test/enumerable_test.rb
|
36
|
-
- test/helper.rb
|
37
|
-
- test/integration_test.rb
|
38
|
-
- test/select_test.rb
|
39
|
-
- Manifest
|
40
|
-
- ambitious-activeldap.gemspec
|
41
|
-
test_files:
|
42
|
-
- test/enumerable_test.rb
|
43
|
-
- test/integration_test.rb
|
44
|
-
- test/select_test.rb
|
45
|
-
rdoc_options: []
|
46
|
-
|
47
|
-
extra_rdoc_files: []
|
48
|
-
|
49
|
-
executables: []
|
50
|
-
|
51
|
-
extensions: []
|
52
|
-
|
53
|
-
requirements: []
|
7
|
+
- Matthew King
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
54
11
|
|
12
|
+
date: 2008-01-31 00:00:00 -06:00
|
13
|
+
default_executable:
|
55
14
|
dependencies:
|
56
15
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
16
|
+
name: activeldap
|
58
17
|
version_requirement:
|
59
|
-
version_requirements: !ruby/object:Gem::
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
19
|
requirements:
|
61
20
|
- - ">="
|
62
21
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
22
|
+
version: "0.9"
|
64
23
|
version:
|
65
24
|
- !ruby/object:Gem::Dependency
|
66
25
|
name: ambition
|
67
26
|
version_requirement:
|
68
|
-
version_requirements: !ruby/object:Gem::
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
28
|
requirements:
|
70
29
|
- - ">="
|
71
30
|
- !ruby/object:Gem::Version
|
72
31
|
version: 0.5.0
|
73
32
|
version:
|
33
|
+
description: An ambitious adapter for ActiveLDAP
|
34
|
+
email: automatthew@gmail.com
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files: []
|
40
|
+
|
41
|
+
files:
|
42
|
+
- lib/ambition/adapters/active_ldap/base.rb
|
43
|
+
- lib/ambition/adapters/active_ldap/query.rb
|
44
|
+
- lib/ambition/adapters/active_ldap/select.rb
|
45
|
+
- lib/ambition/adapters/active_ldap.rb
|
46
|
+
- LICENSE
|
47
|
+
- Manifest
|
48
|
+
- README
|
49
|
+
- test/enumerable_test.rb
|
50
|
+
- test/helper.rb
|
51
|
+
- test/integration_test.rb
|
52
|
+
- test/select_test.rb
|
53
|
+
- ambitious-activeldap.gemspec
|
54
|
+
has_rdoc: true
|
55
|
+
homepage: http://ambition.rubyforge.org/
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project: ambition
|
76
|
+
rubygems_version: 1.0.1
|
77
|
+
signing_key:
|
78
|
+
specification_version: 2
|
79
|
+
summary: An ambitious adapter for ActiveLDAP
|
80
|
+
test_files:
|
81
|
+
- test/enumerable_test.rb
|
82
|
+
- test/integration_test.rb
|
83
|
+
- test/select_test.rb
|