mit-ldap 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in mit-ldap.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2012 Eduardo Gutierrez
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
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, 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,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # mit-ldap
2
+
3
+ There were a few projects I was working on that required use of the MIT ldap
4
+ server. I extracted the dependency into this gem to make my life easier. This
5
+ is a name-spaced module that includes Ldaptic::Module.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,27 @@
1
+ require 'ldap'
2
+ require 'ldaptic'
3
+
4
+ module MIT
5
+ module LDAP
6
+ module Search
7
+ if MIT.on_campus_network?
8
+ include Ldaptic::Module(
9
+ host: 'ldap-too.mit.edu',
10
+ base: 'dc=mit,dc=edu',
11
+ adapter: :ldap_conn
12
+ )
13
+ else
14
+ class InetOrgPerson
15
+ end
16
+
17
+ def self.search(*args)
18
+ []
19
+ end
20
+
21
+ def self.find(*args)
22
+ InetOrgPerson.new
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ module MIT
2
+ module LDAP
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/lib/mit/ldap.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'mit/ldap/version'
2
+ require 'mit/ldap/search'
data/lib/mit-ldap.rb ADDED
@@ -0,0 +1,14 @@
1
+ module MIT
2
+
3
+ def self.on_campus_network?
4
+ !(hostname =~ /\.mit\.edu$/i).nil?
5
+ end
6
+
7
+ private
8
+
9
+ def self.hostname
10
+ @hostname ||= `hostname`
11
+ end
12
+ end
13
+
14
+ require 'mit/ldap'
data/mit-ldap.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mit/ldap/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "mit-ldap"
7
+ s.version = MIT::LDAP::VERSION
8
+ s.authors = ["Eduardo Gutierrez"]
9
+ s.email = ["edd_d@mit.edu"]
10
+ s.homepage = ""
11
+ s.summary = %q{Wrapper for MIT LDAP server}
12
+ s.description = %q{Configure Ldaptic to search MIT LDAP server}
13
+
14
+ s.rubyforge_project = "mit-ldap"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'ldaptic', '~> 0.2'
22
+ s.add_dependency 'ruby-ldap', '~> 0.9'
23
+
24
+ s.add_development_dependency "rspec", "~> 2.0"
25
+ end
@@ -0,0 +1,19 @@
1
+ require 'mit-ldap'
2
+
3
+ module MIT
4
+ module LDAP
5
+ describe Search do
6
+ if MIT.on_campus_network?
7
+ it "includes Ldaptic::Module" do
8
+ should respond_to :search
9
+ should respond_to :find
10
+ end
11
+ else
12
+ it "defines stubs that return empty arrays" do
13
+ Search.search.should eq []
14
+ Search.find.should be_instance_of Search::InetOrgPerson
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ require 'mit-ldap'
2
+
3
+ describe MIT do
4
+
5
+ describe ".on_campus_network?" do
6
+ it "confirms if we're on the campus network meaning we have a .mit.edu hostname" do
7
+
8
+ MIT.stub(:hostname).and_return('localhost')
9
+ MIT.on_campus_network?.should eq false
10
+
11
+ MIT.stub(:hostname).and_return('server.mit.edu')
12
+ MIT.on_campus_network?.should eq true
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mit-ldap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Eduardo Gutierrez
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ldaptic
16
+ requirement: &70209240826340 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70209240826340
25
+ - !ruby/object:Gem::Dependency
26
+ name: ruby-ldap
27
+ requirement: &70209240825840 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0.9'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70209240825840
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70209240825380 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70209240825380
47
+ description: Configure Ldaptic to search MIT LDAP server
48
+ email:
49
+ - edd_d@mit.edu
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - .rspec
56
+ - Gemfile
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ - lib/mit-ldap.rb
61
+ - lib/mit/ldap.rb
62
+ - lib/mit/ldap/search.rb
63
+ - lib/mit/ldap/version.rb
64
+ - mit-ldap.gemspec
65
+ - spec/lib/ldap/search_spec.rb
66
+ - spec/lib/mit_spec.rb
67
+ homepage: ''
68
+ licenses: []
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project: mit-ldap
87
+ rubygems_version: 1.8.11
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Wrapper for MIT LDAP server
91
+ test_files:
92
+ - spec/lib/ldap/search_spec.rb
93
+ - spec/lib/mit_spec.rb
94
+ has_rdoc: