[Ovirt-devel] [PATCH] rails 2.1: removing obsolete active_ldap plugin. use gem instead.

Scott Seago
2008-09-24T17:48:13Z

Signed-off-by: Scott Seago <sseago at redhat.com>
---
 src/vendor/plugins/active_ldap/README              |   54 ---------------
 .../active_ldap/generators/model_active_ldap/USAGE |   17 -----
 .../model_active_ldap_generator.rb                 |   70 --------------------
 .../model_active_ldap/templates/fixtures.yml       |   11 ---
 .../templates/model_active_ldap.rb                 |    3 -
 .../model_active_ldap/templates/unit_test.rb       |   10 ---
 .../scaffold_active_ldap_generator.rb              |    7 --
 .../scaffold_active_ldap/templates/ldap.yml        |   21 ------
 .../scaffold_al/scaffold_al_generator.rb           |   20 ------
 src/vendor/plugins/active_ldap/init.rb             |   64 ------------------
 10 files changed, 0 insertions(+), 277 deletions(-)
 delete mode 100644 src/vendor/plugins/active_ldap/README
 delete mode 100644
src/vendor/plugins/active_ldap/generators/model_active_ldap/USAGE
 delete mode 100644
src/vendor/plugins/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb
 delete mode 100644
src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/fixtures.yml
 delete mode 100644
src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/model_active_ldap.rb
 delete mode 100644
src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/unit_test.rb
 delete mode 100644
src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb
 delete mode 100644
src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/templates/ldap.yml
 delete mode 100644
src/vendor/plugins/active_ldap/generators/scaffold_al/scaffold_al_generator.rb
 delete mode 100644 src/vendor/plugins/active_ldap/init.rb

diff --git a/src/vendor/plugins/active_ldap/README
b/src/vendor/plugins/active_ldap/README
deleted file mode 100644
index 8e40086..0000000
--- a/src/vendor/plugins/active_ldap/README
+++ /dev/null
@@ -1,54 +0,0 @@
-= ActiveLdap plugin for Ruby on Rails
-
-== Setup
-
-You need to write RAILS_ROOT/config/ldap.yml like the following:
-
-  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
-    base: dc=production,dc=local,dc=net
-    bind_dn: cn=admin,dc=local,dc=net
-    password: secret
-
-== Model
-
-Here is some examples.
-
-app/model/member.rb:
-  class Member < ActiveLdap::Base
-    ldap_mapping :dn_attribute => 'uid',
-                  :classes => ['person', 'posixAccount']
-    belongs_to :primary_group, :class => "Group",
-               :foreign_key => "gidNumber", :primary_key =>
"gidNumber"
-    belongs_to :groups, :many => 'memberUid'
-  end
-
-app/model/group.rb:
-  class Group < ActiveLdap::Base
-    ldap_mapping :dn_attribute => "cn", :classes =>
['posixGroup']
-    has_many :members, :wrap => "memberUid"
-    has_many :primary_members,
-             :foreign_key => 'gidNumber',
-             :primary_key => 'gidNumber'
-  end
-
-app/model/ou.rb:
-  class Ou < ActiveLdap::Base
-    ldap_mapping :prefix => "",
-                 :classes => ["top",
"organizationalUnit"]
-  end
diff --git a/src/vendor/plugins/active_ldap/generators/model_active_ldap/USAGE
b/src/vendor/plugins/active_ldap/generators/model_active_ldap/USAGE
deleted file mode 100644
index a86c5dd..0000000
--- a/src/vendor/plugins/active_ldap/generators/model_active_ldap/USAGE
+++ /dev/null
@@ -1,17 +0,0 @@
-Description:
-    The model_activeldap generator creates stubs for a new model.
-
-    The generator takes a model name as its argument.  The model name may be
given in CamelCase or under_score and
-    should not be suffixed with 'Model'.
-
-    The generator creates a model class in app/models, a test suite in
test/unit, and test fixtures in
-    test/fixtures/singular_name.yml. It will not create a migration.
-
-Examples:
-    ./script/generate model_activeldap user
-
-        This will create a User model:
-            Model:      app/models/user.rb
-            Test:       test/unit/user_test.rb
-            Fixtures:   test/fixtures/users.yml
-
diff --git
a/src/vendor/plugins/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb
b/src/vendor/plugins/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb
deleted file mode 100644
index f8435a3..0000000
---
a/src/vendor/plugins/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-class ModelActiveLdapGenerator < Rails::Generator::NamedBase
-  include ActiveLdap::GetTextSupport
-
-  default_options :dn_attribute => "cn", :classes => nil
-
-  def manifest
-    record do |m|
-      # Check for class naming collisions.
-      m.class_collisions class_path, class_name, "#{class_name}Test"
-
-      # Model, test, and fixture directories.
-      m.directory File.join('app/models', class_path)
-      m.directory File.join('test/unit', class_path)
-      m.directory File.join('test/fixtures', class_path)
-
-      # Model class, unit test, and fixtures.
-      m.template('model_active_ldap.rb',
-                 File.join('app/models', class_path,
"#{file_name}.rb"),
-                 :assigns => {:ldap_mapping => ldap_mapping})
-      m.template('unit_test.rb',
-                 File.join('test/unit', class_path,
"#{file_name}_test.rb"))
-      m.template('fixtures.yml',
-                 File.join('test/fixtures', class_path,
"#{table_name}.yml"))
-    end
-  end
-
-  private
-  def add_options!(opt)
-    opt.separator ''
-    opt.separator 'Options:'
-    opt.on("--dn-attribute=ATTRIBUTE",
-           _("Use ATTRIBUTE as default DN attribute for " \
-             "instances of this model"),
-           _("(default: %s)") % options[:dn_attribute]) do
|attribute|
-      options[:dn_attribute] = attribute
-    end
-
-    opt.on("--prefix=PREFIX",
-           _("Use PREFIX as prefix for this model"),
-           _("(default: %s)") % default_prefix) do |prefix|
-      options[:prefix] = prefix
-    end
-
-    opt.on("--classes=CLASS,CLASS,...",
-           Array,
-           "Use CLASSES as required objectClass for instances of this
model",
-           "(default: %s)" % options[:classes]) do |classes|
-      options[:classes] = classes
-    end
-  end
-
-  def prefix
-    options[:prefix] || default_prefix
-  end
-
-  def default_prefix
-    "ou=#{Inflector.pluralize(Inflector.demodulize(name))}"
-  end
-
-  def ldap_mapping(indent='  ')
-    mapping = "ldap_mapping "
-    mapping_options = [":dn_attribute =>
#{options[:dn_attribute].dump}"]
-    mapping_options << ":prefix => #{prefix.dump}"
-    if options[:classes]
-      mapping_options << ":classes =>
#{options[:classes].inspect}"
-    end
-    mapping_options = mapping_options.join(",\n#{indent}#{' ' *
mapping.size}")
-    "#{indent}#{mapping}#{mapping_options}"
-  end
-end
diff --git
a/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/fixtures.yml
b/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/fixtures.yml
deleted file mode 100644
index 9f5ae29..0000000
---
a/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/fixtures.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-one:
-  id: 1
-<% for attribute in attributes -%>
-  <%= attribute.name %>: <%= attribute.default %>
-<% end -%>
-two:
-  id: 2
-<% for attribute in attributes -%>
-  <%= attribute.name %>: <%= attribute.default %>
-<% end -%>
\ No newline at end of file
diff --git
a/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/model_active_ldap.rb
b/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/model_active_ldap.rb
deleted file mode 100644
index cdfa66b..0000000
---
a/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/model_active_ldap.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class <%= class_name %> < ActiveLdap::Base
-<%= ldap_mapping %>
-end
diff --git
a/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/unit_test.rb
b/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/unit_test.rb
deleted file mode 100644
index b464de4..0000000
---
a/src/vendor/plugins/active_ldap/generators/model_active_ldap/templates/unit_test.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-require File.dirname(__FILE__) + '<%= '/..' *
class_nesting_depth %>/../test_helper'
-
-class <%= class_name %>Test < Test::Unit::TestCase
-  fixtures :<%= table_name %>
-
-  # Replace this with your real tests.
-  def test_truth
-    assert true
-  end
-end
diff --git
a/src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb
b/src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb
deleted file mode 100644
index 35ad937..0000000
---
a/src/vendor/plugins/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class ScaffoldActiveLdapGenerator < Rails::Generator::Base
-  def manifest
-    record do |m|
-      m.template("ldap.yml", File.join("config",
"ldap.yml"))
-    end
-  end
-end
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/generators/scaffold_al/scaffold_al_generator.rb
b/src/vendor/plugins/active_ldap/generators/scaffold_al/scaffold_al_generator.rb
deleted file mode 100644
index 3fa365c..0000000
---
a/src/vendor/plugins/active_ldap/generators/scaffold_al/scaffold_al_generator.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class ScaffoldAlGenerator < Rails::Generator::Base
-  include ActiveLdap::GetTextSupport
-
-  def initialize(*args)
-    duped_args = args.collect {|arg| arg.dup}
-    super
-    logger.warning(_("scaffold_al is deprecated. " \
-                     "Use scaffold_active_ldap instead."))
-    generator_class = self.class.lookup("scaffold_active_ldap").klass
-    @generator = generator_class.new(duped_args)
-  end
-
-  def manifest
-    @generator.manifest
-  end
-
-  def source_path(*args)
-    @generator.source_path(*args)
-  end
-end
diff --git a/src/vendor/plugins/active_ldap/init.rb
b/src/vendor/plugins/active_ldap/init.rb
deleted file mode 100644
index fa1484a..0000000
--- a/src/vendor/plugins/active_ldap/init.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-require_library_or_gem 'active_ldap'
-ActiveLdap::Base.logger ||= RAILS_DEFAULT_LOGGER
-
-required_version = ["0", "10", "0"]
-if (ActiveLdap::VERSION.split(".") <=> required_version) < 0
-  ActiveLdap::Base.class_eval do
-    format = _("You need ActiveLdap %s or later")
-    logger.error(format % required_version.join("."))
-  end
-end
-
-ldap_configuration_file = File.join(RAILS_ROOT, 'config',
'ldap.yml')
-if File.exist?(ldap_configuration_file)
-  configurations = YAML.load(ERB.new(IO.read(ldap_configuration_file)).result)
-  ActiveLdap::Base.configurations = configurations
-  ActiveLdap::Base.establish_connection
-else
-  ActiveLdap::Base.class_eval do
-    format = _("You should run 'script/generator
scaffold_active_ldap' to make %s.")
-    logger.error(format % ldap_configuration_file)
-  end
-end
-
-class ::ActionView::Base
-  include ActiveLdap::Helper
-end
-
-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
-  end
-end
--
1.5.5.1