From null at cozmixng.org Wed Jun 8 01:37:43 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Wed, 08 Jun 2011 05:37:43 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] remove ActiveRecord dependency, and depend on ActiveModel Message-ID: <20110608085746.833892C4186@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-08 05:37:43 +0000 (Wed, 08 Jun 2011) New Revision: 0e8bc73c85a809bea6f3ae461568adab58db8884 Log: remove ActiveRecord dependency, and depend on ActiveModel Modified files: .gitignore Gemfile lib/active_ldap.rb lib/active_ldap/base.rb lib/active_ldap/callbacks.rb lib/active_ldap/validations.rb test/run-test.rb Modified: .gitignore (+1 -0) =================================================================== --- .gitignore 2011-06-03 09:56:30 +0000 (bade509) +++ .gitignore 2011-06-08 05:37:43 +0000 (b8c79f3) @@ -1,3 +1,4 @@ +Gemfile.lock /test/.test-result/ /test/config.yaml /doc/ Modified: Gemfile (+1 -1) =================================================================== --- Gemfile 2011-06-03 09:56:30 +0000 (aca5a42) +++ Gemfile 2011-06-08 05:37:43 +0000 (93f4e8b) @@ -2,7 +2,7 @@ source "http://rubygems.org" -gem 'activerecord', '~> 3.0.7' +gem 'activemodel', '~> 3.0.7' gem 'locale' gem 'fast_gettext' gem 'gettext_i18n_rails' Modified: lib/active_ldap.rb (+2 -2) =================================================================== --- lib/active_ldap.rb 2011-06-03 09:56:30 +0000 (24ecf68) +++ lib/active_ldap.rb 2011-06-08 05:37:43 +0000 (e4960ab) @@ -901,7 +901,7 @@ require_gem_if_need = Proc.new do |library_name, gem_name, *gem_args| end end -require_gem_if_need.call("active_record", "activerecord", "~> 3.0.7") +require_gem_if_need.call("active_model", "activemodel", "~> 3.0.7") require "active_support/core_ext" module ActiveLdap @@ -958,7 +958,6 @@ ActiveLdap::Base.class_eval do include ActiveLdap::Connection include ActiveLdap::Operations include ActiveLdap::ObjectClass - include ActiveLdap::HumanReadable include ActiveLdap::Persistence @@ -966,6 +965,7 @@ ActiveLdap::Base.class_eval do include ActiveLdap::Validations include ActiveLdap::Callbacks + include ActiveLdap::HumanReadable end unless defined?(ACTIVE_LDAP_CONNECTION_ADAPTERS) Modified: lib/active_ldap/base.rb (+7 -9) =================================================================== --- lib/active_ldap/base.rb 2011-06-03 09:56:30 +0000 (1083730) +++ lib/active_ldap/base.rb 2011-06-08 05:37:43 +0000 (1bafe63) @@ -223,6 +223,12 @@ module ActiveLdap end class EntryInvalid < Error + attr_reader :entry + def initialize(entry) + @entry = entry + errors = @entry.errors.full_messages.join(", ") + super(errors) + end end class OperationNotPermitted < Error @@ -528,14 +534,6 @@ module ActiveLdap rescue [self] end - if ActiveRecord::Base.respond_to?(:self_and_descendents_from_active_record) - # ActiveRecord 2.2.2 has a typo. :< - alias_method(:self_and_descendents_from_active_record, - :self_and_descendants_from_active_ldap) - else - alias_method(:self_and_descendants_from_active_record, - :self_and_descendants_from_active_ldap) - end def human_name(options={}) defaults = self_and_descendants_from_active_ldap.collect do |klass| @@ -552,7 +550,7 @@ module ActiveLdap private def inspect_attributes(attributes) - inspected_attribute_names = {} + inspected_attribute_names = {} attributes.collect do |attribute| if inspected_attribute_names.has_key?(attribute.name) nil Modified: lib/active_ldap/callbacks.rb (+52 -18) =================================================================== --- lib/active_ldap/callbacks.rb 2011-06-03 09:56:30 +0000 (9ad5980) +++ lib/active_ldap/callbacks.rb 2011-06-08 05:37:43 +0000 (5365060) @@ -1,19 +1,34 @@ -require 'active_record/callbacks' +require 'active_support/core_ext/array/wrap' module ActiveLdap module Callbacks - def self.append_features(base) - super - - base.class_eval do - include ActiveRecord::Callbacks - - unless respond_to?(:instantiate_with_callbacks) - extend ClassMethods - class << self - alias_method_chain :instantiate, :callbacks - end - alias_method_chain :initialize, :callbacks + extend ActiveSupport::Concern + + CALLBACKS = [ + :after_initialize, :after_find, :after_touch, :before_validation, :after_validation, + :before_save, :around_save, :after_save, :before_create, :around_create, + :after_create, :before_update, :around_update, :after_update, + :before_destroy, :around_destroy, :after_destroy, :after_commit, :after_rollback + ] + + included do + extend ActiveModel::Callbacks + include ActiveModel::Validations::Callbacks + + define_model_callbacks :initialize, :find, :touch, :only => :after + define_model_callbacks :save, :create, :update, :destroy + + class << self + alias_method_chain :instantiate, :callbacks + end + end + + module ClassMethods + def method_added(meth) + super + if CALLBACKS.include?(meth.to_sym) + ActiveSupport::Deprecation.warn("Base##{meth} has been deprecated, please use Base.#{meth} :method instead", caller[0,1]) + send(meth.to_sym, meth.to_sym) end end end @@ -27,11 +42,30 @@ module ActiveLdap end end - def initialize_with_callbacks(attributes = nil) #:nodoc: - initialize_without_callbacks(attributes) - result = yield self if block_given? - _run_initialize_callbacks - result + def initialize(*) #:nodoc: + run_callbacks(:initialize) { super } + end + + def destroy #:nodoc: + run_callbacks(:destroy) { super } + end + + def touch(*) #:nodoc: + run_callbacks(:touch) { super } + end + + private + + def create_or_update #:nodoc: + run_callbacks(:save) { super } + end + + def create #:nodoc: + run_callbacks(:create) { super } + end + + def update(*) #:nodoc: + run_callbacks(:update) { super } end end end Modified: lib/active_ldap/validations.rb (+34 -64) =================================================================== --- lib/active_ldap/validations.rb 2011-06-03 09:56:30 +0000 (b258527) +++ lib/active_ldap/validations.rb 2011-06-08 05:37:43 +0000 (f839ea6) @@ -1,73 +1,29 @@ module ActiveLdap module Validations - def self.append_features(base) - super - - base.class_eval do - alias_method :new_record?, :new_entry? - class << self - alias_method :human_attribute_name_active_ldap, - :human_attribute_name - end - include ActiveRecord::Validations - class << self - alias_method :human_attribute_name_active_record, - :human_attribute_name - alias_method :human_attribute_name, - :human_attribute_name_active_ldap - unless method_defined?(:human_attribute_name_with_gettext) - def human_attribute_name_with_gettext(attribute_key_name, options={}) - logger.warn("options was ignored.") unless options.empty? - s_("#{self}|#{attribute_key_name.to_s.humanize}") - end - end - end - - class_local_attr_accessor true, :validation_skip_attributes - remove_method :validation_skip_attributes - self.validation_skip_attributes = [] - - validate :validate_duplicated_dn_creation, :on => :create - validate :validate_duplicated_dn_rename, :on => :update - validate :validate_dn - validate :validate_excluded_classes - validate :validate_required_ldap_values - validate :validate_ldap_values - - class << self - if method_defined?(:evaluate_condition) - def evaluate_condition_with_active_ldap_support(condition, entry) - evaluate_condition_without_active_ldap_support(condition, entry) - rescue ActiveRecord::ActiveRecordError - raise Error, $!.message - end - alias_method_chain :evaluate_condition, :active_ldap_support + extend ActiveSupport::Concern + include ActiveModel::Validations + + included do + alias_method :new_record?, :new_entry? + class << self + unless method_defined?(:human_attribute_name_with_gettext) + def human_attribute_name_with_gettext(attribute_key_name, options={}) + logger.warn("options was ignored.") unless options.empty? + s_("#{self}|#{attribute_key_name.to_s.humanize}") end end + end - def save_with_active_ldap_support!(options={}) - save_without_active_ldap_support!(options) - rescue ActiveRecord::RecordInvalid - raise EntryInvalid, $!.message - end - alias_method_chain :save!, :active_ldap_support + class_local_attr_accessor true, :validation_skip_attributes + remove_method :validation_skip_attributes + self.validation_skip_attributes = [] - private - def run_validations_with_active_ldap_support(validation_method) - run_validations_without_active_ldap_support(validation_method) - rescue ActiveRecord::ActiveRecordError - raise Error, $!.message - end - if private_method_defined?(:run_validations) - alias_method_chain :run_validations, :active_ldap_support - else - alias_method(:run_callbacks_with_active_ldap_support, - :run_validations_with_active_ldap_support) - alias_method_chain :run_callbacks, :active_ldap_support - alias_method(:run_validations_without_active_ldap_support, - :run_callbacks_without_active_ldap_support) - end - end + validate :validate_duplicated_dn_creation, :on => :create + validate :validate_duplicated_dn_rename, :on => :update + validate :validate_dn + validate :validate_excluded_classes + validate :validate_required_ldap_values + validate :validate_ldap_values end def validation_skip_attributes @@ -78,6 +34,20 @@ module ActiveLdap @validation_skip_attributes = attributes end + def valid?(context = nil) + context ||= (new_entry? ? :create : :update) + output = super(context) + errors.empty? && output + end + + def save(*) + valid? ? super: false + end + + def save!(*) + valid? ? super: raise(EntryInvalid.new(self)) + end + private def format_validation_message(format, parameters) format % parameters Modified: test/run-test.rb (+3 -0) Mode: 100755 -> 100644 =================================================================== --- test/run-test.rb 2011-06-03 09:56:30 +0000 (ce01ee1) +++ test/run-test.rb 2011-06-08 05:37:43 +0000 (84f0755) @@ -19,6 +19,9 @@ require "test/unit" Test::Unit::Priority.enable test_file = "test/test_*.rb" +if ARGV[0] + test_file = File.join('test', ARGV[0]) +end Dir.glob(test_file) do |file| require file end From null at cozmixng.org Wed Jun 8 06:10:58 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Wed, 08 Jun 2011 10:10:58 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] ActiveModel 3.0.7 -> 3.1.0.rc2 Message-ID: <20110608101311.B0B6A2C415D@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-08 10:10:58 +0000 (Wed, 08 Jun 2011) New Revision: bd65d826c5ee7711296ac57f5456029752388e64 Log: ActiveModel 3.0.7 -> 3.1.0.rc2 Modified files: Gemfile lib/active_ldap.rb test/test_connection.rb Modified: Gemfile (+1 -1) =================================================================== --- Gemfile 2011-06-08 05:37:43 +0000 (93f4e8b) +++ Gemfile 2011-06-08 10:10:58 +0000 (bb0d577) @@ -2,7 +2,7 @@ source "http://rubygems.org" -gem 'activemodel', '~> 3.0.7' +gem 'activemodel', '~> 3.1.0.rc2' gem 'locale' gem 'fast_gettext' gem 'gettext_i18n_rails' Modified: lib/active_ldap.rb (+1 -1) =================================================================== --- lib/active_ldap.rb 2011-06-08 05:37:43 +0000 (e4960ab) +++ lib/active_ldap.rb 2011-06-08 10:10:58 +0000 (bece6a6) @@ -901,7 +901,7 @@ require_gem_if_need = Proc.new do |library_name, gem_name, *gem_args| end end -require_gem_if_need.call("active_model", "activemodel", "~> 3.0.7") +require_gem_if_need.call("active_model", "activemodel", "~> 3.1.0.rc2") require "active_support/core_ext" module ActiveLdap Modified: test/test_connection.rb (+1 -1) =================================================================== --- test/test_connection.rb 2011-06-08 05:37:43 +0000 (a8074cd) +++ test/test_connection.rb 2011-06-08 10:10:58 +0000 (7d8cf29) @@ -47,7 +47,7 @@ class TestConnection < Test::Unit::TestCase raise end end - assert_equal("Unknown key(s): bind_format", exception.message) + assert_equal("Unknown key: bind_format", exception.message) end def test_can_reconnect? From null at cozmixng.org Wed Jun 8 23:48:54 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Thu, 09 Jun 2011 03:48:54 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] use config.app_generators because config.generators in Rails::Railtie is deprecated. Message-ID: <20110609035129.CE5402C4186@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-09 03:48:54 +0000 (Thu, 09 Jun 2011) New Revision: 41994c40bff5199238071c76c21460ba2a5bcd2d Log: use config.app_generators because config.generators in Rails::Railtie is deprecated. Modified files: lib/active_ldap.rb lib/active_ldap/railtie.rb Modified: lib/active_ldap.rb (+5 -0) =================================================================== --- lib/active_ldap.rb 2011-06-08 10:10:58 +0000 (bece6a6) +++ lib/active_ldap.rb 2011-06-09 03:48:54 +0000 (d367e76) @@ -975,3 +975,8 @@ end ACTIVE_LDAP_CONNECTION_ADAPTERS.each do |adapter| require "active_ldap/adapter/#{adapter}" end + +if defined?(Rails) + require 'active_ldap/railtie' +end + Modified: lib/active_ldap/railtie.rb (+1 -1) =================================================================== --- lib/active_ldap/railtie.rb 2011-06-08 10:10:58 +0000 (3003af8) +++ lib/active_ldap/railtie.rb 2011-06-09 03:48:54 +0000 (b91a8f8) @@ -3,7 +3,7 @@ require 'rails' module ActiveLdap class Railtie < Rails::Railtie - config.generators.orm :active_ldap + config.app_generators.orm :active_ldap initializer "active_ldap.setup_connection" do ldap_configuration_file = Rails.root.join('config', 'ldap.yml') From null at cozmixng.org Thu Jun 9 02:38:45 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Thu, 09 Jun 2011 06:38:45 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] remove require'active_ldap/railtie' Message-ID: <20110609064133.537B52C4186@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-09 06:38:45 +0000 (Thu, 09 Jun 2011) New Revision: bad7138ddc6c3e950129461843c2b98f9c9db811 Log: remove require'active_ldap/railtie' Modified files: lib/active_ldap.rb Modified: lib/active_ldap.rb (+0 -4) =================================================================== --- lib/active_ldap.rb 2011-06-09 03:48:54 +0000 (d367e76) +++ lib/active_ldap.rb 2011-06-09 06:38:45 +0000 (4e9dffa) @@ -976,7 +976,3 @@ ACTIVE_LDAP_CONNECTION_ADAPTERS.each do |adapter| require "active_ldap/adapter/#{adapter}" end -if defined?(Rails) - require 'active_ldap/railtie' -end - From null at cozmixng.org Thu Jun 9 06:23:58 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Thu, 09 Jun 2011 10:23:58 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] [rails3] add generators Message-ID: <20110609102720.CEA412C4251@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-09 10:23:58 +0000 (Thu, 09 Jun 2011) New Revision: 1b4727b9586370817c7cc253817f89067241b6cf Log: [rails3] add generators Added files: lib/generators/model_active_ldap/USAGE lib/generators/model_active_ldap/model_active_ldap_generator.rb lib/generators/model_active_ldap/templates/model_active_ldap.rb lib/generators/model_active_ldap/templates/unit_test.rb lib/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb lib/generators/scaffold_active_ldap/templates/ldap.yml Modified files: Rakefile lib/active_ldap.rb Modified: Rakefile (+1 -1) =================================================================== --- Rakefile 2011-06-09 06:38:45 +0000 (35584fd) +++ Rakefile 2011-06-09 10:23:58 +0000 (b7e30a0) @@ -30,7 +30,7 @@ Jeweler::Tasks.new do |_spec| spec.email = ['redpig at dataspill.org', 'kou at cozmixng.org'] spec.summary = 'ActiveLdap is a object-oriented API to LDAP' spec.homepage = 'http://ruby-activeldap.rubyforge.org/' - spec.files = FileList["{lib,rails,rails_generators}/**/*.rb", + spec.files = FileList["{lib,rails,rails_generators}/**/*", "{benchmark,examples,po}/**", "bin/*", "CHANGES", Modified: lib/active_ldap.rb (+0 -0) Mode: 100755 -> 100644 =================================================================== --- lib/active_ldap.rb 2011-06-09 06:38:45 +0000 +++ lib/active_ldap.rb 2011-06-09 10:23:58 +0000 Added: lib/generators/model_active_ldap/USAGE (+18 -0) 100644 =================================================================== --- /dev/null +++ lib/generators/model_active_ldap/USAGE 2011-06-09 10:23:58 +0000 (113fda8) @@ -0,0 +1,18 @@ +Description: + The model_active_ldap 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: + rails generate model_active_ldap user + + This will create a User model: + Model: app/models/user.rb + Test: test/unit/user_test.rb + Fixtures: test/fixtures/users.yml + + Added: lib/generators/model_active_ldap/model_active_ldap_generator.rb (+49 -0) 100644 =================================================================== --- /dev/null +++ lib/generators/model_active_ldap/model_active_ldap_generator.rb 2011-06-09 10:23:58 +0000 (568e9c3) @@ -0,0 +1,49 @@ +require 'rails/generators' +require 'active_ldap' + +class ModelActiveLdapGenerator < Rails::Generators::NamedBase + include ActiveLdap::GetTextSupport + source_root File.expand_path('../templates', __FILE__) + + class_option :dn_attribute, :type => :string, :default => 'cn', + :desc => _("Use ATTRIBUTE as default DN attribute for " \ + "instances of this model") + class_option :prefix, :type => :string, + :desc => _("Use PREFIX as prefix for this model") + class_option :classes, :type => :array, :default => nil, + :desc => _("Use CLASSES as required objectClass for instances of this model") + + def create_model + template 'model_active_ldap.rb', File.join('app/models', class_path, "#{file_name}.rb") + end + + def create_test + template 'unit_test.rb', "test/unit/#{file_name}_test.rb" + end + + def create_fixtures +# template 'fixture.yml', "test/fixtures/#{class_name}.yml" + end + + private + + def prefix + options[:prefix] || default_prefix + end + + def default_prefix + "ou=#{name.demodulize.pluralize}" + 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 + Added: lib/generators/model_active_ldap/templates/model_active_ldap.rb (+3 -0) 100644 =================================================================== --- /dev/null +++ lib/generators/model_active_ldap/templates/model_active_ldap.rb 2011-06-09 10:23:58 +0000 (cdfa66b) @@ -0,0 +1,3 @@ +class <%= class_name %> < ActiveLdap::Base +<%= ldap_mapping %> +end Added: lib/generators/model_active_ldap/templates/unit_test.rb (+9 -0) 100644 =================================================================== --- /dev/null +++ lib/generators/model_active_ldap/templates/unit_test.rb 2011-06-09 10:23:58 +0000 (764f02b) @@ -0,0 +1,9 @@ +require 'test_helper' + +class <%= class_name %>Test < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end + Added: lib/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb (+10 -0) 100644 =================================================================== --- /dev/null +++ lib/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb 2011-06-09 10:23:58 +0000 (cf64ced) @@ -0,0 +1,10 @@ +require 'rails/generators' + +class ScaffoldActiveLdapGenerator < Rails::Generators::Base + source_root File.expand_path('../templates', __FILE__) + + def create_ldap_yml + copy_file 'ldap.yml', 'config/ldap.yml' + end +end + Added: lib/generators/scaffold_active_ldap/templates/ldap.yml (+19 -0) 100644 =================================================================== --- /dev/null +++ lib/generators/scaffold_active_ldap/templates/ldap.yml 2011-06-09 10:23:58 +0000 (8eb545f) @@ -0,0 +1,19 @@ +development: + host: 127.0.0.1 + base: dc=devel,dc=local,dc=net + bind_dn: cn=admin,dc=local,dc=net + password: secret + +test: + host: 127.0.0.1 + base: dc=test,dc=local,dc=net + bind_dn: cn=admin,dc=local,dc=net + password: secret + +production: + host: 127.0.0.1 + method: :tls + base: dc=production,dc=local,dc=net + bind_dn: cn=admin,dc=local,dc=net + password: secret + From null at cozmixng.org Thu Jun 9 21:03:19 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Fri, 10 Jun 2011 01:03:19 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] generators directory was moved.(lib/generators -> lib/rails/generators) Message-ID: <20110610010815.CA6F02C4251@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-10 01:03:19 +0000 (Fri, 10 Jun 2011) New Revision: 9b5e15b90747e8a13aef2309bdb3a01d45796896 Log: generators directory was moved.(lib/generators -> lib/rails/generators) Renamed files: lib/rails/generators/model_active_ldap/USAGE (from lib/generators/model_active_ldap/USAGE) lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb (from lib/generators/model_active_ldap/model_active_ldap_generator.rb) lib/rails/generators/model_active_ldap/templates/model_active_ldap.rb (from lib/generators/model_active_ldap/templates/model_active_ldap.rb) lib/rails/generators/model_active_ldap/templates/unit_test.rb (from lib/generators/model_active_ldap/templates/unit_test.rb) lib/rails/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb (from lib/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb) lib/rails/generators/scaffold_active_ldap/templates/ldap.yml (from lib/generators/scaffold_active_ldap/templates/ldap.yml) Renamed: lib/rails/generators/model_active_ldap/USAGE (+0 -0) 100% =================================================================== Renamed: lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb (+0 -0) 100% =================================================================== Renamed: lib/rails/generators/model_active_ldap/templates/model_active_ldap.rb (+0 -0) 100% =================================================================== Renamed: lib/rails/generators/model_active_ldap/templates/unit_test.rb (+0 -0) 100% =================================================================== Renamed: lib/rails/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb (+0 -0) 100% =================================================================== Renamed: lib/rails/generators/scaffold_active_ldap/templates/ldap.yml (+0 -0) 100% =================================================================== From null at cozmixng.org Fri Jun 10 01:21:22 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Fri, 10 Jun 2011 05:21:22 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] use 'hook_for :test_framework' Message-ID: <20110610062201.A04182C4154@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-10 05:21:22 +0000 (Fri, 10 Jun 2011) New Revision: d380d574523ced816f6f5542233150fd7f878ebb Log: use 'hook_for :test_framework' Removed files: lib/rails/generators/model_active_ldap/templates/unit_test.rb Modified files: lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb Modified: lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb (+2 -8) =================================================================== --- lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb 2011-06-10 01:03:19 +0000 (568e9c3) +++ lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb 2011-06-10 05:21:22 +0000 (9cd82fe) @@ -17,14 +17,8 @@ class ModelActiveLdapGenerator < Rails::Generators::NamedBase template 'model_active_ldap.rb', File.join('app/models', class_path, "#{file_name}.rb") end - def create_test - template 'unit_test.rb', "test/unit/#{file_name}_test.rb" - end - - def create_fixtures -# template 'fixture.yml', "test/fixtures/#{class_name}.yml" - end - + hook_for :test_framework, :as => :model + private def prefix Deleted: lib/rails/generators/model_active_ldap/templates/unit_test.rb (+0 -9) 100644 =================================================================== --- lib/rails/generators/model_active_ldap/templates/unit_test.rb 2011-06-10 01:03:19 +0000 (764f02b) +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class <%= class_name %>Test < ActionController::TestCase - # Replace this with your real tests. - def test_truth - assert true - end -end - From null at cozmixng.org Fri Jun 10 05:30:40 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Fri, 10 Jun 2011 09:30:40 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] generators directory is moved.(-> lib/rails/generators/active_ldap) generator name is changed.(active_ldap:scaffold, active_ldap:model) Message-ID: <20110610093727.BA0432C4251@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-10 09:30:40 +0000 (Fri, 10 Jun 2011) New Revision: a726894bb4625e8d25010f98e4d5ece3ec10f7b9 Log: generators directory is moved.(-> lib/rails/generators/active_ldap) generator name is changed.(active_ldap:scaffold, active_ldap:model) Added files: lib/rails/generators/active_ldap/model/USAGE lib/rails/generators/active_ldap/model/model_generator.rb lib/rails/generators/active_ldap/model/templates/model_active_ldap.rb lib/rails/generators/active_ldap/scaffold/scaffold_generator.rb lib/rails/generators/active_ldap/scaffold/templates/ldap.yml Added: lib/rails/generators/active_ldap/model/USAGE (+18 -0) 100644 =================================================================== --- /dev/null +++ lib/rails/generators/active_ldap/model/USAGE 2011-06-10 09:30:40 +0000 (f85f01a) @@ -0,0 +1,18 @@ +Description: + The model_active_ldap 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: + rails generate active_ldap:model user + + This will create a User model: + Model: app/models/user.rb + Test: test/unit/user_test.rb + Fixtures: test/fixtures/users.yml + + Added: lib/rails/generators/active_ldap/model/model_generator.rb (+47 -0) 100644 =================================================================== --- /dev/null +++ lib/rails/generators/active_ldap/model/model_generator.rb 2011-06-10 09:30:40 +0000 (053e4ab) @@ -0,0 +1,47 @@ +require 'rails/generators' +require 'active_ldap' + +module ActiveLdap + module Generators +class ModelGenerator < Rails::Generators::NamedBase + include ActiveLdap::GetTextSupport + source_root File.expand_path('../templates', __FILE__) + + class_option :dn_attribute, :type => :string, :default => 'cn', + :desc => _("Use ATTRIBUTE as default DN attribute for " \ + "instances of this model") + class_option :prefix, :type => :string, + :desc => _("Use PREFIX as prefix for this model") + class_option :classes, :type => :array, :default => nil, + :desc => _("Use CLASSES as required objectClass for instances of this model") + + def create_model + template 'model_active_ldap.rb', File.join('app/models', class_path, "#{file_name}.rb") + end + + hook_for :test_framework, :as => :model + + private + + def prefix + options[:prefix] || default_prefix + end + + def default_prefix + "ou=#{name.demodulize.pluralize}" + 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 + end +end + Added: lib/rails/generators/active_ldap/model/templates/model_active_ldap.rb (+3 -0) 100644 =================================================================== --- /dev/null +++ lib/rails/generators/active_ldap/model/templates/model_active_ldap.rb 2011-06-10 09:30:40 +0000 (cdfa66b) @@ -0,0 +1,3 @@ +class <%= class_name %> < ActiveLdap::Base +<%= ldap_mapping %> +end Added: lib/rails/generators/active_ldap/scaffold/scaffold_generator.rb (+14 -0) 100644 =================================================================== --- /dev/null +++ lib/rails/generators/active_ldap/scaffold/scaffold_generator.rb 2011-06-10 09:30:40 +0000 (e3da428) @@ -0,0 +1,14 @@ +require 'rails/generators' + +module ActiveLdap + module Generators +class ScaffoldGenerator < Rails::Generators::Base + source_root File.expand_path('../templates', __FILE__) + + def create_ldap_yml + copy_file 'ldap.yml', 'config/ldap.yml' + end +end + end +end + Added: lib/rails/generators/active_ldap/scaffold/templates/ldap.yml (+19 -0) 100644 =================================================================== --- /dev/null +++ lib/rails/generators/active_ldap/scaffold/templates/ldap.yml 2011-06-10 09:30:40 +0000 (8eb545f) @@ -0,0 +1,19 @@ +development: + host: 127.0.0.1 + base: dc=devel,dc=local,dc=net + bind_dn: cn=admin,dc=local,dc=net + password: secret + +test: + host: 127.0.0.1 + base: dc=test,dc=local,dc=net + bind_dn: cn=admin,dc=local,dc=net + password: secret + +production: + host: 127.0.0.1 + method: :tls + base: dc=production,dc=local,dc=net + bind_dn: cn=admin,dc=local,dc=net + password: secret + From null at cozmixng.org Fri Jun 10 05:42:06 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Fri, 10 Jun 2011 09:42:06 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] remove old generator files. Message-ID: <20110610094341.031052C4154@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-10 09:42:06 +0000 (Fri, 10 Jun 2011) New Revision: 44afd1735c7678df5304467dc4508b336a1c0c56 Log: remove old generator files. Removed files: lib/rails/generators/model_active_ldap/USAGE lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb lib/rails/generators/model_active_ldap/templates/model_active_ldap.rb lib/rails/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb lib/rails/generators/scaffold_active_ldap/templates/ldap.yml Deleted: lib/rails/generators/model_active_ldap/USAGE (+0 -18) 100644 =================================================================== --- lib/rails/generators/model_active_ldap/USAGE 2011-06-10 09:30:40 +0000 (113fda8) +++ /dev/null @@ -1,18 +0,0 @@ -Description: - The model_active_ldap 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: - rails generate model_active_ldap user - - This will create a User model: - Model: app/models/user.rb - Test: test/unit/user_test.rb - Fixtures: test/fixtures/users.yml - - Deleted: lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb (+0 -43) 100644 =================================================================== --- lib/rails/generators/model_active_ldap/model_active_ldap_generator.rb 2011-06-10 09:30:40 +0000 (9cd82fe) +++ /dev/null @@ -1,43 +0,0 @@ -require 'rails/generators' -require 'active_ldap' - -class ModelActiveLdapGenerator < Rails::Generators::NamedBase - include ActiveLdap::GetTextSupport - source_root File.expand_path('../templates', __FILE__) - - class_option :dn_attribute, :type => :string, :default => 'cn', - :desc => _("Use ATTRIBUTE as default DN attribute for " \ - "instances of this model") - class_option :prefix, :type => :string, - :desc => _("Use PREFIX as prefix for this model") - class_option :classes, :type => :array, :default => nil, - :desc => _("Use CLASSES as required objectClass for instances of this model") - - def create_model - template 'model_active_ldap.rb', File.join('app/models', class_path, "#{file_name}.rb") - end - - hook_for :test_framework, :as => :model - - private - - def prefix - options[:prefix] || default_prefix - end - - def default_prefix - "ou=#{name.demodulize.pluralize}" - 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 - Deleted: lib/rails/generators/model_active_ldap/templates/model_active_ldap.rb (+0 -3) 100644 =================================================================== --- lib/rails/generators/model_active_ldap/templates/model_active_ldap.rb 2011-06-10 09:30:40 +0000 (cdfa66b) +++ /dev/null @@ -1,3 +0,0 @@ -class <%= class_name %> < ActiveLdap::Base -<%= ldap_mapping %> -end Deleted: lib/rails/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb (+0 -10) 100644 =================================================================== --- lib/rails/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb 2011-06-10 09:30:40 +0000 (cf64ced) +++ /dev/null @@ -1,10 +0,0 @@ -require 'rails/generators' - -class ScaffoldActiveLdapGenerator < Rails::Generators::Base - source_root File.expand_path('../templates', __FILE__) - - def create_ldap_yml - copy_file 'ldap.yml', 'config/ldap.yml' - end -end - Deleted: lib/rails/generators/scaffold_active_ldap/templates/ldap.yml (+0 -19) 100644 =================================================================== --- lib/rails/generators/scaffold_active_ldap/templates/ldap.yml 2011-06-10 09:30:40 +0000 (8eb545f) +++ /dev/null @@ -1,19 +0,0 @@ -development: - host: 127.0.0.1 - base: dc=devel,dc=local,dc=net - bind_dn: cn=admin,dc=local,dc=net - password: secret - -test: - host: 127.0.0.1 - base: dc=test,dc=local,dc=net - bind_dn: cn=admin,dc=local,dc=net - password: secret - -production: - host: 127.0.0.1 - method: :tls - base: dc=production,dc=local,dc=net - bind_dn: cn=admin,dc=local,dc=net - password: secret - From null at cozmixng.org Mon Jun 13 04:21:14 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Mon, 13 Jun 2011 08:21:14 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] add ActiveLdap::Base#to_key. it is referenced by ActionView::Helpers::FormHelper#form_for Message-ID: <20110613083804.37E682C415B@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-13 08:21:14 +0000 (Mon, 13 Jun 2011) New Revision: 2ffee1e7aa4c544ed4cc77ec650bd5a1f0704837 Log: add ActiveLdap::Base#to_key. it is referenced by ActionView::Helpers::FormHelper#form_for Modified files: lib/active_ldap/base.rb test/test_base.rb Modified: lib/active_ldap/base.rb (+7 -0) =================================================================== --- lib/active_ldap/base.rb 2011-06-10 09:42:06 +0000 (1bafe63) +++ lib/active_ldap/base.rb 2011-06-13 08:21:14 +0000 (8d2a470) @@ -776,6 +776,13 @@ module ActiveLdap id end + # Returns this entity?s dn wrapped in an Array or nil if the entity' s dn is not set. + def to_key + [ dn ] + rescue DistinguishedNameNotSetError + nil + end + def dn=(value) set_attribute(dn_attribute_with_fallback, value) end Modified: test/test_base.rb (+9 -0) =================================================================== --- test/test_base.rb 2011-06-10 09:42:06 +0000 (4b11b41) +++ test/test_base.rb 2011-06-13 08:21:14 +0000 (9278959) @@ -1127,6 +1127,15 @@ EOX end end + + def test_to_key + cn = "XXX" + new_user = @user_class.new + assert_equal(nil, new_user.to_key) + + new_user.cn = cn + assert_equal([ new_user.dn ], new_user.to_key) + end private def detect_modify(object) modify_called = false From null at cozmixng.org Mon Jun 13 04:49:42 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Mon, 13 Jun 2011 08:49:42 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] modify indent. Message-ID: <20110613090052.46A092C41A8@taiyaki.ru> Hidetoshi Yoshimoto 2011-06-13 08:49:42 +0000 (Mon, 13 Jun 2011) New Revision: 46374edb265924da7edddf1833f1f74737bec503 Log: modify indent. Modified files: lib/rails/generators/active_ldap/model/model_generator.rb lib/rails/generators/active_ldap/scaffold/scaffold_generator.rb test/test_base.rb Modified: lib/rails/generators/active_ldap/model/model_generator.rb (+38 -38) =================================================================== --- lib/rails/generators/active_ldap/model/model_generator.rb 2011-06-13 08:21:14 +0000 (053e4ab) +++ lib/rails/generators/active_ldap/model/model_generator.rb 2011-06-13 08:49:42 +0000 (fb987e0) @@ -3,45 +3,45 @@ require 'active_ldap' module ActiveLdap module Generators -class ModelGenerator < Rails::Generators::NamedBase - include ActiveLdap::GetTextSupport - source_root File.expand_path('../templates', __FILE__) - - class_option :dn_attribute, :type => :string, :default => 'cn', - :desc => _("Use ATTRIBUTE as default DN attribute for " \ - "instances of this model") - class_option :prefix, :type => :string, - :desc => _("Use PREFIX as prefix for this model") - class_option :classes, :type => :array, :default => nil, - :desc => _("Use CLASSES as required objectClass for instances of this model") - - def create_model - template 'model_active_ldap.rb', File.join('app/models', class_path, "#{file_name}.rb") - end - - hook_for :test_framework, :as => :model - - private - - def prefix - options[:prefix] || default_prefix - end - - def default_prefix - "ou=#{name.demodulize.pluralize}" - 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}" + class ModelGenerator < Rails::Generators::NamedBase + include ActiveLdap::GetTextSupport + source_root File.expand_path('../templates', __FILE__) + + class_option :dn_attribute, :type => :string, :default => 'cn', + :desc => _("Use ATTRIBUTE as default DN attribute for " \ + "instances of this model") + class_option :prefix, :type => :string, + :desc => _("Use PREFIX as prefix for this model") + class_option :classes, :type => :array, :default => nil, + :desc => _("Use CLASSES as required objectClass for instances of this model") + + def create_model + template 'model_active_ldap.rb', File.join('app/models', class_path, "#{file_name}.rb") + end + + hook_for :test_framework, :as => :model + + private + + def prefix + options[:prefix] || default_prefix + end + + def default_prefix + "ou=#{name.demodulize.pluralize}" + 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 - mapping_options = mapping_options.join(",\n#{indent}#{' ' * mapping.size}") - "#{indent}#{mapping}#{mapping_options}" - end -end end end Modified: lib/rails/generators/active_ldap/scaffold/scaffold_generator.rb (+7 -7) =================================================================== --- lib/rails/generators/active_ldap/scaffold/scaffold_generator.rb 2011-06-13 08:21:14 +0000 (e3da428) +++ lib/rails/generators/active_ldap/scaffold/scaffold_generator.rb 2011-06-13 08:49:42 +0000 (9616b1d) @@ -2,13 +2,13 @@ require 'rails/generators' module ActiveLdap module Generators -class ScaffoldGenerator < Rails::Generators::Base - source_root File.expand_path('../templates', __FILE__) - - def create_ldap_yml - copy_file 'ldap.yml', 'config/ldap.yml' - end -end + class ScaffoldGenerator < Rails::Generators::Base + source_root File.expand_path('../templates', __FILE__) + + def create_ldap_yml + copy_file 'ldap.yml', 'config/ldap.yml' + end + end end end Modified: test/test_base.rb (+1 -1) =================================================================== --- test/test_base.rb 2011-06-13 08:21:14 +0000 (9278959) +++ test/test_base.rb 2011-06-13 08:49:42 +0000 (57c16fd) @@ -1127,7 +1127,6 @@ EOX end end - def test_to_key cn = "XXX" new_user = @user_class.new @@ -1136,6 +1135,7 @@ EOX new_user.cn = cn assert_equal([ new_user.dn ], new_user.to_key) end + private def detect_modify(object) modify_called = false From null at cozmixng.org Mon Jun 13 13:41:29 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Mon, 13 Jun 2011 17:41:29 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] remove old rails initialization. Message-ID: <20110613184120.D27FF2C415B@taiyaki.ru> Ryan Tandy 2011-06-13 17:41:29 +0000 (Mon, 13 Jun 2011) New Revision: 440a4eed06d15a1920a96b3157f847f42df007a8 Log: remove old rails initialization. Removed files: rails/README rails/init.rb Modified files: README Modified: README (+28 -0) =================================================================== --- README 2011-06-13 08:49:42 +0000 (248f4d7) +++ README 2011-06-13 17:41:29 +0000 (1180f51) @@ -81,6 +81,34 @@ When your application starts up, the plugin will call ActiveLdap::Base.setup_connection using the parameters specified for your current environment. +== 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_name => "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 + == LICENCE This program is free software; you can redistribute it and/or modify it. It is Deleted: rails/README (+0 -54) 100644 =================================================================== --- rails/README 2011-06-13 08:49:42 +0000 (0482984) +++ /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_name => "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 Deleted: rails/init.rb (+0 -33) 100644 =================================================================== --- rails/init.rb 2011-06-13 08:49:42 +0000 (f6efcb2) +++ /dev/null @@ -1,33 +0,0 @@ -require_library_or_gem 'active_ldap' -ActiveLdap::Base.logger ||= Rails.logger - -required_version = ["1", "1", "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.setup_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 - -# Expose Ldap runtime to controller for logging. -require "active_ldap/railties/controller_runtime" -ActiveSupport.on_load(:action_controller) do - include ActiveLdap::Railties::ControllerRuntime -end - From null at cozmixng.org Mon Jun 13 17:33:09 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Mon, 13 Jun 2011 21:33:09 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] require_library_or_gem was deprecated. Message-ID: <20110613213506.AB2152C41A8@taiyaki.ru> Ryan Tandy 2011-06-13 21:33:09 +0000 (Mon, 13 Jun 2011) New Revision: e319cdd5880891e125cc195b6040e3300705c277 Log: require_library_or_gem was deprecated. Modified files: lib/active_ldap/adapter/net_ldap_ext.rb Modified: lib/active_ldap/adapter/net_ldap_ext.rb (+1 -1) =================================================================== --- lib/active_ldap/adapter/net_ldap_ext.rb 2011-06-13 17:41:29 +0000 (a932cc4) +++ lib/active_ldap/adapter/net_ldap_ext.rb 2011-06-13 21:33:09 +0000 (bb74580) @@ -1,4 +1,4 @@ -require_library_or_gem 'net/ldap' +require 'net/ldap' module Net class LDAP From null at cozmixng.org Tue Jun 14 08:21:23 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 12:21:23 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] fix style: remove needless spaces. Message-ID: <20110614122219.F32232C418B@taiyaki.ru> Kouhei Sutou 2011-06-14 12:21:23 +0000 (Tue, 14 Jun 2011) New Revision: 06b1c222154d1c3810d0315b471864f3ba2c5c57 Log: fix style: remove needless spaces. Modified files: lib/active_ldap/base.rb Modified: lib/active_ldap/base.rb (+1 -1) =================================================================== --- lib/active_ldap/base.rb 2011-06-13 21:33:09 +0000 (8d2a470) +++ lib/active_ldap/base.rb 2011-06-14 12:21:23 +0000 (8c7786d) @@ -778,7 +778,7 @@ module ActiveLdap # Returns this entity?s dn wrapped in an Array or nil if the entity' s dn is not set. def to_key - [ dn ] + [dn] rescue DistinguishedNameNotSetError nil end From null at cozmixng.org Tue Jun 14 08:28:25 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 12:28:25 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] [test] use standalone mode. Message-ID: <20110614122920.17DF12C45F1@taiyaki.ru> Kouhei Sutou 2011-06-14 12:28:25 +0000 (Tue, 14 Jun 2011) New Revision: 53a7e6c96eac6ce8615f46b285029eff2082552d Log: [test] use standalone mode. Modified files: test/run-test.rb Modified: test/run-test.rb (+1 -15) Mode: 100644 -> 100755 =================================================================== --- test/run-test.rb 2011-06-14 12:21:23 +0000 (84f0755) +++ test/run-test.rb 2011-06-14 12:28:25 +0000 (7a88fe0) @@ -18,14 +18,6 @@ $LOAD_PATH.unshift(File.join(top_dir, "test")) require "test/unit" Test::Unit::Priority.enable -test_file = "test/test_*.rb" -if ARGV[0] - test_file = File.join('test', ARGV[0]) -end -Dir.glob(test_file) do |file| - require file -end - target_adapters = [nil] # target_adapters << "ldap" # target_adapters << "net-ldap" @@ -33,12 +25,6 @@ target_adapters = [nil] target_adapters.each do |adapter| ENV["ACTIVE_LDAP_TEST_ADAPTER"] = adapter puts "using adapter: #{adapter ? adapter : 'default'}" - args = [File.dirname($0), ARGV.dup] - if Test::Unit::AutoRunner.respond_to?(:standalone?) - args.unshift(false) - else - args.unshift($0) - end - Test::Unit::AutoRunner.run(*args) + Test::Unit::AutoRunner.run(true, File.dirname($0), ARGV.dup) puts end From null at cozmixng.org Tue Jun 14 08:29:05 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 12:29:05 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] [test] require missing test/unit/notify. Message-ID: <20110614123003.053C02C45F2@taiyaki.ru> Kouhei Sutou 2011-06-14 12:29:05 +0000 (Tue, 14 Jun 2011) New Revision: e3f5da142b17d1ade2d0d614114f510a5c36bc92 Log: [test] require missing test/unit/notify. Modified files: test/run-test.rb Modified: test/run-test.rb (+1 -0) =================================================================== --- test/run-test.rb 2011-06-14 12:28:25 +0000 (7a88fe0) +++ test/run-test.rb 2011-06-14 12:29:05 +0000 (8d16046) @@ -16,6 +16,7 @@ $LOAD_PATH.unshift(File.join(top_dir, "test")) require "test/unit" +require "test/unit/notify" Test::Unit::Priority.enable target_adapters = [nil] From null at cozmixng.org Tue Jun 14 08:40:15 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 12:40:15 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] [test] @user_class's DN attribute is uid not cn. Message-ID: <20110614124108.5A0F32C418B@taiyaki.ru> Kouhei Sutou 2011-06-14 12:40:15 +0000 (Tue, 14 Jun 2011) New Revision: 755df0569af3186f85de024fb25b79380481ff0f Log: [test] @user_class's DN attribute is uid not cn. Modified files: test/test_base.rb Modified: test/test_base.rb (+4 -4) =================================================================== --- test/test_base.rb 2011-06-14 12:29:05 +0000 (57c16fd) +++ test/test_base.rb 2011-06-14 12:40:15 +0000 (3f620b5) @@ -1128,12 +1128,12 @@ EOX end def test_to_key - cn = "XXX" + uid = "bob" new_user = @user_class.new assert_equal(nil, new_user.to_key) - - new_user.cn = cn - assert_equal([ new_user.dn ], new_user.to_key) + + new_user.uid = uid + assert_equal([new_user.dn], new_user.to_key) end private From null at cozmixng.org Tue Jun 14 09:10:36 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 13:10:36 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] [test] use ACTIVE_LDAP_TEST_ADAPTER environment variable to set test adapter. Message-ID: <20110614131131.4E9052C418B@taiyaki.ru> Kouhei Sutou 2011-06-14 13:10:36 +0000 (Tue, 14 Jun 2011) New Revision: 31d9a80d99477975a9b30d25e7295100b7b3d23d Log: [test] use ACTIVE_LDAP_TEST_ADAPTER environment variable to set test adapter. Modified files: test/run-test.rb Modified: test/run-test.rb (+1 -1) =================================================================== --- test/run-test.rb 2011-06-14 12:40:15 +0000 (8d16046) +++ test/run-test.rb 2011-06-14 13:10:36 +0000 (eff6b87) @@ -19,7 +19,7 @@ require "test/unit" require "test/unit/notify" Test::Unit::Priority.enable -target_adapters = [nil] +target_adapters = [ENV["ACTIVE_LDAP_TEST_ADAPTER"]] # target_adapters << "ldap" # target_adapters << "net-ldap" # target_adapters << "jndi" From null at cozmixng.org Tue Jun 14 09:23:17 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 13:23:17 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] [test] fix adapter option key type. Message-ID: <20110614132446.A92462C418B@taiyaki.ru> Kouhei Sutou 2011-06-14 13:23:17 +0000 (Tue, 14 Jun 2011) New Revision: 67f542013a44c4da69a8c2bab1b6b94e2b591bd7 Log: [test] fix adapter option key type. Modified files: test/al-test-utils.rb Modified: test/al-test-utils.rb (+1 -1) =================================================================== --- test/al-test-utils.rb 2011-06-14 13:10:36 +0000 (aa6c01e) +++ test/al-test-utils.rb 2011-06-14 13:23:17 +0000 (f45d0f0) @@ -71,7 +71,7 @@ module AlTestUtils config = YAML.load(erb.result) _adapter = adapter config.each do |key, value| - value[:adapter] = _adapter if _adapter + value["adapter"] = _adapter if _adapter end config end From null at cozmixng.org Tue Jun 14 09:29:56 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 13:29:56 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] work on Ruby 1.8. Message-ID: <20110614133108.5F94D2C45F2@taiyaki.ru> Kouhei Sutou 2011-06-14 13:29:56 +0000 (Tue, 14 Jun 2011) New Revision: a0e3424b9dad8473d25558a7382ed261393726bf Log: work on Ruby 1.8. Modified files: Rakefile Modified: Rakefile (+5 -3) =================================================================== --- Rakefile 2011-06-14 13:29:40 +0000 (b7e30a0) +++ Rakefile 2011-06-14 13:29:56 +0000 (7864c72) @@ -9,9 +9,11 @@ require 'bundler/setup' require 'jeweler' require 'rake/testtask' -begin - YAML::ENGINE.yamler = "psych" -rescue LoadError +if YAML.const_defined?(:ENGINE) + begin + YAML::ENGINE.yamler = "psych" + rescue LoadError + end end base_dir = File.expand_path(File.dirname(__FILE__)) From null at cozmixng.org Tue Jun 14 09:30:14 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 13:30:14 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] don't require non default dependencies in gem. Message-ID: <20110614133108.694D42C45F3@taiyaki.ru> Kouhei Sutou 2011-06-14 13:30:14 +0000 (Tue, 14 Jun 2011) New Revision: 5012533812d7fb478243065e181486cd74458e68 Log: don't require non default dependencies in gem. Modified files: Rakefile Modified: Rakefile (+1 -1) =================================================================== --- Rakefile 2011-06-14 13:29:56 +0000 (7864c72) +++ Rakefile 2011-06-14 13:30:14 +0000 (916b7a0) @@ -43,7 +43,7 @@ Jeweler::Tasks.new do |_spec| "TODO", "*.txt"] spec.test_files = FileList['test/test_*.rb'] - Bundler.environment.dependencies.each do |dependency| + Bundler.load.dependencies_for(:default).each do |dependency| spec.add_runtime_dependency(dependency.name, dependency.requirement) end spec.description = <<-EOF From null at cozmixng.org Tue Jun 14 09:29:40 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 13:29:40 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] don't specify any LDAP adapters in default group. Message-ID: <20110614133108.548B42C418B@taiyaki.ru> Kouhei Sutou 2011-06-14 13:29:40 +0000 (Tue, 14 Jun 2011) New Revision: 5c44393845578a735594b6dd231042c98c2e2354 Log: don't specify any LDAP adapters in default group. Modified files: Gemfile Modified: Gemfile (+2 -3) =================================================================== --- Gemfile 2011-06-14 13:23:17 +0000 (bb0d577) +++ Gemfile 2011-06-14 13:29:40 +0000 (90694d9) @@ -7,10 +7,9 @@ gem 'locale' gem 'fast_gettext' gem 'gettext_i18n_rails' -# gem 'ruby-ldap' -gem 'net-ldap' - group :development, :test do + gem 'ruby-ldap' + gem 'net-ldap' gem 'jeweler' gem 'test-unit' gem 'test-unit-notify' From null at cozmixng.org Tue Jun 14 09:47:15 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 13:47:15 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] add missing '_'. Message-ID: <20110614134814.A66AA2C45F2@taiyaki.ru> Kouhei Sutou 2011-06-14 13:47:15 +0000 (Tue, 14 Jun 2011) New Revision: 69c9e140a02d7b8a8bfa543c740cdfc1f598426a Log: add missing '_'. Modified files: lib/active_ldap/railtie.rb Modified: lib/active_ldap/railtie.rb (+1 -1) =================================================================== --- lib/active_ldap/railtie.rb 2011-06-14 13:47:11 +0000 (41883ad) +++ lib/active_ldap/railtie.rb 2011-06-14 13:47:15 +0000 (2ea2f67) @@ -23,7 +23,7 @@ module ActiveLdap ActiveLdap::Base.logger ||= ::Rails.logger end - initializer "active_ldap.actionview_helper" do + initializer "active_ldap.action_view_helper" do class ::ActionView::Base include ActiveLdap::Helper end From null at cozmixng.org Tue Jun 14 09:47:11 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 13:47:11 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] update generater command in error message. Message-ID: <20110614134814.9BCBC2C418B@taiyaki.ru> Kouhei Sutou 2011-06-14 13:47:11 +0000 (Tue, 14 Jun 2011) New Revision: 2743a7df297b4bc30e6227f3ff4b874a7f2a3623 Log: update generater command in error message. Modified files: lib/active_ldap/railtie.rb Modified: lib/active_ldap/railtie.rb (+1 -1) =================================================================== --- lib/active_ldap/railtie.rb 2011-06-14 13:30:14 +0000 (b91a8f8) +++ lib/active_ldap/railtie.rb 2011-06-14 13:47:11 +0000 (41883ad) @@ -13,7 +13,7 @@ module ActiveLdap ActiveLdap::Base.setup_connection else ActiveLdap::Base.class_eval do - format =_("You should run 'script/generator scaffold_active_ldap' to make %s.") + format =_("You should run 'rails generator active_ldap:scaffold' to make %s.") logger.error(format % ldap_configuration_file) end end From null at cozmixng.org Tue Jun 14 09:48:07 2011 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 14 Jun 2011 13:48:07 +0000 Subject: [activeldap-commit] activeldap/activeldap [master] [rails3][design] move done items to DONE section. Message-ID: <20110614134902.868952C418B@taiyaki.ru> Kouhei Sutou 2011-06-14 13:48:07 +0000 (Tue, 14 Jun 2011) New Revision: ec2bd7cd302c66c800f891b70aa90af150e137e2 Log: [rails3][design] move done items to DONE section. Modified files: design-for-rails3-support.txt Modified: design-for-rails3-support.txt (+6 -4) =================================================================== --- design-for-rails3-support.txt 2011-06-14 13:47:15 +0000 (bc2ccfb) +++ design-for-rails3-support.txt 2011-06-14 13:48:07 +0000 (f40ed1f) @@ -1,14 +1,16 @@ --- must * We target to Rails 3.1.0. (Yes, it's not released yet but it will be released before we support Rails 3.x.) -* We don't support Rails 3.0.x. * We update the documentation and ensure that the procedure for including ActiveLdap in a Rails 3 project is correct. -* We provide active_ldap/railtie to initialize ActiveLdap. --- may -* We remove ActiveRecord dependency. -* We depend on ActiveModel instead of ActiveRecord. * We support Warden. * We support Devise * We support OmniAuth. (instead of Warden) + +--- DONE +* We don't support Rails 3.0.x. +* We provide active_ldap/railtie to initialize ActiveLdap. +* We remove ActiveRecord dependency. +* We depend on ActiveModel instead of ActiveRecord.