adtools 0.0.1pre
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/.gitignore +4 -0
- data/Gemfile +3 -0
- data/License +2 -0
- data/Rakefile +3 -0
- data/Readme.rdoc +26 -0
- data/adtools.gemspec +21 -0
- data/lib/adtools.rb +112 -0
- data/lib/adtools/base.rb +584 -0
- data/lib/adtools/computer.rb +35 -0
- data/lib/adtools/config.rb +43 -0
- data/lib/adtools/container.rb +114 -0
- data/lib/adtools/field_type/binary.rb +39 -0
- data/lib/adtools/field_type/date.rb +39 -0
- data/lib/adtools/field_type/dn_array.rb +40 -0
- data/lib/adtools/field_type/group_dn_array.rb +40 -0
- data/lib/adtools/field_type/member_dn_array.rb +47 -0
- data/lib/adtools/field_type/password.rb +41 -0
- data/lib/adtools/field_type/timestamp.rb +45 -0
- data/lib/adtools/field_type/user_dn_array.rb +40 -0
- data/lib/adtools/group.rb +137 -0
- data/lib/adtools/member.rb +53 -0
- data/lib/adtools/ou.rb +11 -0
- data/lib/adtools/user.rb +152 -0
- data/lib/adtools/version.rb +3 -0
- data/spec/adtools_computer_spec.rb +15 -0
- data/spec/adtools_ou_spec.rb +15 -0
- data/spec/adtools_spec.rb +43 -0
- data/spec/spec_helper.rb +18 -0
- metadata +128 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Adtools::Computer do
|
|
4
|
+
it "should find all" do
|
|
5
|
+
standard_connection
|
|
6
|
+
|
|
7
|
+
Adtools::Computer.find(:all).should be_a Array
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should find a specific computer" do
|
|
11
|
+
standard_connection
|
|
12
|
+
|
|
13
|
+
#Adtools::Computer.find(:first, :name => test_value("computer", "name")).should be_a Adtools::Computer
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Adtools::Ou do
|
|
4
|
+
it "should find them all" do
|
|
5
|
+
standard_connection
|
|
6
|
+
|
|
7
|
+
Adtools::Ou.find(:all).should be_a Array
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should find a specific OU" do
|
|
11
|
+
standard_connection
|
|
12
|
+
|
|
13
|
+
# raise Adtools::Ou.find(:all).first.inspect
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Adtools do
|
|
4
|
+
it "should connect" do
|
|
5
|
+
settings = {
|
|
6
|
+
:host => test_value("domain", "host"),
|
|
7
|
+
:base => test_value("domain", "base"),
|
|
8
|
+
:port => test_value("domain", "port"),
|
|
9
|
+
:auth => {
|
|
10
|
+
:method => :simple,
|
|
11
|
+
:username => "#{test_value("domain", "query_user")}@#{test_value("domain","domain")}",
|
|
12
|
+
:password => test_value("domain", "query_password")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Adtools::Base.setup(settings)
|
|
17
|
+
|
|
18
|
+
Adtools::User.find(:all).should be_a Array
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should work with block config" do
|
|
22
|
+
Adtools.configure do |c|
|
|
23
|
+
c.domain = test_value("domain","domain")
|
|
24
|
+
c.base = test_value("domain", "base")
|
|
25
|
+
c.port = test_value("domain", "port")
|
|
26
|
+
c.server = test_value("domain", "host")
|
|
27
|
+
c.query_user = test_value("domain", "query_user")
|
|
28
|
+
c.query_password = test_value("domain", "query_password")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Adtools::User.find(:all).should be_a Array
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should assume values correctly" do
|
|
35
|
+
Adtools.configure do |c|
|
|
36
|
+
c.domain = "example.com"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
Adtools.config.port.should eq 389
|
|
40
|
+
Adtools.config.base.should eq "dc=example, dc=com"
|
|
41
|
+
Adtools.config.server.should eq "example.com"
|
|
42
|
+
end
|
|
43
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'lib/adtools' # Load the Gem
|
|
2
|
+
require 'yaml' # Load YAML (for test_values.yml)
|
|
3
|
+
|
|
4
|
+
def test_value(obj, val)
|
|
5
|
+
@yaml ||= YAML::load(File.open("spec/test_values.yml"))
|
|
6
|
+
@yaml[obj][val]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def standard_connection
|
|
10
|
+
Adtools.configure do |c|
|
|
11
|
+
c.domain = test_value("domain","domain")
|
|
12
|
+
c.base = test_value("domain", "base")
|
|
13
|
+
c.port = test_value("domain", "port")
|
|
14
|
+
c.server = test_value("domain", "host")
|
|
15
|
+
c.query_user = test_value("domain", "query_user")
|
|
16
|
+
c.query_password = test_value("domain", "query_password")
|
|
17
|
+
end
|
|
18
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: adtools
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 961915968
|
|
5
|
+
prerelease: 5
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 1
|
|
10
|
+
- pre
|
|
11
|
+
version: 0.0.1pre
|
|
12
|
+
platform: ruby
|
|
13
|
+
authors:
|
|
14
|
+
- Adam "Arcath" Laycock
|
|
15
|
+
autorequire:
|
|
16
|
+
bindir: bin
|
|
17
|
+
cert_chain: []
|
|
18
|
+
|
|
19
|
+
date: 2012-04-16 00:00:00 +01:00
|
|
20
|
+
default_executable:
|
|
21
|
+
dependencies:
|
|
22
|
+
- !ruby/object:Gem::Dependency
|
|
23
|
+
name: rspec
|
|
24
|
+
prerelease: false
|
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
26
|
+
none: false
|
|
27
|
+
requirements:
|
|
28
|
+
- - ">="
|
|
29
|
+
- !ruby/object:Gem::Version
|
|
30
|
+
hash: 3
|
|
31
|
+
segments:
|
|
32
|
+
- 0
|
|
33
|
+
version: "0"
|
|
34
|
+
type: :development
|
|
35
|
+
version_requirements: *id001
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: net-ldap
|
|
38
|
+
prerelease: false
|
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
40
|
+
none: false
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
hash: 3
|
|
45
|
+
segments:
|
|
46
|
+
- 0
|
|
47
|
+
version: "0"
|
|
48
|
+
type: :runtime
|
|
49
|
+
version_requirements: *id002
|
|
50
|
+
description:
|
|
51
|
+
email:
|
|
52
|
+
- gems@arcath.net
|
|
53
|
+
executables: []
|
|
54
|
+
|
|
55
|
+
extensions: []
|
|
56
|
+
|
|
57
|
+
extra_rdoc_files: []
|
|
58
|
+
|
|
59
|
+
files:
|
|
60
|
+
- .gitignore
|
|
61
|
+
- Gemfile
|
|
62
|
+
- License
|
|
63
|
+
- Rakefile
|
|
64
|
+
- Readme.rdoc
|
|
65
|
+
- adtools.gemspec
|
|
66
|
+
- lib/adtools.rb
|
|
67
|
+
- lib/adtools/base.rb
|
|
68
|
+
- lib/adtools/computer.rb
|
|
69
|
+
- lib/adtools/config.rb
|
|
70
|
+
- lib/adtools/container.rb
|
|
71
|
+
- lib/adtools/field_type/binary.rb
|
|
72
|
+
- lib/adtools/field_type/date.rb
|
|
73
|
+
- lib/adtools/field_type/dn_array.rb
|
|
74
|
+
- lib/adtools/field_type/group_dn_array.rb
|
|
75
|
+
- lib/adtools/field_type/member_dn_array.rb
|
|
76
|
+
- lib/adtools/field_type/password.rb
|
|
77
|
+
- lib/adtools/field_type/timestamp.rb
|
|
78
|
+
- lib/adtools/field_type/user_dn_array.rb
|
|
79
|
+
- lib/adtools/group.rb
|
|
80
|
+
- lib/adtools/member.rb
|
|
81
|
+
- lib/adtools/ou.rb
|
|
82
|
+
- lib/adtools/user.rb
|
|
83
|
+
- lib/adtools/version.rb
|
|
84
|
+
- spec/adtools_computer_spec.rb
|
|
85
|
+
- spec/adtools_ou_spec.rb
|
|
86
|
+
- spec/adtools_spec.rb
|
|
87
|
+
- spec/spec_helper.rb
|
|
88
|
+
has_rdoc: true
|
|
89
|
+
homepage: http://adtools.arcath.net
|
|
90
|
+
licenses: []
|
|
91
|
+
|
|
92
|
+
post_install_message:
|
|
93
|
+
rdoc_options: []
|
|
94
|
+
|
|
95
|
+
require_paths:
|
|
96
|
+
- lib
|
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
|
+
none: false
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
hash: 3
|
|
103
|
+
segments:
|
|
104
|
+
- 0
|
|
105
|
+
version: "0"
|
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
|
+
none: false
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">"
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
hash: 25
|
|
112
|
+
segments:
|
|
113
|
+
- 1
|
|
114
|
+
- 3
|
|
115
|
+
- 1
|
|
116
|
+
version: 1.3.1
|
|
117
|
+
requirements: []
|
|
118
|
+
|
|
119
|
+
rubyforge_project:
|
|
120
|
+
rubygems_version: 1.4.2
|
|
121
|
+
signing_key:
|
|
122
|
+
specification_version: 3
|
|
123
|
+
summary: Ruby bindings for Microsofts Active Directory (LDAP), a fork of ActiveDirectory
|
|
124
|
+
test_files:
|
|
125
|
+
- spec/adtools_computer_spec.rb
|
|
126
|
+
- spec/adtools_ou_spec.rb
|
|
127
|
+
- spec/adtools_spec.rb
|
|
128
|
+
- spec/spec_helper.rb
|