From codesite-noreply at google.com Thu Jul 1 01:25:30 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Thu, 01 Jul 2010 05:25:30 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1146 committed - * use setup_connection instead of establish_connection. Message-ID: <0016e68debdeee760e048a4cb278@google.com> Revision: 1146 Author: koutou Date: Wed Jun 30 22:24:49 2010 Log: * use setup_connection instead of establish_connection. http://code.google.com/p/ruby-activeldap/source/detail?r=1146 Modified: /trunk/benchmark/bench-al.rb ======================================= --- /trunk/benchmark/bench-al.rb Sun Feb 8 17:38:34 2009 +++ /trunk/benchmark/bench-al.rb Wed Jun 30 22:24:49 2010 @@ -17,7 +17,7 @@ end end -ActiveLdap::Base.establish_connection +ActiveLdap::Base.setup_connection config = ActiveLdap::Base.configuration LDAP_HOST = config[:host] @@ -39,11 +39,11 @@ class ALUserLdap < ALUser end -ALUserLdap.establish_connection(config.merge(:adapter => "ldap")) +ALUserLdap.setup_connection(config.merge(:adapter => "ldap")) class ALUserNetLdap < ALUser end -ALUserNetLdap.establish_connection(config.merge(:adapter => "net-ldap")) +ALUserNetLdap.setup_connection(config.merge(:adapter => "net-ldap")) def search_al_ldap count = 0 From codesite-noreply at google.com Sun Jul 4 03:46:32 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 04 Jul 2010 07:46:32 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1147 committed - * import the latest unreleased locale_rails. Message-ID: <00163630f2b9c7c1de048a8b0488@google.com> Revision: 1147 Author: koutou Date: Sun Jul 4 00:44:12 2010 Log: * import the latest unreleased locale_rails. http://code.google.com/p/ruby-activeldap/source/detail?r=1147 Added: /trunk/examples/al-admin/vendor/locale_rails /trunk/examples/al-admin/vendor/locale_rails/.gitignore /trunk/examples/al-admin/vendor/locale_rails/COPYING /trunk/examples/al-admin/vendor/locale_rails/ChangeLog /trunk/examples/al-admin/vendor/locale_rails/README.rdoc /trunk/examples/al-admin/vendor/locale_rails/Rakefile /trunk/examples/al-admin/vendor/locale_rails/lib /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/base.rb /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/caching.rb /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/test_process.rb /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller.rb /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_view.rb /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/i18n.rb /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/version.rb /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails.rb /trunk/examples/al-admin/vendor/locale_rails/sample /trunk/examples/al-admin/vendor/locale_rails/sample/README /trunk/examples/al-admin/vendor/locale_rails/sample/Rakefile /trunk/examples/al-admin/vendor/locale_rails/sample/app /trunk/examples/al-admin/vendor/locale_rails/sample/app/controllers /trunk/examples/al-admin/vendor/locale_rails/sample/app/controllers/application.rb /trunk/examples/al-admin/vendor/locale_rails/sample/app/controllers/samples_controller.rb /trunk/examples/al-admin/vendor/locale_rails/sample/app/helpers /trunk/examples/al-admin/vendor/locale_rails/sample/app/helpers/application_helper.rb /trunk/examples/al-admin/vendor/locale_rails/sample/app/views /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/layouts /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/layouts/samples.html.erb /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/_part.html.erb /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/_part_nl.html.erb /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/cached_action.html.erb /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index.html.erb /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index.pt.html.erb /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index_uz_UZ.html.erb /trunk/examples/al-admin/vendor/locale_rails/sample/config /trunk/examples/al-admin/vendor/locale_rails/sample/config/boot.rb /trunk/examples/al-admin/vendor/locale_rails/sample/config/database.yml /trunk/examples/al-admin/vendor/locale_rails/sample/config/environment.rb /trunk/examples/al-admin/vendor/locale_rails/sample/config/environments /trunk/examples/al-admin/vendor/locale_rails/sample/config/environments/development.rb /trunk/examples/al-admin/vendor/locale_rails/sample/config/environments/production.rb /trunk/examples/al-admin/vendor/locale_rails/sample/config/environments/test.rb /trunk/examples/al-admin/vendor/locale_rails/sample/config/initializers /trunk/examples/al-admin/vendor/locale_rails/sample/config/initializers/inflections.rb /trunk/examples/al-admin/vendor/locale_rails/sample/config/initializers/mime_types.rb /trunk/examples/al-admin/vendor/locale_rails/sample/config/initializers/new_rails_defaults.rb /trunk/examples/al-admin/vendor/locale_rails/sample/config/locales /trunk/examples/al-admin/vendor/locale_rails/sample/config/locales/en.yml /trunk/examples/al-admin/vendor/locale_rails/sample/config/locales/ja.yml /trunk/examples/al-admin/vendor/locale_rails/sample/config/routes.rb /trunk/examples/al-admin/vendor/locale_rails/sample/db /trunk/examples/al-admin/vendor/locale_rails/sample/db/schema.rb /trunk/examples/al-admin/vendor/locale_rails/sample/doc /trunk/examples/al-admin/vendor/locale_rails/sample/doc/README_FOR_APP /trunk/examples/al-admin/vendor/locale_rails/sample/public /trunk/examples/al-admin/vendor/locale_rails/sample/public/404.html /trunk/examples/al-admin/vendor/locale_rails/sample/public/422.html /trunk/examples/al-admin/vendor/locale_rails/sample/public/500.html /trunk/examples/al-admin/vendor/locale_rails/sample/public/dispatch.cgi /trunk/examples/al-admin/vendor/locale_rails/sample/public/dispatch.fcgi /trunk/examples/al-admin/vendor/locale_rails/sample/public/dispatch.rb /trunk/examples/al-admin/vendor/locale_rails/sample/public/favicon.ico /trunk/examples/al-admin/vendor/locale_rails/sample/public/images /trunk/examples/al-admin/vendor/locale_rails/sample/public/images/rails.png /trunk/examples/al-admin/vendor/locale_rails/sample/public/javascripts /trunk/examples/al-admin/vendor/locale_rails/sample/public/javascripts/application.js /trunk/examples/al-admin/vendor/locale_rails/sample/public/javascripts/controls.js /trunk/examples/al-admin/vendor/locale_rails/sample/public/javascripts/dragdrop.js /trunk/examples/al-admin/vendor/locale_rails/sample/public/javascripts/effects.js /trunk/examples/al-admin/vendor/locale_rails/sample/public/javascripts/prototype.js /trunk/examples/al-admin/vendor/locale_rails/sample/public/robots.txt /trunk/examples/al-admin/vendor/locale_rails/sample/public/stylesheets /trunk/examples/al-admin/vendor/locale_rails/sample/public/stylesheets/locale.css /trunk/examples/al-admin/vendor/locale_rails/sample/public/stylesheets/scaffold.css /trunk/examples/al-admin/vendor/locale_rails/sample/script /trunk/examples/al-admin/vendor/locale_rails/sample/script/about /trunk/examples/al-admin/vendor/locale_rails/sample/script/console /trunk/examples/al-admin/vendor/locale_rails/sample/script/dbconsole /trunk/examples/al-admin/vendor/locale_rails/sample/script/destroy /trunk/examples/al-admin/vendor/locale_rails/sample/script/generate /trunk/examples/al-admin/vendor/locale_rails/sample/script/performance /trunk/examples/al-admin/vendor/locale_rails/sample/script/performance/benchmarker /trunk/examples/al-admin/vendor/locale_rails/sample/script/performance/profiler /trunk/examples/al-admin/vendor/locale_rails/sample/script/performance/request /trunk/examples/al-admin/vendor/locale_rails/sample/script/plugin /trunk/examples/al-admin/vendor/locale_rails/sample/script/process /trunk/examples/al-admin/vendor/locale_rails/sample/script/process/inspector /trunk/examples/al-admin/vendor/locale_rails/sample/script/process/reaper /trunk/examples/al-admin/vendor/locale_rails/sample/script/process/spawner /trunk/examples/al-admin/vendor/locale_rails/sample/script/runner /trunk/examples/al-admin/vendor/locale_rails/sample/script/server /trunk/examples/al-admin/vendor/locale_rails/sample/test /trunk/examples/al-admin/vendor/locale_rails/sample/test/performance /trunk/examples/al-admin/vendor/locale_rails/sample/test/performance/browsing_test.rb /trunk/examples/al-admin/vendor/locale_rails/sample/test/test_helper.rb /trunk/examples/al-admin/vendor/locale_rails/test /trunk/examples/al-admin/vendor/locale_rails/test/README /trunk/examples/al-admin/vendor/locale_rails/test/Rakefile /trunk/examples/al-admin/vendor/locale_rails/test/app /trunk/examples/al-admin/vendor/locale_rails/test/app/controllers /trunk/examples/al-admin/vendor/locale_rails/test/app/controllers/application_controller.rb /trunk/examples/al-admin/vendor/locale_rails/test/app/controllers/articles_controller.rb /trunk/examples/al-admin/vendor/locale_rails/test/app/helpers /trunk/examples/al-admin/vendor/locale_rails/test/app/helpers/application_helper.rb /trunk/examples/al-admin/vendor/locale_rails/test/app/views /trunk/examples/al-admin/vendor/locale_rails/test/app/views/articles /trunk/examples/al-admin/vendor/locale_rails/test/app/views/articles/index.html.erb /trunk/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_de.html.erb /trunk/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_fr_FR.html.erb /trunk/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_ja.html.erb /trunk/examples/al-admin/vendor/locale_rails/test/app/views/articles/list.html.erb /trunk/examples/al-admin/vendor/locale_rails/test/app/views/articles/show.html.erb /trunk/examples/al-admin/vendor/locale_rails/test/app/views/articles/show.js.rjs /trunk/examples/al-admin/vendor/locale_rails/test/config /trunk/examples/al-admin/vendor/locale_rails/test/config/boot.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/database.yml /trunk/examples/al-admin/vendor/locale_rails/test/config/environment.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/environments /trunk/examples/al-admin/vendor/locale_rails/test/config/environments/development.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/environments/production.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/environments/test.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/initializers /trunk/examples/al-admin/vendor/locale_rails/test/config/initializers/backtrace_silencers.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/initializers/inflections.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/initializers/mime_types.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/initializers/new_rails_defaults.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/initializers/session_store.rb /trunk/examples/al-admin/vendor/locale_rails/test/config/locales /trunk/examples/al-admin/vendor/locale_rails/test/config/locales/en.yml /trunk/examples/al-admin/vendor/locale_rails/test/config/routes.rb /trunk/examples/al-admin/vendor/locale_rails/test/db /trunk/examples/al-admin/vendor/locale_rails/test/db/schema.rb /trunk/examples/al-admin/vendor/locale_rails/test/doc /trunk/examples/al-admin/vendor/locale_rails/test/doc/README_FOR_APP /trunk/examples/al-admin/vendor/locale_rails/test/public /trunk/examples/al-admin/vendor/locale_rails/test/public/404.html /trunk/examples/al-admin/vendor/locale_rails/test/public/422.html /trunk/examples/al-admin/vendor/locale_rails/test/public/500.html /trunk/examples/al-admin/vendor/locale_rails/test/public/favicon.ico /trunk/examples/al-admin/vendor/locale_rails/test/public/images /trunk/examples/al-admin/vendor/locale_rails/test/public/images/rails.png /trunk/examples/al-admin/vendor/locale_rails/test/public/index.html /trunk/examples/al-admin/vendor/locale_rails/test/public/javascripts /trunk/examples/al-admin/vendor/locale_rails/test/public/javascripts/application.js /trunk/examples/al-admin/vendor/locale_rails/test/public/javascripts/controls.js /trunk/examples/al-admin/vendor/locale_rails/test/public/javascripts/dragdrop.js /trunk/examples/al-admin/vendor/locale_rails/test/public/javascripts/effects.js /trunk/examples/al-admin/vendor/locale_rails/test/public/javascripts/prototype.js /trunk/examples/al-admin/vendor/locale_rails/test/public/robots.txt /trunk/examples/al-admin/vendor/locale_rails/test/script /trunk/examples/al-admin/vendor/locale_rails/test/script/about /trunk/examples/al-admin/vendor/locale_rails/test/script/console /trunk/examples/al-admin/vendor/locale_rails/test/script/dbconsole /trunk/examples/al-admin/vendor/locale_rails/test/script/destroy /trunk/examples/al-admin/vendor/locale_rails/test/script/generate /trunk/examples/al-admin/vendor/locale_rails/test/script/performance /trunk/examples/al-admin/vendor/locale_rails/test/script/performance/benchmarker /trunk/examples/al-admin/vendor/locale_rails/test/script/performance/profiler /trunk/examples/al-admin/vendor/locale_rails/test/script/plugin /trunk/examples/al-admin/vendor/locale_rails/test/script/runner /trunk/examples/al-admin/vendor/locale_rails/test/script/server /trunk/examples/al-admin/vendor/locale_rails/test/test /trunk/examples/al-admin/vendor/locale_rails/test/test/functional /trunk/examples/al-admin/vendor/locale_rails/test/test/functional/articles_controller_test.rb /trunk/examples/al-admin/vendor/locale_rails/test/test/performance /trunk/examples/al-admin/vendor/locale_rails/test/test/performance/browsing_test.rb /trunk/examples/al-admin/vendor/locale_rails/test/test/test_helper.rb ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/.gitignore Sun Jul 4 00:44:12 2010 @@ -0,0 +1,6 @@ +*.sqlite3 +pkg/*.gem +test/log +test/tmp +.idea + ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/COPYING Sun Jul 4 00:44:12 2010 @@ -0,0 +1,56 @@ +Ruby is copyrighted free software by Yukihiro Matsumoto . +You can redistribute it and/or modify it under either the terms of the GPL +version 2 (see the file GPL), or the conditions below: + + 1. You may make and give away verbatim copies of the source form of the + software without restriction, provided that you duplicate all of the + original copyright notices and associated disclaimers. + + 2. You may modify your copy of the software in any way, provided that + you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise + make them Freely Available, such as by posting said + modifications to Usenet or an equivalent medium, or by allowing + the author to include your modifications in the software. + + b) use the modified software only within your corporation or + organization. + + c) give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. + + d) make other distribution arrangements with the author. + + 3. You may distribute the software in object code or binary form, + provided that you do at least ONE of the following: + + a) distribute the binaries and library files of the software, + together with instructions (in the manual page or equivalent) + on where to get the original distribution. + + b) accompany the distribution with the machine-readable source of + the software. + + c) give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. + + d) make other distribution arrangements with the author. + + 4. You may modify and include the part of the software into any other + software (possibly commercial). But some files in the distribution + are not written by the author, so that they are not under these terms. + + For the list of those files and their copying conditions, see the + file LEGAL. + + 5. The scripts and library files supplied as input to or produced as + output from the software do not automatically fall under the + copyright of the software, but belong to whomever generated them, + and may be sold commercially, and may be aggregated with this + software. + + 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/ChangeLog Sun Jul 4 00:44:12 2010 @@ -0,0 +1,35 @@ += locale_rails-2.0.5 (2009-11-11) + * Update license information (explicit to use Ruby's or LGPL). + [Pointed out by Masateru Yoshikawa] + * Fixed to work expire_fragment/action. + [Reported by Sean Tan] + * Support Rails-2.3.2, 2.3.3 and 2.3.4. + Update the version information. + += locale_rails-2.0.4 (2009-05-22) + * Fixed that localized views are not working correctly. [Reported by Dan Coutu] + * Add tests + += locale_rails-2.0.3 (2009-05-09) + * Fixed a bug not to work with fragment cache. [Reported by Andy Lo-A-Foe] + * Fixed the dependencies. [Reported by Hans de Graaff] + += locale_rails-2.0.2 (2009-05-04) + * Remove I18n.candidates. Use Locale.candidates directly. + * Improve documentations. + * Override I18n.default_locale= to call Locale.default. + += locale_rails-2.0.1 (2009-04-17) + * Fixed to work localized view which was canceled. + += locale_rails-2.0.0 (2009-03-22) + * I18n.translate fallbacks to the localized message in the locale candidates. + * Support localized view both of gettext-1.93.0 style and rails-2.3.x style. + += locale_rails-0.1.0 (2008-12-04) + * Initial released. + * Auto-Detect the locales from the WWW browser + * Localized Routes + * Action/Fragment caching + * Separated Localized View template file + ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/README.rdoc Sun Jul 4 00:44:12 2010 @@ -0,0 +1,62 @@ += Ruby-Locale for Ruby on Rails + +This library provides some Rails localized functions. + +This is useful with Rails i18n backends which doesn't have +auto-detection and some other features includes this library. + +== Features for Ruby on Rails +* Auto-Detect the locales from the WWW browser +* Action/Fragment caching +* Separated Localized View template file +* Localized Routes +* I18n.t fallback to localized message candidates. + +== Website +* http://www.yotabanana.com/hiki/ruby-locale-rails.html +* http://locale.rubyforge.org/ + +== Requirements +* Ruby-1.8.7 or later +* JRuby-1.1.4 or later +* Ruby-Locale-0.9.0 or later + +== Install +* gem: + ($ su) + # gem install locale_rails + +== Usage +==== config/environment.rb + Rails::Initializer.run do |config| + : + : + config.gem 'locale' + config.gem 'locale_rails' + end + +==== config/initializer/locale.rb + + # Tell the I18n library where to find your translations + I18n.supported_locales = ["ja", "en"] + I18n.default_locale = "ja" + +== Support matrix +* locale_rails-2.0.6 - rails-2.3.2,2.3.3,2.3.4,2.3.5 +* locale_rails-2.0.5 - rails-2.3.2,2.3.3,2.3.4 +* locale_rails-2.0.4 - rails-2.3.2 +* locale_rails-2.0.3 - rails-2.3.2 +* locale_rails-2.0.2 - rails-2.3.2 +* locale_rails-2.0.1 - rails-2.3.2 +* locale_rails-2.0.0 - rails-2.3.2 +* locale_rails-0.1.0 - rails-2.1.x + +== Tested Ruby version: +* locale_rails-2.0.6 - 1.8.7-p249, 1.9.1-p378 + +== License +This program is licenced under the same licence as Ruby(See COPYING) or +LGPL(Lesser General Public License: http://www.gnu.org/licenses/lgpl-3.0.txt). + +== Maintainer +Masao Mutoh ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/Rakefile Sun Jul 4 00:44:12 2010 @@ -0,0 +1,73 @@ +$:.unshift "./lib" + +require 'rake' +require 'rake/testtask' +require 'rake/rdoctask' +require 'rake/packagetask' +require 'rake/gempackagetask' + +require 'locale_rails/version' + +#desc "Default Task" +#task :default => [ :test ] + +PKG_NAME = "locale_rails" +PKG_VERSION = LocaleRails::VERSION + +# Run the unit tests +task :test do + cd "test" + sh "rake test" + cd ".." +end + +Rake::RDocTask.new { |rdoc| + begin + allison = `allison --path`.chop + rescue Exception + allison = "" + end + rdoc.rdoc_dir = 'doc' + rdoc.title = "Ruby-Locale for Ruby on Rails" + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README.rdoc', 'ChangeLog') + rdoc.rdoc_files.include('lib/**/*.rb') + rdoc.template = allison if allison.size > 0 +} + +desc "Create gem and tar.gz" +spec = Gem::Specification.new do |s| + s.name = PKG_NAME + s.version = PKG_VERSION + s.summary = 'Ruby-Locale for Ruby on Rails is the pure ruby library which provides basic functions for localization based on Ruby-Locale.' + s.author = 'Masao Mutoh' + s.email = 'mutomasa at gmail.com' + s.homepage = 'http://locale.rubyforge.org/' + s.rubyforge_project = "locale" + s.files = FileList['**/*'].to_a.select{|v| v !~ /pkg|CVS|git/} + s.require_path = 'lib' + s.bindir = 'bin' + s.add_dependency('locale', '>= 2.0.6') + s.has_rdoc = true + s.description = <<-EOF + Ruby-Locale for Ruby on Rails is the pure ruby library which provides basic functions for localization. + EOF +end + +Rake::GemPackageTask.new(spec) do |p| + p.gem_spec = spec + p.need_tar_gz = false + p.need_zip = false +end + +desc "Publish the release files to RubyForge." +task :release => [ :package ] do + require 'rubyforge' + + rubyforge = RubyForge.new + rubyforge.configure + rubyforge.login + rubyforge.add_release("locale", "locale_rails", + PKG_VERSION, + "pkg/#{PKG_NAME}-#{PKG_VERSION}.gem") +end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/base.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,82 @@ +=begin + lib/locale_rails/action_controller/base.rb - Ruby/Locale for "Ruby on Rails" + + Copyright (C) 2008-2009 Masao Mutoh + + You may redistribute it and/or modify it under the same + license terms as Ruby or LGPL. +=end + +require 'action_controller' + +module ActionController #:nodoc: + class Base + prepend_before_filter :init_locale + + def self.locale_filter_chain # :nodoc: + if chain = read_inheritable_attribute('locale_filter_chain') + return chain + else + write_inheritable_attribute('locale_filter_chain', FilterChain.new) + return locale_filter_chain + end + end + + def init_locale # :nodoc: + cgi = nil + if defined? ::Rack + cgi = request + else + if defined? request.cgi + cgi = request.cgi + end + end + + fchain = self.class.locale_filter_chain + run_before_filters(fchain.select(&:before?), 0, 0) + + cgi.params["lang"] = [params["lang"]] if params["lang"].is_a?(String) + Locale.set_cgi(cgi) + if cgi.params["lang"] + I18n.locale = cgi.params["lang"][0] + else + I18n.locale = nil + end + + run_after_filters(fchain.select(&:after?), 0) + end + + # Append a block which is called before initializing locale on each WWW request. + # + # (e.g.) + # class ApplicationController < ActionController::Base + # def before_init_i18n + # if (cookies["lang"].nil? or cookies["lang"].empty?) + # params["lang"] = "ko_KR" + # end + # end + # before_init_locale :before_init_i18n + # # ... + # end + def self.before_init_locale(*filters, &block) + locale_filter_chain.append_filter_to_chain(filters, :before, &block) + end + + # Append a block which is called after initializing locale on each WWW request. + # + # (e.g.) + # class ApplicationController < ActionController::Base + # def after_init_i18n + # L10nClass.new(Locale.candidates) + # end + # after_init_locale :after_init_i18n + # # ... + # end + def self.after_init_locale(*filters, &block) + locale_filter_chain.append_filter_to_chain(filters, :after, &block) + end + end + +end + + ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/caching.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,51 @@ +=begin + lib/locale_rails/action_controller.rb - Ruby/Locale for "Ruby on Rails" + + Copyright (C) 2008-2009 Masao Mutoh + + You may redistribute it and/or modify it under the same + license terms as Ruby or LGPL. +=end + +require 'action_controller/caching' + +module ActionController #:nodoc: + + module Caching + module Fragments + @@fragmented_locales = [] + def fragment_cache_key_with_locale(name) + ret = fragment_cache_key_without_locale(name) + if ret.is_a? String + unless @@fragmented_locales.include? I18n.locale + @@fragmented_locales << I18n.locale + end + ret.gsub(/:/, ".") << "_#{I18n.locale}" + else + ret + end + end + alias_method_chain :fragment_cache_key, :locale + + def expire_fragment_with_locale(name, options = nil) + return unless perform_caching + + fc_store = (respond_to? :cache_store) ? cache_store : fragment_cache_store + key = name.is_a?(Regexp) ? name : fragment_cache_key_without_locale(name) + if key.is_a?(Regexp) + self.class.benchmark "Expired fragments matching: #{key.source}" do + fc_store.delete_matched(key, options) + end + else + key = key.gsub(/:/, ".") + self.class.benchmark "Expired fragment: #{key}, lang = #{@@fragmented_locales}" do + @@fragmented_locales.each do |lang| + fc_store.delete("#{key}_#{lang}", options) + end + end + end + end + alias_method_chain :expire_fragment, :locale + end + end +end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/test_process.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,44 @@ +=begin + lib/locale_rails/action_controller.rb - Ruby/Locale for "Ruby on Rails" + + Copyright (C) 2009 Masao Mutoh + + You may redistribute it and/or modify it under the same + license terms as Ruby or LGPL. + +=end + +require 'action_controller' +require 'action_controller/test_process' + +module ActionController + if defined? AbstractRequest #:nodoc: + # for Rails-2.2.x or earlier. + class TestRequest < AbstractRequest #:nodoc: + class LocaleMockCGI < CGI #:nodoc: + attr_accessor :stdinput, :stdoutput, :env_table + + def initialize(env, input=nil) + self.env_table = env + self.stdinput = StringIO.new(input || "") + self.stdoutput = StringIO.new + + super() + end + end + + @cgi = nil + def cgi + unless @cgi + @cgi = LocaleMockCGI.new("REQUEST_METHOD" => "GET", + "QUERY_STRING" => "", + "REQUEST_URI" => "/", + "HTTP_HOST" => "www.example.com", + "SERVER_PORT" => "80", + "HTTPS" => "off") + end + @cgi + end + end + end +end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,15 @@ +=begin + lib/locale_rails/action_controller.rb - Ruby/Locale for "Ruby on Rails" + + Copyright (C) 2008-2009 Masao Mutoh + + You may redistribute it and/or modify it under the same + license terms as Ruby or LGPL. + +=end + +require 'action_controller' +["base", "caching", "test_process"].each do |lib| + require File.join(File.dirname(__FILE__), "action_controller", lib) +end + ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_view.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,53 @@ +=begin + locale_rails/lib/action_view.rb - Ruby/Locale for "Ruby on Rails" + + Copyright (C) 2008-2009 Masao Mutoh + + You may redistribute it and/or modify it under the same + license terms as Ruby or LGPL. + + Original: Ruby-GetText-Package-1.92.0 + +=end + +require 'action_view' + +module ActionView #:nodoc: + class PathSet < Array + def _find_template_internal(file_name, format, html_fallback = false) + begin + return find_template_without_locale_rails(file_name, format, html_fallback) + rescue MissingTemplate => e + end + nil + end + + def find_template_with_locale_rails(original_template_path, format = nil, html_fallback = true) + return original_template_path if original_template_path.respond_to?(:render) + + path = original_template_path.sub(/^\//, '') + if m = path.match(/(.*)\.(\w+)$/) + template_file_name, template_file_extension = m[1], m[2] + else + template_file_name = path + end + + default = Locale.default.to_common + Locale.candidates.each do |v| + file_name = "#{template_file_name}_#{v}" + file_name += ".#{template_file_extension}" if template_file_extension + ret = _find_template_internal(file_name, format) + return ret if ret + if v == default + # When the user locale is the default locale, find no locale file such as index.html.erb. + ret = _find_template_internal(path, format) + end + return ret if ret + end + find_template_without_locale_rails(original_template_path, format, html_fallback) + end + alias_method_chain :find_template, :locale_rails + + end +end + ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/i18n.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,67 @@ +=begin + locale_rails/lib/i18n.rb - Ruby/Locale for "Ruby on Rails" + + Copyright (C) 2008,2009 Masao Mutoh + + You may redistribute it and/or modify it under the same + license terms as Ruby or LGPL. + +=end + +module I18n + module_function + + # Gets the supported locales. + def supported_locales + ::Locale.app_language_tags + end + + # Sets the supported locales. + # I18n.set_supported_locales("ja-JP", "ko-KR", ...) + def set_supported_locales(*tags) + ::Locale.set_app_language_tags(*tags) + end + + # Sets the supported locales as an Array. + # I18n.supported_locales = ["ja-JP", "ko-KR", ...] + def supported_locales=(tags) + ::Locale.set_app_language_tags(*tags) + end + + # Sets the ::Locale. + # I18n.locale = "ja-JP" + def locale_with_locale_rails=(tag) + ::Locale.clear + tag = ::Locale::Tag::Rfc.parse(tag.to_s) if tag.kind_of? Symbol + ::Locale.current = tag + self.locale_without_locale_rails = ::Locale.candidates(:type => :rfc)[0].to_s + end + + # Sets the default ::Locale. + # I18n.default_locale = "ja" + def default_locale=(tag) + tag = ::Locale::Tag::Rfc.parse(tag.to_s) if tag.kind_of? Symbol + ::Locale.default = tag + @@default_locale = tag + end + + class << self + alias_method_chain :locale=, :locale_rails + + # MissingTranslationData is overrided to fallback messages in candidate locales. + def locale_rails_exception_handler(exception, locale, key, options) #:nodoc: + ret = nil + ::Locale.candidates(:type => :rfc).each do |loc| + begin + ret = backend.translate(loc, key, options) + break + rescue I18n::MissingTranslationData + ret = I18n.default_exception_handler(exception, locale, key, options) + end + end + ret + end + I18n.exception_handler = :locale_rails_exception_handler + end + +end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails/version.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,4 @@ +module LocaleRails + RAILS_VERSION = "2.3.5" + VERSION = "2.0.6" +end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/lib/locale_rails.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,18 @@ +require 'locale' + +Locale.init(:driver => :cgi) + +["i18n", "action_controller", "action_view", "version"].each do |lib| + require File.join(File.dirname(__FILE__), "locale_rails", lib) +end + +begin + Rails::Info.property("Locale version") do + Locale::VERSION + end + Rails::Info.property("Locale for Rails version") do + Locale::LOCALE_RAILS_VERSION + end +rescue Exception + $stderr.puts "Locale's Rails::Info is not found." if $DEBUG +end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/README Sun Jul 4 00:44:12 2010 @@ -0,0 +1,22 @@ +== Ruby-Locale for Ruby on Rails sample application +This is the sample application for localization. + +=== Includes +1. How to get current language. +2. Auto-Detect the locale from the WWW browser +3. Set locale as the "lang" parameter +4. Set "lang" as the cookie value +5. Localized Routes +6. Action caching +7. Separate Localized View template file + +== Installation + +1. Instal rails-2.2.x. +2. Install sqlite3-ruby + gem install sqlite3-ruby +3. Install locale_rails + gem install locale_rails +4. rake db:create +5. ruby script/server +6. Access http://localhost:3000/ from the WWW browser. ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/Rakefile Sun Jul 4 00:44:12 2010 @@ -0,0 +1,10 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require(File.join(File.dirname(__FILE__), 'config', 'boot')) + +require 'rake' +require 'rake/testtask' +require 'rake/rdoctask' + +require 'tasks/rails' ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/controllers/application.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,42 @@ +# Filters added to this controller apply to all controllers in the application. +# Likewise, all the methods added will be available for all controllers. + +class ApplicationController < ActionController::Base + helper :all # include all helpers, all the time + + # See ActionController::RequestForgeryProtection for details + # Uncomment the :secret if you're not using the cookie session store + protect_from_forgery # :secret => '639df270d82028344f5a50f543530c57' + + # See ActionController::Base for details + # Uncomment this to filter the contents of submitted sensitive data parameters + # from your application log (in this case, all fields with names like "password"). + # filter_parameter_logging :password + + # Set the charset of Content-Type. + # This is not Ruby-Locale method but useful. +# self.default_charset = "iso8859-1" + # I18n.supported_locales = ["en", "ja", "fr"] + +=begin + def before_init_i18n + # Initialize other i18n libraries before init_locale if you need. + # Or set "lang" to it's own value before initializing Locale. + if (cookies["lang"].nil? or cookies["lang"].empty?) + params["lang"] = "ko_KR" + end + end + before_init_locale :before_init_i18n + + def after_init_i18n + # Initialize other i18n libraries after init_locale if you need. + # + # LocalizeFoo.locale = Locale.current + # I18n.locale is set in init_locale, but other I18n features + # is not set by Ruby-Locale. So you may need to add the code to work your + # Rails i18n plugins. + end + after_init_locale :after_init_i18n +=end + +end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/controllers/samples_controller.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,30 @@ +class SamplesController < ApplicationController + caches_action :cached_action + + def index + end + + def set_cookie + flash[:notice] = "Cookie lang value is: " + params[:id] + + cookies["lang"] = params[:id] + + respond_to do |format| + format.html { redirect_to :action => "index" } + end + end + + def clear_cookie + cookies["lang"] = nil + + flash[:notice] = "Cookie lang value is cleared. " + respond_to do |format| + format.html { redirect_to :action => "index" } + end + end + + def cached_action + p "cached_action. This is shown first time only." + end +end + ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/helpers/application_helper.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,3 @@ +# Methods added to this helper will be available to all templates in the application. +module ApplicationHelper +end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/layouts/samples.html.erb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,20 @@ + + + + + + Ruby-Locale Sample on Ruby on Rails: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + <%= stylesheet_link_tag 'locale' %> + + +

<%= flash[:notice] %>

+ + <%= yield %> + + + + ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/_part.html.erb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,68 @@ +<% + app_lang_tags = ["ja_JP", "fr", "pt_BR", "zh_CN", "en_Latn_US_NYNORSK", "uz_UZ", "nl"] +%> + +

Get the current locale

+

Locale.candidates(with no option)

+

Requested Locales order by the priority. This method is added by Ruby-Locale for Ruby on Rails.

+
+<%=h Locale.candidates.inspect %> +
+ +

I18n.locale (with inspect)

+

I18n.locale is set the result(Locale::TagList) of Locale.candidates(:type => :rfc).
+This method is extended by Ruby-Locale for Ruby on Rails and returns all candidates as the Locale::TagList. +

+
+<%=h I18n.locale.inspect %> +
+ +

I18n.locale (without inspect)

+

Locale::TagList(the result of I18n.locale) can behave like a single tag string to follow I18n.locale specification.

+
+<%=h I18n.locale %> +
+ +

Auto-Detect the locale from the WWW browser

+

Reload this URL

+ +

Set locale as the "lang" parameter

+ +
    +<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang| + url = samples_path(:lang => lang) %> +
  1. <%= link_to h(url), url %> [<%= lang %>]
  2. +<% end %> +
+ +

Set "lang" as the cookie value.

+

Click one of the link below, and then click "Auto-Detect the locale from the WWW browser".

+ +
    +<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang| + url = url_for(:controller => :samples, :action => :set_cookie, :id => lang) %> +
  1. <%= link_to h(url), {:action => :set_cookie, :id => lang} %> [<%= lang %>]
  2. +<% end %> +
  3. <%= link_to "Clear cookie", :action => :clear_cookie %>
  4. +
+ +

Localized Routes

+

See config/routes.rb

+ +
    +<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang| + url = url_for(:controller => :samples, :lang => lang, :action => :index) %> +
  1. <%= link_to h(url),:controller => :samples, :lang => lang, :action => :index %> [<%= lang %>]
  2. +<% end %> +
+ +

Caching

+

Fragment/Action caching is supported. Here is the sample for action caching.
+Click the links then check %{RAILS_ROOT}/tmp/cache/ where Cached file is stored. +

+
    +<% (app_lang_tags - ["uz_UZ", "nl"]).each do |lang| + url = url_for(:controller => :samples, :action => :cached_action, :lang => lang) %> +
  1. <%= link_to h(url), {:controller => :samples, :action => :cached_action, :lang => lang} %> [<%= lang %>]
  2. +<% end %> +
======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/_part_nl.html.erb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,2 @@ +

This page is for nl only. See app/views/samples/_part_nl.html.erb.

+

<%= link_to "[BACK]", samples_path %>

======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/cached_action.html.erb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,6 @@ +

Ruby-Locale and Ruby on Rails 2.2 sample

+

[source code]

+ +

This page is cached for [<%= I18n.locale %>].
+See %{RAILS_ROOT}/tmp/cache/*.

+

<%= link_to "[BACK]", samples_path %>

======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index.html.erb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,33 @@ +

Ruby-Locale and Ruby on Rails sample

+

[source code]

+ +

The values from Rails

+ + + + + + + + +
VariablesValues
HTTP_ACCEPT_LANGUAGE <%= request.accept_language %>
HTTP_ACCEPT_CHARSET <%= request.accept_charset %>
QUERY_STRING <%= request.query_string %>
params[:lang]<%= params[:lang] %>
cookies[:lang] <%= cookies[:lang] %>
I18n.t :hello (*1) <%= I18n.t :hello %>
+

+(*1) Fallback to "en" if the localized message is not found in the locale. +Currently, <%= Dir.glob(File.join(RAILS_ROOT, "config/locales/*.yml")).collect {|v| File.basename(v, ".yml")}.inspect %> are available. +

+ +<%= render :partial => 'part' %> + +

Separate Localized View template file in each languages

+

View template can be separeted with language tags.

+
    +
  1. <%= link_to "uz_UZ has special index page(index_uz_UZ.html.erb)", :controller => :samples, :action => :index, :lang => "uz_UZ" %>
  2. +
  3. <%= link_to "uz uses normal index page", :controller => :samples, :action => :index, :lang => "uz" %>
  4. +
  5. <%= link_to "nl has special _part page(_part_nl.html.erb)", :controller => :samples, :action => :index, :lang => "nl" %>
  6. +
  7. <%= link_to "nl_BE also uses the special _part page(_part_nl.html.erb)", :controller => :samples, :action => :index, :lang => "nl_BE" %>
  8. +
+

View template by Rails-2.3.x is also supported.

+
    +
  1. <%= link_to "pt has special index page(index.pt.html.erb)", :controller => :samples, :action => :index, :lang => "pt" %>
  2. +
  3. <%= link_to "pt_BR uses normal index page", :controller => :samples, :action => :index, :lang => "pt_BR" %>
  4. +
======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index.pt.html.erb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,16 @@ +

Ruby-Locale and Ruby on Rails 2.2 sample

+

[source code]

+ +

The values from Rails

+ + + + + + + + +
VariablesValues
HTTP_ACCEPT_LANGUAGE <%= request.accept_language %>
HTTP_ACCEPT_CHARSET <%= request.accept_charset %>
QUERY_STRING <%= request.query_string %>
params[:lang]<%= params[:lang] %>
cookies[:lang] <%= cookies[:lang] %>
I18n.t :hello (*1) <%= I18n.t :hello %>
+ +

This page is for pt only. See app/views/samples/index.pt.html.erb. This format is supported by Rails-2.3.x as default.

+

<%= link_to "[BACK]", samples_path %>

======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index_uz_UZ.html.erb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,16 @@ +

Ruby-Locale and Ruby on Rails 2.2 sample

+

[source code]

+ +

The values from Rails

+ + + + + + + + +
VariablesValues
HTTP_ACCEPT_LANGUAGE <%= request.accept_language %>
HTTP_ACCEPT_CHARSET <%= request.accept_charset %>
QUERY_STRING <%= request.query_string %>
params[:lang]<%= params[:lang] %>
cookies[:lang] <%= cookies[:lang] %>
I18n.t :hello (*1) <%= I18n.t :hello %>
+ +

This page is for uz_UZ only. See app/views/samples/index_uz_UZ.html.erb.

+

<%= link_to "[BACK]", samples_path %>

======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/boot.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,109 @@ +# Don't change this file! +# Configure your app in config/environment.rb and config/environments/*.rb + +RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) + +module Rails + class << self + def boot! + unless booted? + preinitialize + pick_boot.run + end + end + + def booted? + defined? Rails::Initializer + end + + def pick_boot + (vendor_rails? ? VendorBoot : GemBoot).new + end + + def vendor_rails? + File.exist?("#{RAILS_ROOT}/vendor/rails") + end + + def preinitialize + load(preinitializer_path) if File.exist?(preinitializer_path) + end + + def preinitializer_path + "#{RAILS_ROOT}/config/preinitializer.rb" + end + end + + class Boot + def run + load_initializer + Rails::Initializer.run(:set_load_path) + end + end + + class VendorBoot < Boot + def load_initializer + require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" + Rails::Initializer.run(:install_gem_spec_stubs) + end + end + + class GemBoot < Boot + def load_initializer + self.class.load_rubygems + load_rails_gem + require 'initializer' + end + + def load_rails_gem + if version = self.class.gem_version + gem 'rails', version + else + gem 'rails' + end + rescue Gem::LoadError => load_error + $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) + exit 1 + end + + class << self + def rubygems_version + Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion + end + + def gem_version + if defined? RAILS_GEM_VERSION + RAILS_GEM_VERSION + elsif ENV.include?('RAILS_GEM_VERSION') + ENV['RAILS_GEM_VERSION'] + else + parse_gem_version(read_environment_rb) + end + end + + def load_rubygems + require 'rubygems' + min_version = '1.1.1' + unless rubygems_version >= min_version + $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) + exit 1 + end + + rescue LoadError + $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) + exit 1 + end + + def parse_gem_version(text) + $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ + end + + private + def read_environment_rb + File.read("#{RAILS_ROOT}/config/environment.rb") + end + end + end +end + +# All that for this: +Rails.boot! ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/database.yml Sun Jul 4 00:44:12 2010 @@ -0,0 +1,22 @@ +# SQLite version 3.x +# gem install sqlite3-ruby (not necessary on OS X Leopard) +development: + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: sqlite3 + database: db/test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + database: db/production.sqlite3 + pool: 5 + timeout: 5000 ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/environment.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file + +# Uncomment below to force Rails into production mode when +# you don't control web/app server and can't set it the proper way +# ENV['RAILS_ENV'] ||= 'production' + +# Specifies gem version of Rails to use when vendor/rails is not present +#RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION + +# Bootstrap the Rails environment, frameworks, and default configuration +require File.join(File.dirname(__FILE__), 'boot') + +Rails::Initializer.run do |config| + config.time_zone = 'UTC' + + config.action_controller.session = { + :session_key => '_rails_session', + :secret => '25fe1cb0e4295d9ede3b21864a1a3b589a4656bd0032fee8b8a470a93d221d4d666e9076a35bd0e4fd0fe8ca12eec9dc85f46554cd6e26b4569548b6ee03323a' + } + + config.gem "locale" + config.gem "locale_rails" +end + +ActionController::Base.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache" ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/environments/development.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,17 @@ +# Settings specified here will take precedence over those in config/environment.rb + +# In the development environment your application's code is reloaded on +# every request. This slows down response time but is perfect for development +# since you don't have to restart the webserver when you make code changes. +config.cache_classes = true + +# Log error messages when you accidentally call methods on nil. +config.whiny_nils = true + +# Show full error reports and disable caching +config.action_controller.consider_all_requests_local = true +config.action_view.debug_rjs = true +config.action_controller.perform_caching = true + +# Don't care if the mailer can't send +config.action_mailer.raise_delivery_errors = false ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/environments/production.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,24 @@ +# Settings specified here will take precedence over those in config/environment.rb + +# The production environment is meant for finished, "live" apps. +# Code is not reloaded between requests +config.cache_classes = true + +# Enable threaded mode +# config.threadsafe! + +# Use a different logger for distributed setups +# config.logger = SyslogLogger.new + +# Full error reports are disabled and caching is turned on +config.action_controller.consider_all_requests_local = false +config.action_controller.perform_caching = true + +# Use a different cache store in production +# config.cache_store = :mem_cache_store + +# Enable serving of images, stylesheets, and javascripts from an asset server +# config.action_controller.asset_host = "http://assets.example.com" + +# Disable delivery errors, bad email addresses will be ignored +# config.action_mailer.raise_delivery_errors = false ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/environments/test.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,22 @@ +# Settings specified here will take precedence over those in config/environment.rb + +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! +config.cache_classes = true + +# Log error messages when you accidentally call methods on nil. +config.whiny_nils = true + +# Show full error reports and disable caching +config.action_controller.consider_all_requests_local = true +config.action_controller.perform_caching = false + +# Disable request forgery protection in test environment +config.action_controller.allow_forgery_protection = false + +# Tell Action Mailer not to deliver emails to the real world. +# The :test delivery method accumulates sent emails in the +# ActionMailer::Base.deliveries array. +config.action_mailer.delivery_method = :test ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/initializers/inflections.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,10 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/initializers/mime_types.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/initializers/new_rails_defaults.rb Sun Jul 4 00:44:12 2010 @@ -0,0 +1,17 @@ +# These settings change the behavior of Rails 2 apps and will be defaults +# for Rails 3. You can remove this initializer when Rails 3 is released. + +if defined?(ActiveRecord) + # Include Active Record class name as root for JSON serialized output. + ActiveRecord::Base.include_root_in_json = true + + # Store the full class name (including module namespace) in STI type column. + ActiveRecord::Base.store_full_sti_class = true +end + +# Use ISO 8601 format for JSON serialized times and dates. +ActiveSupport.use_standard_json_time_format = true + +# Don't escape HTML entities in JSON, leave that for the #json_escape helper. +# if you're including raw json in an HTML page. +ActiveSupport.escape_html_entities_in_json = false ======================================= --- /dev/null +++ /trunk/examples/al-admin/vendor/locale_rails/sample/config/locales/en.yml Sun Jul 4 00:44:12 2010 @@ -0,0 +1,2 @@ +en: + hello: Hello! ======================================= ***Additional files exist in this changeset.*** From codesite-noreply at google.com Sun Jul 4 03:50:33 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 04 Jul 2010 07:50:33 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1148 committed - * use imported locale_rails. Message-ID: <0016e642d3a023b8c0048a8b13ea@google.com> Revision: 1148 Author: koutou Date: Sun Jul 4 00:46:03 2010 Log: * use imported locale_rails. http://code.google.com/p/ruby-activeldap/source/detail?r=1148 Added: /trunk/examples/al-admin/config/initializers/gettext.rb Modified: /trunk/examples/al-admin/config/environment.rb ======================================= --- /dev/null +++ /trunk/examples/al-admin/config/initializers/gettext.rb Sun Jul 4 00:46:03 2010 @@ -0,0 +1,1 @@ +require 'locale_rails' ======================================= --- /trunk/examples/al-admin/config/environment.rb Sun Dec 13 19:46:47 2009 +++ /trunk/examples/al-admin/config/environment.rb Sun Jul 4 00:46:03 2010 @@ -5,7 +5,7 @@ # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -27,7 +27,7 @@ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" # config.gem "sqlite3-ruby", :lib => "sqlite3" # config.gem "aws-s3", :lib => "aws/s3" - config.gem "locale_rails", :version => "2.0.5" + # config.gem "locale_rails", :version => "2.0.5" config.gem "gettext_rails", :version => "2.1.0" # Only load the plugins named here, in the order given. By default, all plugins From codesite-noreply at google.com Sun Jul 4 04:00:35 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 04 Jul 2010 08:00:35 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1149 committed - * update 1.2.2 entry. Message-ID: <001636163cc905480a048a8b3788@google.com> Revision: 1149 Author: koutou Date: Sun Jul 4 00:59:46 2010 Log: * update 1.2.2 entry. http://code.google.com/p/ruby-activeldap/source/detail?r=1149 Modified: /trunk/CHANGES ======================================= --- /trunk/CHANGES Sun May 30 02:54:01 2010 +++ /trunk/CHANGES Sun Jul 4 00:59:46 2010 @@ -1,7 +1,8 @@ = CHANGES -== 1.2.2: 2010-XX-XX - +== 1.2.2: 2010-07-04 + +* Supported ActiveRecord 2.3.8 and Rails 2.3.8. * [#37] Fixed gem dependencies in Rakefile. [zachwily] * Fixed a bug that setting 'false' but 'nil' is returned. [Hideyuki Yasuda] * Supported non-String attribute value as LDIF value. [Matt Mencel] @@ -13,6 +14,8 @@ * [#44] Accept '0' and '1' as boolean value [projekttabla] * [#27429] Fixed inverted validatation by validate_excluded_classes [Marc Dequ?nes] +* Supported DN attribute value for assosiation replacement. + [J?rg Herzinger] == 1.2.1: 2009-12-15 From codesite-noreply at google.com Sun Jul 4 04:22:10 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 04 Jul 2010 08:22:10 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1150 committed - * add vendor/locale_rails to load_path. Message-ID: <0016e68dba8f390af0048a8b84ab@google.com> Revision: 1150 Author: koutou Date: Sun Jul 4 01:21:21 2010 Log: * add vendor/locale_rails to load_path. http://code.google.com/p/ruby-activeldap/source/detail?r=1150 Modified: /trunk/examples/al-admin/config/environment.rb ======================================= --- /trunk/examples/al-admin/config/environment.rb Sun Jul 4 00:46:03 2010 +++ /trunk/examples/al-admin/config/environment.rb Sun Jul 4 01:21:21 2010 @@ -37,7 +37,8 @@ # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) - config.load_paths += %W(#{RAILS_ROOT}/../../lib) + config.load_paths += ["#{RAILS_ROOT}/../../lib", + "#{RAILS_ROOT}/vendor/locale_rails/lib"] config.plugin_paths += %W(#{RAILS_ROOT}/../..) # Force all environments to use the same logger level From codesite-noreply at google.com Sun Jul 4 06:49:16 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 04 Jul 2010 10:49:16 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1151 committed - fix Rails 2.3.8 auto escape. Message-ID: <001636c5be694a24bd048a8d92cb@google.com> Revision: 1151 Author: koutou Date: Sun Jul 4 03:48:30 2010 Log: fix Rails 2.3.8 auto escape. http://code.google.com/p/ruby-activeldap/source/detail?r=1151 Modified: /trunk/examples/al-admin/app/helpers/users_helper.rb ======================================= --- /trunk/examples/al-admin/app/helpers/users_helper.rb Fri Nov 2 23:30:31 2007 +++ /trunk/examples/al-admin/app/helpers/users_helper.rb Sun Jul 4 03:48:30 2010 @@ -10,7 +10,7 @@ :action => "show", :id => user) if with_edit and current_user and current_user.ldap_user == user edit_link = link_to(_('Edit'), :action => 'edit', :id => user) - result << "\n(#{edit_link})" + result << "\n(" << edit_link << ")" end result end From codesite-noreply at google.com Sun Jul 4 07:35:37 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 04 Jul 2010 11:35:37 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1152 committed - New release tag Message-ID: <00163630f29b189bb6048a8e38a4@google.com> Revision: 1152 Author: koutou Date: Sun Jul 4 04:34:35 2010 Log: New release tag http://code.google.com/p/ruby-activeldap/source/detail?r=1152 Added: /tags/r1.2.2 From codesite-noreply at google.com Sun Jul 4 07:39:38 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 04 Jul 2010 11:39:38 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1153 committed - * 1.2.2 -> 1.2.3. Message-ID: <00163616463b73965a048a8e4608@google.com> Revision: 1153 Author: koutou Date: Sun Jul 4 04:35:19 2010 Log: * 1.2.2 -> 1.2.3. http://code.google.com/p/ruby-activeldap/source/detail?r=1153 Modified: /trunk/lib/active_ldap.rb ======================================= --- /trunk/lib/active_ldap.rb Wed Jun 16 06:18:51 2010 +++ /trunk/lib/active_ldap.rb Sun Jul 4 04:35:19 2010 @@ -915,7 +915,7 @@ end module ActiveLdap - VERSION = "1.2.2" + VERSION = "1.2.3" end if RUBY_PLATFORM.match('linux') From codesite-noreply at google.com Wed Jul 7 04:11:30 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Wed, 07 Jul 2010 08:11:30 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1154 committed - * don't collect all entries in adapter layer. Message-ID: <001636c5c247979a43048ac7b7fc@google.com> Revision: 1154 Author: koutou Date: Wed Jul 7 01:10:12 2010 Log: * don't collect all entries in adapter layer. http://code.google.com/p/ruby-activeldap/source/detail?r=1154 Modified: /trunk/lib/active_ldap/adapter/base.rb /trunk/lib/active_ldap/adapter/jndi.rb /trunk/lib/active_ldap/adapter/jndi_connection.rb /trunk/lib/active_ldap/adapter/ldap.rb /trunk/lib/active_ldap/adapter/net_ldap.rb /trunk/lib/active_ldap/operations.rb ======================================= --- /trunk/lib/active_ldap/adapter/base.rb Sun Apr 25 02:51:56 2010 +++ /trunk/lib/active_ldap/adapter/base.rb Wed Jul 7 01:10:12 2010 @@ -131,11 +131,15 @@ ] base ||= root_dse_values('subschemaSubentry', options)[0] base ||= 'cn=schema' - dn, attributes = search(:base => base, - :scope => :base, - :filter => '(objectClass=subschema)', - :attributes => attrs).first - Schema.new(attributes) + schema = nil + search(:base => base, + :scope => :base, + :filter => '(objectClass=subschema)', + :attributes => attrs, + :limit => 1) do |dn, attributes| + schema = Schema.new(attributes) + end + schema || Schema.new([]) end end @@ -157,17 +161,10 @@ limit = nil if limit <= 0 attrs = attrs.to_a # just in case - - values = [] - callback = Proc.new do |value, block| - value = block.call(value) if block - values << value - end - base = ensure_dn_string(base) begin operation(options) do - yield(base, scope, filter, attrs, limit, callback) + yield(base, scope, filter, attrs, limit) end rescue LdapError::NoSuchObject, LdapError::InvalidDnSyntax # Do nothing on failure @@ -176,8 +173,6 @@ _("Ignore error %s(%s): filter %s: attributes: %s") % args end end - - values end def delete(targets, options={}) @@ -622,7 +617,7 @@ end def root_dse_values(key, options={}) - dse = root_dse([key], options)[0] + dse = root_dse([key], options) return [] if dse.nil? normalized_key = key.downcase dse.each do |_key, _value| @@ -632,11 +627,14 @@ end def root_dse(attrs, options={}) + found_attributes = nil search(:base => "", :scope => :base, - :attributes => attrs).collect do |dn, attributes| - attributes + :attributes => attrs, + :limit => 1) do |dn, attributes| + found_attributes = attributes end + found_attributes end def construct_uri(host, port, ssl) ======================================= --- /trunk/lib/active_ldap/adapter/jndi.rb Fri Mar 5 22:27:48 2010 +++ /trunk/lib/active_ldap/adapter/jndi.rb Wed Jul 7 01:10:12 2010 @@ -42,13 +42,12 @@ end def search(options={}, &block) - super(options) do |base, scope, filter, attrs, limit, callback| + super(options) do |base, scope, filter, attrs, limit| info = { :base => base, :scope => scope_name(scope), :filter => filter, :attributes => attrs, :limit => limit, } - execute(:search, info, - base, scope, filter, attrs, limit, callback, &block) + execute(:search, info, base, scope, filter, attrs, limit, &block) end end ======================================= --- /trunk/lib/active_ldap/adapter/jndi_connection.rb Fri Mar 5 22:34:42 2010 +++ /trunk/lib/active_ldap/adapter/jndi_connection.rb Wed Jul 7 01:10:12 2010 @@ -105,7 +105,7 @@ bound? end - def search(base, scope, filter, attrs, limit, callback, &block) + def search(base, scope, filter, attrs, limit) controls = SearchControls.new controls.search_scope = scope @@ -121,7 +121,7 @@ value.is_a?(String) ? value : String.from_java_bytes(value) end end - callback.call([result.name_in_namespace, attributes], block) + yield([result.name_in_namespace, attributes]) end end ======================================= --- /trunk/lib/active_ldap/adapter/ldap.rb Sun Apr 25 02:51:56 2010 +++ /trunk/lib/active_ldap/adapter/ldap.rb Wed Jul 7 01:10:12 2010 @@ -79,8 +79,8 @@ end end - def search(options={}, &block) - super(options) do |base, scope, filter, attrs, limit, callback| + def search(options={}) + super(options) do |base, scope, filter, attrs, limit| begin info = { :base => base, :scope => scope_name(scope), @@ -92,7 +92,7 @@ entry.attrs.each do |attr| attributes[attr] = entry.vals(attr) end - callback.call([entry.dn, attributes], block) + yield([entry.dn, attributes]) end rescue RuntimeError if $!.message == "no result returned by search" ======================================= --- /trunk/lib/active_ldap/adapter/net_ldap.rb Sun Mar 21 04:38:18 2010 +++ /trunk/lib/active_ldap/adapter/net_ldap.rb Wed Jul 7 01:10:12 2010 @@ -62,8 +62,8 @@ end end - def search(options={}, &block) - super(options) do |base, scope, filter, attrs, limit, callback| + def search(options={}) + super(options) do |base, scope, filter, attrs, limit| args = { :base => base, :scope => scope, @@ -80,7 +80,7 @@ entry.original_attribute_names.each do |name| attributes[name] = entry[name] end - callback.call([entry.dn, attributes], block) + yield([entry.dn, attributes]) end end end ======================================= --- /trunk/lib/active_ldap/operations.rb Sun Apr 25 03:26:20 2010 +++ /trunk/lib/active_ldap/operations.rb Wed Jul 7 01:10:12 2010 @@ -62,7 +62,8 @@ } options[:connection] ||= connection - values = options[:connection].search(search_options) do |dn, attrs| + values = [] + options[:connection].search(search_options) do |dn, attrs| attributes = {} attrs.each do |key, _value| normalized_attr, normalized_value = @@ -70,7 +71,7 @@ attributes[normalized_attr] ||= [] attributes[normalized_attr].concat(normalized_value) end - [dn, attributes] + values << [dn, attributes] end values = values.collect {|_value| yield(_value)} if block_given? values From codesite-noreply at google.com Thu Jul 8 01:09:00 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Thu, 08 Jul 2010 05:09:00 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1155 committed - * ignore nil value attribute. #40.... Message-ID: <0016368e1e15c479a8048ad9482e@google.com> Revision: 1155 Author: koutou Date: Wed Jul 7 22:08:36 2010 Log: * ignore nil value attribute. #40. Reported by christian.pennaforte. Thanks!!! http://code.google.com/p/ruby-activeldap/source/detail?r=1155 Modified: /trunk/README /trunk/lib/active_ldap/adapter/ldap.rb /trunk/lib/active_ldap/adapter/net_ldap.rb ======================================= --- /trunk/README Sun May 30 02:32:02 2010 +++ /trunk/README Wed Jul 7 22:08:36 2010 @@ -146,3 +146,4 @@ * Anthony M. Martinez: Helped SASL options support * ilusi0n.x: A bug report. * projekttabla: A suggestion. +* christian.pennaforte: A bug report. ======================================= --- /trunk/lib/active_ldap/adapter/ldap.rb Wed Jul 7 01:10:12 2010 +++ /trunk/lib/active_ldap/adapter/ldap.rb Wed Jul 7 22:08:36 2010 @@ -90,7 +90,8 @@ info, base, scope, filter, attrs, limit) do |entry| attributes = {} entry.attrs.each do |attr| - attributes[attr] = entry.vals(attr) + value = entry.vals(attr) + attributes[attr] = value if value end yield([entry.dn, attributes]) end ======================================= --- /trunk/lib/active_ldap/adapter/net_ldap.rb Wed Jul 7 01:10:12 2010 +++ /trunk/lib/active_ldap/adapter/net_ldap.rb Wed Jul 7 22:08:36 2010 @@ -78,7 +78,8 @@ execute(:search, info, args) do |entry| attributes = {} entry.original_attribute_names.each do |name| - attributes[name] = entry[name] + value = entry[name] + attributes[name] = value if value end yield([entry.dn, attributes]) end From codesite-noreply at google.com Fri Jul 9 09:31:06 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Fri, 09 Jul 2010 13:31:06 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1157 committed - * escape ":" in filter value. [#48]... Message-ID: <0016e645abb04611b0048af46a98@google.com> Revision: 1157 Author: koutou Date: Fri Jul 9 05:49:15 2010 Log: * escape ":" in filter value. [#48] Reported by planetmcd. Thanks!!! http://code.google.com/p/ruby-activeldap/source/detail?r=1157 Modified: /trunk/README /trunk/lib/active_ldap/adapter/base.rb /trunk/test/test_adapter.rb /trunk/test/test_base.rb ======================================= --- /trunk/README Fri Jul 9 05:48:00 2010 +++ /trunk/README Fri Jul 9 05:49:15 2010 @@ -148,3 +148,4 @@ * ilusi0n.x: A bug report. * projekttabla: A suggestion. * christian.pennaforte: A bug report. +* planetmcd: A bug report. ======================================= --- /trunk/lib/active_ldap/adapter/base.rb Wed Jul 7 01:10:12 2010 +++ /trunk/lib/active_ldap/adapter/base.rb Fri Jul 9 05:49:15 2010 @@ -498,7 +498,7 @@ when Time value = Schema::GeneralizedTime.new.normalize_value(value) end - value.gsub(/(?:[()\\\0]|\*\*?)/) do |s| + value.gsub(/(?:[:()\\\0]|\*\*?)/) do |s| if s == "*" s else ======================================= --- /trunk/test/test_adapter.rb Fri Feb 13 18:06:10 2009 +++ /trunk/test/test_adapter.rb Fri Jul 9 05:49:15 2010 @@ -37,6 +37,7 @@ assert_parse_filter("(uid=Alice\\2ABob)", {:uid => "Alice**Bob"}) assert_parse_filter("(uid=Alice\\2A*\\5CBob)", {:uid => "Alice***\\Bob"}) assert_parse_filter("(uid=Alice\\5C\\2A*Bob)", {:uid => "Alice\\***Bob"}) + assert_parse_filter("(uid=Alice\\3ABob)", {:uid => "Alice:Bob"}) end def test_empty_filter ======================================= --- /trunk/test/test_base.rb Sun Apr 25 03:23:26 2010 +++ /trunk/test/test_base.rb Fri Jul 9 05:49:15 2010 @@ -6,6 +6,14 @@ include AlTestUtils priority :must + def test_search_colon_value + make_temporary_group(:cn => "temp:group") do |group| + assert_equal("temp:group", group.cn) + assert_not_nil(@group_class.find("temp:group")) + end + end + + priority :normal def test_lower_case_object_class fixture_file = fixture("lower_case_object_class_schema.rb") schema_entries = eval(File.read(fixture_file)) @@ -30,7 +38,6 @@ assert_equal("1.555.5551234", target.umpn) end - priority :normal def test_set_and_get_false user = @user_class.new user.sn = false From codesite-noreply at google.com Fri Jul 9 09:38:20 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Fri, 09 Jul 2010 13:38:20 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1158 committed - * don't use Timeout.alarm with Ruby/LDAP. Timeout.timeout is... Message-ID: <0016e68dba8f2b7337048af484d2@google.com> Revision: 1158 Author: koutou Date: Fri Jul 9 06:25:42 2010 Log: * don't use Timeout.alarm with Ruby/LDAP. Timeout.timeout is always used for Ruby/LDAP. http://code.google.com/p/ruby-activeldap/source/detail?r=1158 Modified: /trunk/lib/active_ldap/adapter/base.rb /trunk/lib/active_ldap/adapter/ldap.rb ======================================= --- /trunk/lib/active_ldap/adapter/base.rb Fri Jul 9 05:49:15 2010 +++ /trunk/lib/active_ldap/adapter/base.rb Fri Jul 9 06:25:42 2010 @@ -313,7 +313,7 @@ n_retries = 0 retry_limit = options[:retry_limit] || @retry_limit begin - Timeout.alarm(@timeout, &block) + do_in_timeout(@timeout, &block) rescue Timeout::Error => e @logger.error {_('Requested action timed out.')} if @retry_on_timeout and retry_limit < 0 and n_retries <= retry_limit @@ -328,6 +328,10 @@ end end + def do_in_timeout(timeout, &block) + Timeout.alarm(timeout, &block) + end + def sasl_bind(bind_dn, options={}) # Get all SASL mechanisms mechanisms = operation(options) do ======================================= --- /trunk/lib/active_ldap/adapter/ldap.rb Wed Jul 7 22:08:36 2010 +++ /trunk/lib/active_ldap/adapter/ldap.rb Fri Jul 9 06:25:42 2010 @@ -183,6 +183,10 @@ end end + def do_in_timeout(timeout, &block) + Timeout.timeout(timeout, &block) + end + def ensure_method(method) normalized_method = method.to_s.downcase Method.constants.each do |name|