Permalink
Browse files

updated the gemspec

  • Loading branch information...
1 parent 3ffc713 commit e56dac752934a7f87a82a7b5406aa4178673143c @jcredding jcredding committed Aug 17, 2011
Showing with 9 additions and 32 deletions.
  1. +1 −23 README.markdown
  2. +8 −9 ad-ldap.gemspec
View
@@ -18,115 +18,93 @@ AD::LDAP is a small wrapper to the Net::LDAP library. Net::LDAP provides a nice
First, you need to configure the gem:
```ruby
-
AD::LDAP.configure do |config|
config.host = "127.0.0.1"
config.port = 389
config.base = "DC=mydomain, DC=com"
config.encrytion = :simple_tls
config.logger = Rails.logger
end
-
```
Then you can start running LDAP commands like you would with Net::LDAP.
```ruby
-
AD::LDAP.search({
:base => "DC=Users, DC=mydomain, DC=com",
:filter => "(name=collin)"
})
-
```
Most of the commands have the same syntax as they do in net-ldap:
```ruby
-
AD::LDAP.add({
:dn => "DN=collin, DC=Users, DC=mydomain, DC=com",
:attributes => { :givenname => "Collin", :lastname => "Redding" }
})
-
```
Some are slightly different though, the following:
```ruby
-
AD::LDAP.delete("DN=collin, DC=Users, DC=mydomain, DC=com")
-
```
is equivalent to:
```ruby
-
ldap = Net::LDAP.new
ldap.delete({ :dn => "DN=collin, DC=Users, DC=mydomain, DC=com })`
-
```
The biggest feature of AD::LDAP is some of the conventions when using the search method. If I don't provide a filter and have extra keys not supported by net-ldap's search, they are converted to filters automatically:
```ruby
-
AD::LDAP.search({ :name__eq => "collin" })
-
```
which can be simplified even further:
```ruby
-
AD::LDAP.search({ :name => "collin" })
-
```
Multiple filters are joined together (Net::LDAP::Filter.join) by default:
```ruby
-
AD::LDAP.search({ :name => "collin", :objectclass => "user" })
-
```
AD::LDAP won't get in your wa if you need to do something complex:
```ruby
-
name_filter = Net::LDAP::Filter.eq("name", "collin*")
class_filter = Net::LDAP::Filter.eq("objectclass", "user")
filters = name_filter | class_filter
AD::LDAP.search({ :filter => filters, :size => 1 })
-
```
Finally, because the LDAP names for most fields are not very ruby-ish (are all one word) it's sometimes convenient to setup mappings from a more ruby friendly name to a LDAP name:
```ruby
-
AD::LDAP.configure do |config|
# ...
config.mapppings = {
"login" => "samaccountname"
}
end
-
```
with the above config you can then search with the mapping:
```ruby
-
AD::LDAP.search({ :login => "jcredding" })
-
```
## License
-Copyright (c) 2011 Collin Redding, and Team Insight
+Copyright (c) 2011 Collin Redding and Team Insight
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
View
@@ -5,11 +5,10 @@ require "ad-ldap/version"
Gem::Specification.new do |s|
s.name = "ad-ldap"
s.version = AD::LDAP::VERSION
- s.authors = ["jcredding"]
- s.email = ["TempestTTU@gmail.com"]
- s.homepage = ""
- s.summary = %q{TODO: Write a gem summary}
- s.description = %q{TODO: Write a gem description}
+ s.authors = ["Collin Redding"]
+ s.homepage = "http://github.com/teaminsight/ad-ldap"
+ s.summary = %q{A small wrapper to Net::LDAP to provide some extended functionality and utility.}
+ s.description = %q{A small wrapper to Net::LDAP to provide some extended functionality and utility.}
s.rubyforge_project = "ad-ldap"
@@ -18,8 +17,8 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- # specify any dependencies here; for example:
- s.add_runtime_dependency "net-ldap"
-
- s.add_development_dependency "mocha"
+ s.add_runtime_dependency "net-ldap" "~>0.2.2"
+
+ s.add_development_dependency "assert" #TODO: lock the version of assert
+ s.add_development_dependency "mocha", "=0.9.12"
end

0 comments on commit e56dac7

Please sign in to comment.