[Ovirt-devel] [PATCH server] Updated active_ldap plugin to match current gem rpm

Jason Guiditta jguiditt at redhat.com
Tue Oct 7 20:05:03 UTC 2008


Signed-off-by: Jason Guiditta <jguiditt at redhat.com>
---
 .../scaffold_active_ldap/templates/ldap.yml        |   21 -----------
 src/vendor/plugins/active_ldap/init.rb             |   37 ++------------------
 2 files changed, 3 insertions(+), 55 deletions(-)
 delete mode 100644 src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/templates/ldap.yml

diff --git a/src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/templates/ldap.yml b/src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/templates/ldap.yml
deleted file mode 100644
index 720ec39..0000000
--- a/src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/templates/ldap.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-development:
-  host: 127.0.0.1
-  port: 389
-  base: dc=devel,dc=local,dc=net
-  bind_dn: cn=admin,dc=local,dc=net
-  password: secret
-
-test:
-  host: 127.0.0.1
-  port: 389
-  base: dc=test,dc=local,dc=net
-  bind_dn: cn=admin,dc=local,dc=net
-  password: secret
-
-production:
-  host: 127.0.0.1
-  port: 389
-  method: :tls
-  base: dc=production,dc=local,dc=net
-  bind_dn: cn=admin,dc=local,dc=net
-  password: secret
diff --git a/src/vendor/plugins/active_ldap/init.rb b/src/vendor/plugins/active_ldap/init.rb
index fa1484a..3b4291e 100644
--- a/src/vendor/plugins/active_ldap/init.rb
+++ b/src/vendor/plugins/active_ldap/init.rb
@@ -1,7 +1,7 @@
 require_library_or_gem 'active_ldap'
 ActiveLdap::Base.logger ||= RAILS_DEFAULT_LOGGER
 
-required_version = ["0", "10", "0"]
+required_version = ["1", "0", "0"]
 if (ActiveLdap::VERSION.split(".") <=> required_version) < 0
   ActiveLdap::Base.class_eval do
     format = _("You need ActiveLdap %s or later")
@@ -25,40 +25,9 @@ class ::ActionView::Base
   include ActiveLdap::Helper
 end
 
+require 'active_ldap/action_controller/ldap_benchmarking'
 module ::ActionController
-  module LdapBenchmarking
-    def self.included(base)
-      base.class_eval do
-        alias_method_chain :render, :active_ldap_benchmark
-        alias_method_chain :rendering_runtime, :active_ldap
-      end
-    end
-
-    protected
-    def render_with_active_ldap_benchmark(*args, &block)
-      if logger
-        @ldap_runtime_before_render = ActiveLdap::Base.reset_runtime
-        result = render_without_active_ldap_benchmark(*args, &block)
-        @ldap_runtime_after_render = ActiveLdap::Base.reset_runtime
-        @rendering_runtime -= @ldap_runtime_after_render
-        result
-      else
-        render_without_active_ldap_benchmark(*args, &block)
-      end
-    end
-
-    private
-    def rendering_runtime_with_active_ldap(runtime)
-      result = rendering_runtime_without_active_ldap(runtime)
-      ldap_runtime = ActiveLdap::Base.reset_runtime
-      ldap_runtime += @ldap_runtime_before_render || 0
-      ldap_runtime += @ldap_runtime_after_render || 0
-      ldap_percentage = ldap_runtime * 100 / runtime
-      result + (" | LDAP: %.5f (%d%%)" % [ldap_runtime, ldap_percentage])
-    end
-  end
-
   class Base
-    include LdapBenchmarking
+    include ActiveLdap::ActionController::LdapBenchmarking
   end
 end
-- 
1.5.5.1




More information about the ovirt-devel mailing list