aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/locale-2.0.5
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gems/locale-2.0.5')
-rw-r--r--vendor/gems/locale-2.0.5/.specification112
-rw-r--r--vendor/gems/locale-2.0.5/COPYING56
-rw-r--r--vendor/gems/locale-2.0.5/ChangeLog157
-rw-r--r--vendor/gems/locale-2.0.5/README.rdoc111
-rw-r--r--vendor/gems/locale-2.0.5/Rakefile82
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale.rb329
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/data/languages.tab.gzbin62732 -> 0 bytes
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/data/regions.tab.gzbin2125 -> 0 bytes
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/driver/cgi.rb136
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/driver/env.rb64
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/driver/jruby.rb52
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/driver/posix.rb49
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/driver/win32.rb81
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/driver/win32_table.rb298
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/info.rb12
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/info/language.rb135
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/info/region.rb75
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/tag.rb39
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/tag/cldr.rb99
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/tag/common.rb129
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/tag/irregular.rb40
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/tag/posix.rb97
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/tag/rfc.rb112
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/tag/simple.rb162
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/taglist.rb109
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/util/memoizable.rb108
-rw-r--r--vendor/gems/locale-2.0.5/lib/locale/version.rb12
-rw-r--r--vendor/gems/locale-2.0.5/samples/cgi/README20
-rwxr-xr-xvendor/gems/locale-2.0.5/samples/cgi/cookie.cgi62
-rwxr-xr-xvendor/gems/locale-2.0.5/samples/cgi/http.rb52
-rwxr-xr-xvendor/gems/locale-2.0.5/samples/cgi/index.cgi90
-rw-r--r--vendor/gems/locale-2.0.5/samples/cgi/locale.css115
-rw-r--r--vendor/gems/locale-2.0.5/samples/rack/README10
-rw-r--r--vendor/gems/locale-2.0.5/samples/rack/hello_rack.rb17
-rw-r--r--vendor/gems/locale-2.0.5/samples/rack/hello_rack.ru5
-rw-r--r--vendor/gems/locale-2.0.5/samples/sample_1.rb25
-rw-r--r--vendor/gems/locale-2.0.5/samples/sample_info.rb6
-rw-r--r--vendor/gems/locale-2.0.5/setup.rb1585
-rw-r--r--vendor/gems/locale-2.0.5/test/test_detect_cgi.rb216
-rw-r--r--vendor/gems/locale-2.0.5/test/test_detect_general.rb164
-rw-r--r--vendor/gems/locale-2.0.5/test/test_driver_jruby.rb43
-rw-r--r--vendor/gems/locale-2.0.5/test/test_driver_win32.rb65
-rw-r--r--vendor/gems/locale-2.0.5/test/test_info.rb28
-rw-r--r--vendor/gems/locale-2.0.5/test/test_memoizable.rb133
-rw-r--r--vendor/gems/locale-2.0.5/test/test_tag.rb1233
-rw-r--r--vendor/gems/locale-2.0.5/test/test_taglist.rb34
-rw-r--r--vendor/gems/locale-2.0.5/test/test_thread.rb37
47 files changed, 0 insertions, 6596 deletions
diff --git a/vendor/gems/locale-2.0.5/.specification b/vendor/gems/locale-2.0.5/.specification
deleted file mode 100644
index 0150358f4..000000000
--- a/vendor/gems/locale-2.0.5/.specification
+++ /dev/null
@@ -1,112 +0,0 @@
---- !ruby/object:Gem::Specification
-name: locale
-version: !ruby/object:Gem::Version
- hash: 5
- prerelease:
- segments:
- - 2
- - 0
- - 5
- version: 2.0.5
-platform: ruby
-authors:
-- Masao Mutoh
-autorequire:
-bindir: bin
-cert_chain: []
-
-date: 2009-11-13 00:00:00 +00:00
-default_executable:
-dependencies: []
-
-description: " Ruby-Locale is the pure ruby library which provides basic APIs for localization.\n"
-email: mutomasa at gmail.com
-executables: []
-
-extensions: []
-
-extra_rdoc_files: []
-
-files:
-- lib/locale.rb
-- lib/locale/tag/posix.rb
-- lib/locale/tag/irregular.rb
-- lib/locale/tag/rfc.rb
-- lib/locale/tag/simple.rb
-- lib/locale/tag/cldr.rb
-- lib/locale/tag/common.rb
-- lib/locale/taglist.rb
-- lib/locale/driver/posix.rb
-- lib/locale/driver/win32.rb
-- lib/locale/driver/win32_table.rb
-- lib/locale/driver/jruby.rb
-- lib/locale/driver/env.rb
-- lib/locale/driver/cgi.rb
-- lib/locale/util/memoizable.rb
-- lib/locale/data/regions.tab.gz
-- lib/locale/data/languages.tab.gz
-- lib/locale/info/region.rb
-- lib/locale/info/language.rb
-- lib/locale/version.rb
-- lib/locale/info.rb
-- lib/locale/tag.rb
-- setup.rb
-- test/test_tag.rb
-- test/test_memoizable.rb
-- test/test_driver_jruby.rb
-- test/test_info.rb
-- test/test_driver_win32.rb
-- test/test_detect_general.rb
-- test/test_taglist.rb
-- test/test_detect_cgi.rb
-- test/test_thread.rb
-- Rakefile
-- README.rdoc
-- ChangeLog
-- COPYING
-- samples/rack/hello_rack.ru
-- samples/rack/hello_rack.rb
-- samples/rack/README
-- samples/sample_info.rb
-- samples/cgi/http.rb
-- samples/cgi/locale.css
-- samples/cgi/index.cgi
-- samples/cgi/README
-- samples/cgi/cookie.cgi
-- samples/sample_1.rb
-has_rdoc: true
-homepage: http://locale.rubyforge.org/
-licenses: []
-
-post_install_message:
-rdoc_options: []
-
-require_paths:
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
-required_rubygems_version: !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
-requirements: []
-
-rubyforge_project: locale
-rubygems_version: 1.4.2
-signing_key:
-specification_version: 3
-summary: Ruby-Locale is the pure ruby library which provides basic APIs for localization.
-test_files: []
-
diff --git a/vendor/gems/locale-2.0.5/COPYING b/vendor/gems/locale-2.0.5/COPYING
deleted file mode 100644
index 9043404a8..000000000
--- a/vendor/gems/locale-2.0.5/COPYING
+++ /dev/null
@@ -1,56 +0,0 @@
-Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
-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.
diff --git a/vendor/gems/locale-2.0.5/ChangeLog b/vendor/gems/locale-2.0.5/ChangeLog
deleted file mode 100644
index 851da0ccc..000000000
--- a/vendor/gems/locale-2.0.5/ChangeLog
+++ /dev/null
@@ -1,157 +0,0 @@
-= locale-2.0.5 (2009-11-11)
- * Update license information(obiviously Ruby's and LGPL).
- [Pointed out by Masateru Yoshikawa]
-
-= locale-2.0.4 (2009-05-22)
- * Enhance Win32 support. [Reported by Dice]
- * Enhance JRuby support
- * Fixed a waring with ruby -d option.
- * Update version.
-
-= locale-2.0.3 (2009-05-09)
- * Update version.
-
-= locale-2.0.2 (2009-05-04)
- * Add Locale.set_app_language_tags to restrict the target locales whole the application. [Suggested by Vladimir Dobriakov]
- * locale/driver/cgi.rb: Add Locale.set_request.
- * sample/rack: Add a sample for rack.
- * Improve documents.
- * Fix bugs
- * Illegular -> Irregular [by Denis Defreyne]
- * test_thread.rb doesn't work under the environment where LC_ALL is set .
- [Reported by Hans de Graaff (Bug#24831)]
- * Fixed Locale::Drive::CGI.charset don't work when accept_charset is nil.
- [Reported by hallelujah (Bug#25583)]
- * Fixed Locale::Drive::Win32.charset don't work.
-
-Thanks to:
- Denis Defreyne, Hans de Graaff, hallelujah, Vladimir Dobriakov
-
-= locale-2.0.1 (2009-04-18)
- * Locale::Tag::Common#extensions are shown order by the keys.[reported by
- Dan Coutu]
- * Enhance to support ruby-1.9.x [by OZAWA Sakuro]
- * Reimplement memoize to be able to freeze or dup the object.
- * Improve Locale.candidates.
-
- Thanks to:
- Dan Coutu, OZAWA Sakuro
-
-= locale-2.0.0 (2009-03-21)
- * Support Rack.
- * move to github from svn.
-
-== Older format.
-2008-12-04 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/util/memoizable.rb: Modified.
-
-2008-12-03 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/tag/*.rb: Add attribute writer to subtags.
- * lib/locale/tag/*.rb: Remove tag attributes.
- * lib/locale/tag/common.rb: Variant accept 3 or later size because of RFC3066 compatibility.
- * test/test_tag.rb: Add tests.
-
-2008-12-01 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/driver/win32.rb: Work on Win32 again.
-
-2008-11-22 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale.rb: Rename Locale.current_language_tags to Locale.candidates.
- Locale.current_charset to Locale.charset.
-
-2008-11-21 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/tag/simple.rb: Add Locale::Tag::Simple#to_str.
- * lib/locale.rb: Remove set_current_charset. current_charset becomes read only.
-
-2008-11-20 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/driver/cgi.rb: Accept plural lang values(query string and
- cookies).
-
-2008-11-19 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale.rb: Locale.current_language_tags returns Locale::TagList.
- * lib/tag/*.rb: Add #candidates method.
-
-2008-11-12 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/util/meoizable.rb: Added.
-
-2008-11-03 Masao Mutoh <mutoh@highway.ne.jp>
-
- * README: Updated.
- * Rakefile: Add package tasks. Revise RDoc task.
- * lib/locale/driver/win32.rb, win32_table.rb, jruby.rb: Work on Windows.
-
-2008-10-29 Masao Mutoh <mutoh@highway.ne.jp>
-
- * samples/cgi/*.rb: Added CGI sample (Based on Ruby-GetText sample).
-
-2008-10-21 Masao Mutoh <mutoh@highway.ne.jp>
-
- * samples/sample1.rb: Added.
-
-2008-10-07 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/*.rb: Support Ruby 1.9.
-
-2008-10-01 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/*.rb: Support JRuby. Tested on JRuby 1.1.4.
-
-2008-09-26 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/driver/*: Apply tags.
- * lib/locale/taglist.rb: Added. An array of tags. Also, it behaves
- as the first tag in the array.
- * test/test_detect_general.rb: Added.
-
-2008-09-25 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/tag.rb, lib/locale/tag/*: Added. Support rfc4646/posix/cldr
- language tags powerfully.
- * lib/locale/object.rb: Removed(Moved to tags).
- * test/test_tag.rb: Added.
-
-2008-09-21 Masao Mutoh <mutoh@highway.ne.jp>
-
- * test/*: Added.
-
-2008-09-02 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale.rb: Added Locale.current_language_tags which returns
- language tags strings as an Array order by priority.
-
-2008-08-20 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale/info/language.rb, region.rb: Move from
- lib/locale/language.rb, country.rb.
-
-2008-08-18 Masao Mutoh <mutoh@highway.ne.jp>
-
- * lib/locale.rb: Remove Locale.codeset, .charset, .current_charset.
- Use Locale.get.charset instead.
- Add Locale.current_preferable_locales, supported_locales,
- .set_supported_locales
-
-2008-08-10 Masao Mutoh <mutoh@highway.ne.jp>
-
- * Separates this locale library from Ruby-GetText-Package-1.92.0.
- * lib/locale/country.rb, language.rb: Merge locale-0.1 by Brian Pontarelli.
- Reimplement Locale::Language and Locale::Country. All APIs don't have
- backward compatibility from locale-0.1.
- * lib/locale/data/countries.tab.gz, languages.tab.gz: Merge from locale-0.1.
- * lib/locale/base.rb, win32.rb, win32_table.rb, posix.rb, jruby.rb, cgi.rb:
- Move to lib/locale/driver/.
- These classes detect the user/system locale (the language tag or
- the charset) from the environment variables or the system APIs
- (Win32/Java). Support POSIX, Win32, JRuby, CGI and ENV.
-
- * lib/locale.rb: Add Locale.init.
- * lib/locale/info.rb: Added.
- * lib/locale.rb: Locale.set_current becomes thread safe. Each thread has
- a current locale.
diff --git a/vendor/gems/locale-2.0.5/README.rdoc b/vendor/gems/locale-2.0.5/README.rdoc
deleted file mode 100644
index 381032f7e..000000000
--- a/vendor/gems/locale-2.0.5/README.rdoc
+++ /dev/null
@@ -1,111 +0,0 @@
-= Ruby-Locale
-
-Ruby-Locale is the pure ruby library which provides basic and general purpose
-APIs for localization.
-It aims to support all environments which ruby works and all kind of programs
-(GUI, WWW, library, etc), and becomes the hub of other i18n/l10n libs/apps to
-handle major locale ID standards.
-
-* Manage Locale ID(Language Tag)
- * Each thread has a Locale ID.
- * POSIX, CLDR, IETF(RFC4646, 3066(BCP47)), Win32 and Java language tags
- and convert the tag string to each other.
- * Auto detect Locale ID.
- POSIX(Unix/Linux/*BSD), Win32, JRuby, CGI.
-
-* Resources
- * ISO 639-3 languages
- * ISO 3166 region(countries).
-
-* Support Ruby 1.8.7, Ruby 1.9.1, JRuby 1.1.4. Tested on Win32 and Linux.
-
-== Website
-* http://www.yotabanana.com/hiki/ruby-locale.html
-* http://locale.rubyforge.org/
-
-== Requirements
-* Ruby-1.8.7 or later <http://www.ruby-lang.org/ja/>
-* JRuby-1.1.4 or later <http://jruby.codehaus.org/>
-
-== Install
-* gem:
- ($ su)
- # gem install locale
-
-* tar-ball:
- Download tar-ball from http://rubyforge.org/projects/locale/
- De-Compress archive and enter its top directory.
- Then type:
- ($ su)
- # ruby setup.rb
-
-== The simplest usage
-
- require 'rubygems'
- require 'locale'
-
- p Locale.candidates
-
-== APIs
-The most important APIs are defined in Locale module.
-
-* Locale.candidates - Returns the current locale candidates.
-* Locale.current= - Sets the current locale(in a thread).
-* Locale.default= - Sets the default locale(in the whole program).
-* Locale.set_app_language_tags - Sets the locale that is supported by the App.
-
-== 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).
-
-* locale/language.rb, locale/region.rb,
- locale/data/language.tab.gz, locale/data/region.tab.gz:
- * Copyright (C) 2006 Brian Pontarelli, Antonio Terceiro
- * Copyright (C) 2008,2009 Masao Mutoh <mutomasa at gmail.com>
-
-* setup.rb version 3.4.1
- * Copyright (C) 2000-2005 Minero Aoki <aamine at loveruby.net>
- * This file is released under LGPL. See the top of the setup.rb.
-
-* Others(Some files are separated from Ruby-GetText-Package-1.92.0)
- * Copyright (C) 2008,2009 Masao Mutoh <mutoh at highwhay.ne.jp>
-
-== References
-=== Other libraries
-* langtag-0.1.0
- * by Martin Dürst <http://rubyforge.org/projects/langtag/>
-
-* memoizable.rb
- * from ActiveSupport-2.2.0 <http://rubyforge.org/projects/activesupport/>
-
-* Ruby-GetText-Package-1.92.0
- * by Masao Mutoh <http://www.yotabanana.com/hiki/ruby-gettext.html>
-
-=== Documents
-* The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition
- Internationalization Variables
- <http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html>
-
-* GNU `gettext' utilities - Setting the Locale through Environment Variables
- <http://www.gnu.org/software/gettext/manual/gettext.html#Setting-the-POSIX-Locale>
-
-* BCP47 / RFC4646, RFC3066 - Tags for Identifying Languages (Keep RFC3066 compatibility)
- <http://www.ietf.org/rfc/rfc4646.txt>
- <http://www.ietf.org/rfc/rfc3066.txt>
-
-* Unicode Locale Data Markup Language (LDML) 1.6.1
- Unicode Language and Locale Identifiers
- <http://www.unicode.org/reports/tr35/tr35-11.html#Unicode_Language_and_Locale_Identifiers>
-
-* JDK 6 Documentation - Java Supported Locales
- <http://java.sun.com/javase/6/docs/technotes/guides/intl/locale.doc.html>
-
-* Microsoft Developer Network - Locales and Languages
- <http://msdn.microsoft.com/en-us/library/ms776264(VS.85).aspx>
-
-* ISO 639
-
-* ISO 3166
-
-== Maintainer
-Masao Mutoh <mutomasa at gmail.com>
diff --git a/vendor/gems/locale-2.0.5/Rakefile b/vendor/gems/locale-2.0.5/Rakefile
deleted file mode 100644
index 28fae03f1..000000000
--- a/vendor/gems/locale-2.0.5/Rakefile
+++ /dev/null
@@ -1,82 +0,0 @@
-$:.unshift "./lib"
-
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-
-require 'locale/version'
-
-#desc "Default Task"
-#task :default => [ :test ]
-
-PKG_VERSION = Locale::VERSION
-
-# Run the unit tests
-task :test do
- Dir.glob("test/test_*.rb").each do |v|
- ruby "-Ilib #{v}"
- end
-end
-
-Rake::RDocTask.new { |rdoc|
- begin
- allison = `allison --path`.chop
- rescue Exception
- allison = ""
- end
- rdoc.rdoc_dir = 'doc'
- rdoc.title = "Ruby-Locale library"
- rdoc.options << "--line-numbers" << "--inline-source" <<
- "--accessor" << "cattr_accessor=object" << "--charset" << "utf-8"
- rdoc.rdoc_files.include('README.rdoc')
- rdoc.rdoc_files.include('ChangeLog')
- rdoc.rdoc_files.add('lib')
- rdoc.template = allison if allison.size > 0
-}
-
-desc "Create gem and tar.gz"
-spec = Gem::Specification.new do |s|
- s.name = 'locale'
- s.version = PKG_VERSION
- s.summary = 'Ruby-Locale is the pure ruby library which provides basic APIs for localization.'
- 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/}
- s.require_path = 'lib'
- s.bindir = 'bin'
- s.has_rdoc = true
- s.description = <<-EOF
- Ruby-Locale is the pure ruby library which provides basic APIs for localization.
- EOF
-end
-
-unless RUBY_PLATFORM =~ /win32/
- Rake::PackageTask.new("ruby-locale", PKG_VERSION) do |o|
- o.package_files = FileList['**/*'].to_a.select{|v| v !~ /pkg|CVS/}
- o.need_tar_gz = true
- o.need_zip = false
- end
-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",
- PKG_VERSION,
- "pkg/locale-#{PKG_VERSION}.gem",
- "pkg/ruby-locale-#{PKG_VERSION}.tar.gz")
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale.rb b/vendor/gems/locale-2.0.5/lib/locale.rb
deleted file mode 100644
index f56de3783..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale.rb
+++ /dev/null
@@ -1,329 +0,0 @@
-=begin
- locale.rb - Locale module
-
- Copyright (C) 2002-2009 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- Original: Ruby-GetText-Package-1.92.0.
-
- $Id: locale.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require 'locale/util/memoizable'
-require 'locale/tag'
-require 'locale/taglist'
-require 'locale/version'
-
-# Locale module manages the locale informations of the application.
-# These functions are the most important APIs in this library.
-# Almost of all i18n/l10n programs use this APIs only.
-module Locale
- @@default_tag = nil
- @@locale_driver_module = nil
-
- ROOT = File.dirname(__FILE__)
-
- include Locale::Util::Memoizable
-
- module_function
- def require_driver(name) #:nodoc:
- require File.join(ROOT, "locale/driver", name.to_s)
- end
-
- def create_language_tag(tag) #:nodoc:
- if tag
- if tag.kind_of? Locale::Tag::Simple
- tag
- else
- Locale::Tag.parse(tag)
- end
- else
- nil
- end
- end
-
- # Initialize Locale library.
- # Usually, you don't need to call this directly, because
- # this is called when Locale's methods are called.
- #
- # If you use this library with CGI or the kind of CGI.
- # You need to call Locale.init(:driver => :cgi).
- #
- # ==== For Framework designers/programers:
- # If your framework is for WWW, call this once like: Locale.init(:driver => :cgi).
- #
- # ==== To Application programers:
- # If your framework doesn't use ruby-locale and the application is for WWW,
- # call this once like: Locale.init(:driver => :cgi).
- #
- # ==== To Library authors:
- # Don't call this, even if your application is only for WWW.
- #
- # * opts: Options as a Hash.
- # * :driver - The driver. :cgi if you use Locale module with CGI,
- # nil if you use system locale.
- # (ex) Locale.init(:driver => :cgi)
- #
- def init(opts = {})
- if opts[:driver]
- require_driver opts[:driver]
- else
- if /cygwin|mingw|win32/ =~ RUBY_PLATFORM
- require_driver 'win32'
- elsif /java/ =~ RUBY_PLATFORM
- require_driver 'jruby'
- else
- require_driver 'posix'
- end
- end
- end
-
- # Gets the driver module.
- #
- # Usually you don't need to call this method.
- #
- # * Returns: the driver module.
- def driver_module
- unless @@locale_driver_module
- Locale.init
- end
- @@locale_driver_module
- end
-
- DEFAULT_LANGUAGE_TAG = Locale::Tag::Simple.new("en") #:nodoc:
-
- # Sets the default locale as the language tag
- # (Locale::Tag's class or String(such as "ja_JP")).
- #
- # * tag: the default language_tag
- # * Returns: self.
- def set_default(tag)
- Thread.list.each do |thread|
- thread[:current_languages] = nil
- thread[:candidates_caches] = nil
- end
- @@default_tag = create_language_tag(tag)
- self
- end
-
- # Same as Locale.set_default.
- #
- # * locale: the default locale (Locale::Tag's class) or a String such as "ja-JP".
- # * Returns: locale.
- def default=(tag)
- set_default(tag)
- @@default_tag
- end
-
- # Gets the default locale(language tag).
- #
- # If the default language tag is not set, this returns nil.
- #
- # * Returns: the default locale (Locale::Tag's class).
- def default
- @@default_tag || DEFAULT_LANGUAGE_TAG
- end
-
- # Sets the locales of the current thread order by the priority.
- # Each thread has a current locales.
- # The system locale/default locale is used if the thread doesn't have current locales.
- #
- # * tag: Locale::Language::Tag's class or the language tag as a String. nil if you need to
- # clear current locales.
- # * charset: the charset (override the charset even if the locale name has charset) or nil.
- # * Returns: self
- #
- # (e.g.)
- # Locale.set_current("ja_JP.eucJP")
- # Locale.set_current("ja-JP")
- # Locale.set_current("en_AU", "en_US", ...)
- # Locale.set_current(Locale::Tag::Simple.new("ja", "JP"), ...)
- def set_current(*tags)
- languages = nil
- if tags[0]
- languages = Locale::TagList.new
- tags.each do |tag|
- languages << create_language_tag(tag)
- end
- end
- Thread.current[:current_languages] = languages
- Thread.current[:candidates_caches] = nil
- self
- end
-
- # Sets a current locale. This is a single argument version of Locale.set_current.
- #
- # * tag: the language tag such as "ja-JP"
- # * Returns: an Array of the current locale (Locale::Tag's class).
- #
- # Locale.current = "ja-JP"
- # Locale.current = "ja_JP.eucJP"
- def current=(tag)
- set_current(tag)
- Thread.current[:current_languages]
- end
-
- # Gets the current locales (Locale::Tag's class).
- # If the current locale is not set, this returns system/default locale.
- #
- # This method returns the current language tags even if it isn't included in app_language_tags.
- #
- # Usually, the programs should use Locale.candidates to find the correct locale, not this method.
- #
- # * Returns: an Array of the current locales (Locale::Tag's class).
- def current
- unless Thread.current[:current_languages]
- loc = driver_module.locales
- Thread.current[:current_languages] = loc ? loc : Locale::TagList.new([default])
- end
- Thread.current[:current_languages]
- end
-
- # Deprecated.
- def get #:nodoc:
- current
- end
-
- # Deprecated.
- def set(tag) #:nodoc:
- set_current(tag)
- end
-
- # Returns the language tags which are variations of the current locales order by priority.
- #
- # For example, if the current locales are ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT"],
- # then returns ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT", "en_Latn_GB", "en_GB", "ja", "en"].
- # "en" is the default locale(You can change it using set_default).
- # The default locale is added at the end of the list even if it isn't exist.
- #
- # Usually, this method is used to find the locale data as the path(or a kind of IDs).
- # * options: options as a Hash or nil.
- # * :supported_language_tags -
- # An Array of the language tags order by the priority. This option
- # restricts the locales which are supported by the library/application.
- # Default is nil if you don't need to restrict the locales.
- # (e.g.1) ["fr_FR", "en_GB", "en_US", ...]
- # * :type -
- # The type of language tag. :common, :rfc, :cldr, :posix and
- # :simple are available. Default value is :common
- def candidates(options = {})
- opts = {:supported_language_tags => nil, :current => current,
- :type => :common}.merge(options)
-
- if Thread.current[:candidates_caches]
- cache = Thread.current[:candidates_caches][opts.hash]
- return cache if cache
- else
- Thread.current[:candidates_caches] = {}
- end
- Thread.current[:candidates_caches][opts.hash] =
- collect_candidates(opts[:type], opts[:current],
- opts[:supported_language_tags])
- end
-
- # collect tag candidates and memoize it.
- # The result is shared from all threads.
- def collect_candidates(type, tags, supported_tags) # :nodoc:
- candidate_tags = tags.collect{|v| v.send("to_#{type}").candidates}
- default_tags = default.send("to_#{type}").candidates
- if app_language_tags
- app_tags = app_language_tags.collect{|v| v.send("to_#{type}")}.flatten.uniq
- end
- if supported_tags
- supported_tags = supported_tags.collect{|v| Locale::Tag.parse(v).send("to_#{type}")}.flatten.uniq
- end
-
- tags = []
- (0...candidate_tags[0].size).each {|i|
- tags += candidate_tags.collect{|v| v[i]}
- }
- tags += default_tags
- tags.uniq!
-
- all_tags = nil
- if app_tags
- if supported_tags
- all_tags = app_tags & supported_tags
- else
- all_tags = app_tags
- end
- elsif supported_tags
- all_tags = supported_tags
- end
- if all_tags
- tags &= all_tags
- tags = default_tags.uniq if tags.size == 0
- end
-
- Locale::TagList.new(tags)
- end
- memoize :collect_candidates
-
- # Gets the current charset.
- #
- # This returns the current user/system charset. This value is
- # read only, so you can't set it by yourself.
- #
- # * Returns: the current charset.
- def charset
- driver_module.charset || "UTF-8"
- end
- memoize :charset
-
- # Clear current locale.
- # * Returns: self
- def clear
- Thread.current[:current_languages] = nil
- Thread.current[:candidates_caches] = nil
- self
- end
-
- # Clear all locales and charsets of all threads.
- # This doesn't clear the default and app_language_tags.
- # Use Locale.default = nil to unset the default locale.
- # * Returns: self
- def clear_all
- Thread.list.each do |thread|
- thread[:current_languages] = nil
- thread[:candidates_caches] = nil
- end
- memoize_clear
- self
- end
-
- @@app_language_tags = nil
- # Set the language tags which is supported by the Application.
- # This value is same with supported_language_tags in Locale.candidates
- # to restrict the result but is the global setting.
- # If you set a language tag, the application works as the single locale
- # application.
- #
- # If the current locale is not included in app_language_tags,
- # Locale.default value is used.
- # Use Locale.set_default() to set correct language
- # if "en" is not included in the language tags.
- #
- # Set nil if clear the value.
- #
- # Note that the libraries/plugins shouldn't set this value.
- #
- # (e.g.) Locale.set_app_language_tags("fr_FR", "en-GB", "en_US", ...)
- def set_app_language_tags(*tags)
- if tags[0]
- @@app_language_tags = tags.collect{|v| Locale::Tag.parse(v)}
- else
- @@app_language_tags = nil
- end
-
- clear_all
- self
- end
-
- # Returns the app_language_tags. Default is nil. See set_app_language_tags for more details.
- def app_language_tags
- @@app_language_tags
- end
-
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/data/languages.tab.gz b/vendor/gems/locale-2.0.5/lib/locale/data/languages.tab.gz
deleted file mode 100644
index 7658a03f0..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/data/languages.tab.gz
+++ /dev/null
Binary files differ
diff --git a/vendor/gems/locale-2.0.5/lib/locale/data/regions.tab.gz b/vendor/gems/locale-2.0.5/lib/locale/data/regions.tab.gz
deleted file mode 100644
index b5ecbfbec..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/data/regions.tab.gz
+++ /dev/null
Binary files differ
diff --git a/vendor/gems/locale-2.0.5/lib/locale/driver/cgi.rb b/vendor/gems/locale-2.0.5/lib/locale/driver/cgi.rb
deleted file mode 100644
index c1d1126dd..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/driver/cgi.rb
+++ /dev/null
@@ -1,136 +0,0 @@
-=begin
- locale/driver/cgi.rb
-
- Copyright (C) 2002-2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- Original: Ruby-GetText-Package-1.92.0.
-
- $Id: cgi.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-module Locale
- # Locale::Driver module for CGI.
- # Detect the user locales and the charset from CGI parameters.
- # This is a low-level class. Application shouldn't use this directly.
- module Driver
- module CGI
- $stderr.puts self.name + " is loaded." if $DEBUG
-
- module_function
- # Gets required locales from CGI parameters. (Based on RFC2616)
- #
- # Returns: An Array of Locale::Tag's subclasses
- # (QUERY_STRING "lang" > COOKIE "lang" > HTTP_ACCEPT_LANGUAGE > "en")
- #
- def locales
- req = Thread.current[:current_request]
- return nil unless req
-
- locales = []
-
- # QUERY_STRING "lang"
- if langs = req[:query_langs]
- langs.each do |lang|
- locales << Locale::Tag.parse(lang)
- end
- end
-
- unless locales.size > 0
- # COOKIE "lang"
- if langs = req[:cookie_langs]
- langs.each do |lang|
- locales << Locale::Tag.parse(lang) if lang.size > 0
- end
- end
- end
-
- unless locales.size > 0
- # HTTP_ACCEPT_LANGUAGE
- if lang = req[:accept_language] and lang.size > 0
- locales += lang.gsub(/\s/, "").split(/,/).map{|v| v.split(";q=")}.map{|j| [j[0], j[1] ? j[1].to_f : 1.0]}.sort{|a,b| -(a[1] <=> b[1])}.map{|v| Locale::Tag.parse(v[0])}
- end
- end
-
- locales.size > 0 ? Locale::TagList.new(locales.uniq) : nil
- end
-
- # Gets the charset from CGI parameters. (Based on RFC2616)
- # * Returns: the charset (HTTP_ACCEPT_CHARSET or nil).
- def charset
- req = Thread.current[:current_request]
- return nil unless req
-
- charsets = req[:accept_charset]
- if charsets and charsets.size > 0
- num = charsets.index(',')
- charset = num ? charsets[0, num] : charsets
- charset = nil if charset == "*"
- else
- charset = nil
- end
- charset
- end
-
- # Set a request.
- #
- # * query_langs: An Array of QUERY_STRING value "lang".
- # * cookie_langs: An Array of cookie value "lang".
- # * accept_language: The value of HTTP_ACCEPT_LANGUAGE
- # * accept_charset: The value of HTTP_ACCEPT_CHARSET
- def set_request(query_langs, cookie_langs, accept_language, accept_charset)
- Thread.current[:current_request] = {
- :query_langs => query_langs,
- :cookie_langs => cookie_langs,
- :accept_language => accept_language,
- :accept_charset => accept_charset
- }
- self
- end
-
- # Clear the current request.
- def clear_current_request
- Thread.current[:current_request] = nil
- end
- end
- end
-
- @@locale_driver_module = Driver::CGI
-
- module_function
- # Sets a request values for lang/charset.
- #
- # * query_langs: An Array of QUERY_STRING value "lang".
- # * cookie_langs: An Array of cookie value "lang".
- # * accept_language: The value of HTTP_ACCEPT_LANGUAGE
- # * accept_charset: The value of HTTP_ACCEPT_CHARSET
- def set_request(query_langs, cookie_langs, accept_language, accept_charset)
- @@locale_driver_module.set_request(query_langs, cookie_langs, accept_language, accept_charset)
- self
- end
-
- # Sets a CGI object. This is the convenient function of set_request().
- #
- # This method is appeared when Locale.init(:driver => :cgi) is called.
- #
- # * cgi: CGI object
- # * Returns: self
- def set_cgi(cgi)
- set_request(cgi.params["lang"], cgi.cookies["lang"],
- cgi.accept_language, cgi.accept_charset)
- self
- end
-
- # Sets a CGI object.This is the convenient function of set_request().
- #
- # This method is appeared when Locale.init(:driver => :cgi) is called.
- #
- # * cgi: CGI object
- # * Returns: cgi
- def cgi=(cgi)
- set_cgi(cgi)
- cgi
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/driver/env.rb b/vendor/gems/locale-2.0.5/lib/locale/driver/env.rb
deleted file mode 100644
index 9d0995fa2..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/driver/env.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-=begin
- locale/env.rb
-
- Copyright (C) 2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- Original: Ruby-GetText-Package-1.92.0.
-
- $Id: env.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require 'locale/tag'
-require 'locale/taglist'
-
-module Locale
- module Driver
- # Locale::Driver::Env module.
- # Detect the user locales and the charset.
- # All drivers(except CGI) refer environment variables first and use it
- # as the locale if it's defined.
- # This is a low-level module. Application shouldn't use this directly.
- module Env
- module_function
-
- # Gets the locale from environment variable. (LC_ALL > LC_MESSAGES > LANG)
- # Returns: the locale as Locale::Tag::Posix.
- def locale
- # At least one environment valiables should be set on *nix system.
- [ENV["LC_ALL"], ENV["LC_MESSAGES"], ENV["LANG"]].each do |loc|
- if loc != nil and loc.size > 0
- return Locale::Tag::Posix.parse(loc)
- end
- end
- nil
- end
-
- # Gets the locales from environment variables. (LANGUAGE > LC_ALL > LC_MESSAGES > LANG)
- # * Returns: an Array of the locale as Locale::Tag::Posix or nil.
- def locales
- if (locales = ENV["LANGUAGE"])
- Locale::TagList.new(locales.split(/:/).collect{|v| Locale::Tag::Posix.parse(v)})
- elsif (loc = locale)
- Locale::TagList.new([loc])
- else
- nil
- end
- end
-
- # Gets the charset from environment variable or return nil.
- # * Returns: the system charset.
- def charset # :nodoc:
- if loc = locale
- loc.charset
- else
- nil
- end
- end
-
- end
- end
-end
-
diff --git a/vendor/gems/locale-2.0.5/lib/locale/driver/jruby.rb b/vendor/gems/locale-2.0.5/lib/locale/driver/jruby.rb
deleted file mode 100644
index d30348dbe..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/driver/jruby.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-=begin
- locale/driver/jruby.rb
-
- Copyright (C) 2007,2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- Original: Ruby-GetText-Package-1.92.0.
-
- $Id: jruby.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require File.join(File.dirname(__FILE__), 'env')
-require 'java'
-
-module Locale
- module Driver
- # Locale::Driver::JRuby module for JRuby
- # Detect the user locales and the charset.
- # This is a low-level class. Application shouldn't use this directly.
- module JRuby
- $stderr.puts self.name + " is loaded." if $DEBUG
-
- module_function
- def locales #:nodoc:
- locales = ::Locale::Driver::Env.locales
- unless locales
- locale = java.util.Locale.getDefault
- variant = locale.getVariant
- variants = []
- if variant != nil and variant.size > 0
- variants = [variant]
- end
- locales = TagList.new([Locale::Tag::Common.new(locale.getLanguage, nil,
- locale.getCountry,
- variants)])
- end
- locales
- end
-
- def charset #:nodoc:
- charset = ::Locale::Driver::Env.charset
- unless charset
- charset = java.nio.charset.Charset.defaultCharset.name
- end
- charset
- end
- end
- end
- @@locale_driver_module = Driver::JRuby
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/driver/posix.rb b/vendor/gems/locale-2.0.5/lib/locale/driver/posix.rb
deleted file mode 100644
index cf918efbe..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/driver/posix.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-=begin
- locale/posix.rb
-
- Copyright (C) 2002-2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- Original: Ruby-GetText-Package-1.92.0.
-
- $Id: posix.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require File.join(File.dirname(__FILE__), 'env')
-
-module Locale
- # Locale::Driver::Posix module for Posix OS (Unix)
- # Detect the user locales and the charset.
- # This is a low-level class. Application shouldn't use this directly.
- module Driver
- module Posix
- $stderr.puts self.name + " is loaded." if $DEBUG
-
- module_function
- # Gets the locales from environment variables. (LANGUAGE > LC_ALL > LC_MESSAGES > LANG)
- # Only LANGUAGE accept plural languages such as "nl_BE;
- # * Returns: an Array of the locale as Locale::Tag::Posix or nil.
- def locales
- ::Locale::Driver::Env.locales
- end
-
- # Gets the charset from environment variable or the result of
- # "locale charmap" or nil.
- # * Returns: the system charset.
- def charset
- charset = ::Locale::Driver::Env.charset
- unless charset
- charset = `locale charmap`.strip
- unless $? && $?.success?
- charset = nil
- end
- end
- charset
- end
- end
- end
- @@locale_driver_module = Driver::Posix
-end
-
diff --git a/vendor/gems/locale-2.0.5/lib/locale/driver/win32.rb b/vendor/gems/locale-2.0.5/lib/locale/driver/win32.rb
deleted file mode 100644
index 2bb6fbc4c..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/driver/win32.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-=begin
- locale/win32.rb
-
- Copyright (C) 2002-2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- Original: Ruby-GetText-Package-1.92.0.
-
- $Id: win32.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require File.join(File.dirname(__FILE__), 'env')
-require File.join(File.dirname(__FILE__), 'win32_table')
-require 'dl/win32'
-
-
-module Locale
- # Locale::Driver::Win32 module for win32.
- # Detect the user locales and the charset.
- # This is a low-level class. Application shouldn't use this directly.
- module Driver
- module Win32
- include Win32Table
-
- $stderr.puts self.name + " is loaded." if $DEBUG
-
- @@win32 = nil
- @@current_locale_id = nil
-
- module_function
-
- # Gets the Win32 charset of the locale.
- def charset
- charset = ::Locale::Driver::Env.charset
- unless charset
- if locales
- tag = locales[0].to_rfc.to_s
- loc = LocaleTable.find{|v| v[1] == tag}
- loc = LocaleTable.find{|v| v[1] =~ /^#{locales[0].language}/} unless loc
- charset = loc ? loc[2] : nil
- else
- charset = "CP1252"
- end
- end
- charset
- end
-
- def thread_locale_id #:nodoc:
- if @@current_locale_id
- @@current_locale_id
- else
- @@win32 ||= Win32API.new("kernel32.dll", "GetThreadLocale", nil, "i")
- @@win32.call
- end
- end
-
- def set_thread_locale_id(lcid) #:nodoc:
- # for testing.
- @@current_locale_id = lcid
- end
-
- def locales #:nodoc:
- locales = ::Locale::Driver::Env.locales
- unless locales
- lang = LocaleTable.assoc(thread_locale_id)
- if lang
- ret = Locale::Tag::Common.parse(lang[1])
- locales = Locale::TagList.new([ret])
- else
- locales = nil
- end
- end
- locales
- end
- end
- end
- @@locale_driver_module = Driver::Win32
-end
-
diff --git a/vendor/gems/locale-2.0.5/lib/locale/driver/win32_table.rb b/vendor/gems/locale-2.0.5/lib/locale/driver/win32_table.rb
deleted file mode 100644
index e1fd68a1b..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/driver/win32_table.rb
+++ /dev/null
@@ -1,298 +0,0 @@
-=begin
- win32_table.rb - Locale table for win32
-
- Copyright (C) 2008 Masao Mutoh <mutomasa at gmail.com>
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- Original: Ruby-GetText-Package-1.92.0.
-
- $Id: win32_table.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-module Locale
- module Driver
- module Win32Table
-
- #http://msdn.microsoft.com/ja-jp/goglobal/bb896001(en-us).aspx
-
- #LangID, locale name, code page
- LocaleTable = [
- [0x0036,"af","CP1252"],
- [0x0436,"af-ZA","CP1252"],
- [0x001C,"sq","CP1250"],
- [0x041C,"sq-AL","CP1250"],
- [0x0484,"gsw-FR","CP1252"],
- [0x045E,"am-ET","UNICODE"],
- [0x0001,"ar","CP1256"],
- [0x1401,"ar-DZ","CP1256"],
- [0x3C01,"ar-BH","CP1256"],
- [0x0C01,"ar-EG","CP1256"],
- [0x0801,"ar-IQ","CP1256"],
- [0x2C01,"ar-JO","CP1256"],
- [0x3401,"ar-KW","CP1256"],
- [0x3001,"ar-LB","CP1256"],
- [0x1001,"ar-LY","CP1256"],
- [0x1801,"ar-MA","CP1256"],
- [0x2001,"ar-OM","CP1256"],
- [0x4001,"ar-QA","CP1256"],
- [0x0401,"ar-SA","CP1256"],
- [0x2801,"ar-SY","CP1256"],
- [0x1C01,"ar-TN","CP1256"],
- [0x3801,"ar-AE","CP1256"],
- [0x2401,"ar-YE","CP1256"],
- [0x002B,"hy","UNICODE"],
- [0x042B,"hy-AM","UNICODE"],
- [0x044D,"as-IN","UNICODE"],
- [0x002C,"az","CP1254"],
- [0x082C,"az-Cyrl-AZ","CP1251"],
- [0x042C,"az-Latn-AZ","CP1254"],
- [0x046D,"ba-RU","CP1251"],
- [0x002D,"eu","CP1252"],
- [0x042D,"eu-ES","CP1252"],
- [0x0023,"be","CP1251"],
- [0x0423,"be-BY","CP1251"],
- [0x0845,"bn-BD","UNICODE"],
- [0x0445,"bn-IN","UNICODE"],
- [0x201A,"bs-Cyrl-BA","CP1251"],
- [0x141A,"bs-Latn-BA","CP1250"],
- [0x047E,"br-FR","CP1252"],
- [0x0002,"bg","CP1251"],
- [0x0402,"bg-BG","CP1251"],
- [0x0003,"ca","CP1252"],
- [0x0403,"ca-ES","CP1252"],
- [0x0C04,"zh-HK","CP950"],
- [0x1404,"zh-MO","CP950"],
- [0x0804,"zh-CN","CP936"],
- [0x0004,"zh-Hans","CP936"],
- [0x1004,"zh-SG","CP936"],
- [0x0404,"zh-TW","CP950"],
- [0x7C04,"zh-Hant","CP950"],
- [0x0483,"co-FR","CP1252"],
- [0x001A,"hr","CP1250"],
- [0x041A,"hr-HR","CP1250"],
- [0x101A,"hr-BA","CP1250"],
- [0x0005,"cs","CP1250"],
- [0x0405,"cs-CZ","CP1250"],
- [0x0006,"da","CP1252"],
- [0x0406,"da-DK","CP1252"],
- [0x048C,"prs-AF","CP1256"],
- [0x0065,"div","UNICODE"],
- [0x0465,"div-MV","UNICODE"],
- [0x0013,"nl","CP1252"],
- [0x0813,"nl-BE","CP1252"],
- [0x0413,"nl-NL","CP1252"],
- [0x0009,"en","CP1252"],
- [0x0C09,"en-AU","CP1252"],
- [0x2809,"en-BZ","CP1252"],
- [0x1009,"en-CA","CP1252"],
- [0x2409,"en-029","CP1252"],
- [0x4009,"en-IN","CP1252"],
- [0x1809,"en-IE","CP1252"],
- [0x2009,"en-JM","CP1252"],
- [0x4409,"en-MY","CP1252"],
- [0x1409,"en-NZ","CP1252"],
- [0x3409,"en-PH","CP1252"],
- [0x4809,"en-SG","CP1252"],
- [0x1C09,"en-ZA","CP1252"],
- [0x2C09,"en-TT","CP1252"],
- [0x0809,"en-GB","CP1252"],
- [0x0409,"en-US","CP1252"],
- [0x3009,"en-ZW","CP1252"],
- [0x0025,"et","CP1257"],
- [0x0425,"et-EE","CP1257"],
- [0x0038,"fo","CP1252"],
- [0x0438,"fo-FO","CP1252"],
- [0x0464,"fil-PH","CP1252"],
- [0x000B,"fi","CP1252"],
- [0x040B,"fi-FI","CP1252"],
- [0x000C,"fr","CP1252"],
- [0x080C,"fr-BE","CP1252"],
- [0x0C0C,"fr-CA","CP1252"],
- [0x040C,"fr-FR","CP1252"],
- [0x140C,"fr-LU","CP1252"],
- [0x180C,"fr-MC","CP1252"],
- [0x100C,"fr-CH","CP1252"],
- [0x0462,"fy-NL","CP1252"],
- [0x0056,"gl","CP1252"],
- [0x0456,"gl-ES","CP1252"],
- [0x0037,"ka","UNICODE"],
- [0x0437,"ka-GE","UNICODE"],
- [0x0007,"de","CP1252"],
- [0x0C07,"de-AT","CP1252"],
- [0x0407,"de-DE","CP1252"],
- [0x1407,"de-LI","CP1252"],
- [0x1007,"de-LU","CP1252"],
- [0x0807,"de-CH","CP1252"],
- [0x0008,"el","CP1253"],
- [0x0408,"el-GR","CP1253"],
- [0x046F,"kl-GL","CP1252"],
- [0x0047,"gu","UNICODE"],
- [0x0447,"gu-IN","UNICODE"],
- [0x0468,"ha-Latn-NG","CP1252"],
- [0x000D,"he","CP1255"],
- [0x040D,"he-IL","CP1255"],
- [0x0039,"hi","UNICODE"],
- [0x0439,"hi-IN","UNICODE"],
- [0x000E,"hu","CP1250"],
- [0x040E,"hu-HU","CP1250"],
- [0x000F,"is","CP1252"],
- [0x040F,"is-IS","CP1252"],
- [0x0470,"ig-NG","CP1252"],
- [0x0021,"id","CP1252"],
- [0x0421,"id-ID","CP1252"],
- [0x085D,"iu-Latn-CA","CP1252"],
- [0x045D,"iu-Cans-CA","UNICODE"],
- [0x083C,"ga-IE","CP1252"],
- [0x0434,"xh-ZA","CP1252"],
- [0x0435,"zu-ZA","CP1252"],
- [0x0010,"it","CP1252"],
- [0x0410,"it-IT","CP1252"],
- [0x0810,"it-CH","CP1252"],
- [0x0011,"ja","CP932"],
- [0x0411,"ja-JP","CP932"],
- [0x004B,"kn","UNICODE"],
- [0x044B,"kn-IN","UNICODE"],
- [0x003F,"kk","CP1251"],
- [0x043F,"kk-KZ","CP1251"],
- [0x0453,"km-KH","UNICODE"],
- [0x0486,"qut-GT","CP1252"],
- [0x0487,"rw-RW","CP1252"],
- [0x0041,"sw","CP1252"],
- [0x0441,"sw-KE","CP1252"],
- [0x0057,"kok","UNICODE"],
- [0x0457,"kok-IN","UNICODE"],
- [0x0012,"ko","CP949"],
- [0x0412,"ko-KR","CP949"],
- [0x0040,"ky","CP1251"],
- [0x0440,"ky-KG","CP1251"],
- [0x0454,"lo-LA","UNICODE"],
- [0x0026,"lv","CP1257"],
- [0x0426,"lv-LV","CP1257"],
- [0x0027,"lt","CP1257"],
- [0x0427,"lt-LT","CP1257"],
- [0x082E,"wee-DE","CP1252"],
- [0x046E,"lb-LU","CP1252"],
- [0x002F,"mk","CP1251"],
- [0x042F,"mk-MK","CP1251"],
- [0x003E,"ms","CP1252"],
- [0x083E,"ms-BN","CP1252"],
- [0x043E,"ms-MY","CP1252"],
- [0x044C,"ml-IN","UNICODE"],
- [0x043A,"mt-MT","UNICODE"],
- [0x0481,"mi-NZ","UNICODE"],
- [0x047A,"arn-CL","CP1252"],
- [0x004E,"mr","UNICODE"],
- [0x044E,"mr-IN","UNICODE"],
- [0x047C,"moh-CA","CP1252"],
- [0x0050,"mn","CP1251"],
- [0x0450,"mn-MN","CP1251"],
- [0x0850,"mn-Mong-CN","UNICODE"],
- [0x0461,"ne-NP","UNICODE"],
- [0x0014,"no","CP1252"],
- [0x0414,"nb-NO","CP1252"],
- [0x0814,"nn-NO","CP1252"],
- [0x0482,"oc-FR","CP1252"],
- [0x0448,"or-IN","UNICODE"],
- [0x0463,"ps-AF","UNICODE"],
- [0x0029,"fa","CP1256"],
- [0x0429,"fa-IR","CP1256"],
- [0x0015,"pl","CP1250"],
- [0x0415,"pl-PL","CP1250"],
- [0x0016,"pt","CP1252"],
- [0x0416,"pt-BR","CP1252"],
- [0x0816,"pt-PT","CP1252"],
- [0x0046,"pa","UNICODE"],
- [0x0446,"pa-IN","UNICODE"],
- [0x046B,"quz-BO","CP1252"],
- [0x086B,"quz-EC","CP1252"],
- [0x0C6B,"quz-PE","CP1252"],
- [0x0018,"ro","CP1250"],
- [0x0418,"ro-RO","CP1250"],
- [0x0417,"rm-CH","CP1252"],
- [0x0019,"ru","CP1251"],
- [0x0419,"ru-RU","CP1251"],
- [0x243B,"smn-FI","CP1252"],
- [0x103B,"smj-NO","CP1252"],
- [0x143B,"smj-SE","CP1252"],
- [0x0C3B,"se-FI","CP1252"],
- [0x043B,"se-NO","CP1252"],
- [0x083B,"se-SE","CP1252"],
- [0x203B,"sms-FI","CP1252"],
- [0x183B,"sma-NO","CP1252"],
- [0x1C3B,"sma-SE","CP1252"],
- [0x004F,"sa","UNICODE"],
- [0x044F,"sa-IN","UNICODE"],
- [0x7C1A,"sr","CP1251"],
- [0x1C1A,"sr-Cyrl-BA","CP1251"],
- [0x0C1A,"sr-Cyrl-SP","CP1251"],
- [0x181A,"sr-Latn-BA","CP1250"],
- [0x081A,"sr-Latn-SP","CP1250"],
- [0x046C,"nso-ZA","CP1252"],
- [0x0432,"tn-ZA","CP1252"],
- [0x045B,"si-LK","UNICODE"],
- [0x001B,"sk","CP1250"],
- [0x041B,"sk-SK","CP1250"],
- [0x0024,"sl","CP1250"],
- [0x0424,"sl-SI","CP1250"],
- [0x000A,"es","CP1252"],
- [0x2C0A,"es-AR","CP1252"],
- [0x400A,"es-BO","CP1252"],
- [0x340A,"es-CL","CP1252"],
- [0x240A,"es-CO","CP1252"],
- [0x140A,"es-CR","CP1252"],
- [0x1C0A,"es-DO","CP1252"],
- [0x300A,"es-EC","CP1252"],
- [0x440A,"es-SV","CP1252"],
- [0x100A,"es-GT","CP1252"],
- [0x480A,"es-HN","CP1252"],
- [0x080A,"es-MX","CP1252"],
- [0x4C0A,"es-NI","CP1252"],
- [0x180A,"es-PA","CP1252"],
- [0x3C0A,"es-PY","CP1252"],
- [0x280A,"es-PE","CP1252"],
- [0x500A,"es-PR","CP1252"],
- [0x0C0A,"es-ES","CP1252"],
- [0x540A,"es-US","CP1252"],
- [0x380A,"es-UY","CP1252"],
- [0x200A,"es-VE","CP1252"],
- [0x001D,"sv","CP1252"],
- [0x081D,"sv-FI","CP1252"],
- [0x041D,"sv-SE","CP1252"],
- [0x005A,"syr","UNICODE"],
- [0x045A,"syr-SY","UNICODE"],
- [0x0428,"tg-Cyrl-TJ","CP1251"],
- [0x085F,"tmz-Latn-DZ","CP1252"],
- [0x0049,"ta","UNICODE"],
- [0x0449,"ta-IN","UNICODE"],
- [0x0044,"tt","CP1251"],
- [0x0444,"tt-RU","CP1251"],
- [0x004A,"te","UNICODE"],
- [0x044A,"te-IN","UNICODE"],
- [0x001E,"th","CP874"],
- [0x041E,"th-TH","CP874"],
- [0x0451,"bo-CN","UNICODE"],
- [0x001F,"tr","CP1254"],
- [0x041F,"tr-TR","CP1254"],
- [0x0442,"tk-TM","CP1250"],
- [0x0480,"ug-CN","CP1256"],
- [0x0022,"uk","CP1251"],
- [0x0422,"uk-UA","CP1251"],
- [0x042E,"wen-DE","CP1252"],
- [0x0020,"ur","CP1256"],
- [0x0420,"ur-PK","CP1256"],
- [0x0043,"uz","CP1254"],
- [0x0843,"uz-Cyrl-UZ","CP1251"],
- [0x0443,"uz-Latn-UZ","CP1254"],
- [0x002A,"vi","CP1258"],
- [0x042A,"vi-VN","CP1258"],
- [0x0452,"cy-GB","CP1252"],
- [0x0488,"wo-SN","CP1252"],
- [0x0485,"sah-RU","CP1251"],
- [0x0478,"ii-CN","UNICODE"],
- [0x046A,"yo-NG","CP1252"],
- ]
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/info.rb b/vendor/gems/locale-2.0.5/lib/locale/info.rb
deleted file mode 100644
index 1aac39115..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/info.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-=begin
-
- info.rb - Load Locale::Info::Language and Locale::Info::Region.
-
- Copyright (C) 2008 Masao Mutoh
-
- $Id: info.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require 'locale/info/language'
-require 'locale/info/region'
-
diff --git a/vendor/gems/locale-2.0.5/lib/locale/info/language.rb b/vendor/gems/locale-2.0.5/lib/locale/info/language.rb
deleted file mode 100644
index b14752354..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/info/language.rb
+++ /dev/null
@@ -1,135 +0,0 @@
-# encoding: UTF-8
-=begin
-
- language.rb - Locale::Info::Language class
-
- Copyright (C) 2008 Masao Mutoh
-
- Original Author:: Brian Pontarelli
-
- $Id: language.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require 'zlib'
-
-module Locale
-
- module Info
- # This class contains all the of the ISO information for the ISO 639-3
- # languages. This class is immutable once constructed.
- class Language
- attr_reader :two_code, :three_code, :scope, :type, :name
-
- #
- # Constructs a new Language instance.
- #
- # * code The 2 or 3 digit ISO 639-3 language code.
- # * scope A single character that defines the ISO scope of the language - <tt>(I)ndividual</tt>,
- # <tt>(M)acrolanguage</tt>, or <tt>(S)pecial</tt>.
- # * type A single character that defines the ISO type of the language - <tt>(A)ncient</tt>,
- # <tt>(C)onstructed</tt>, <tt>(E)xtinct</tt>, <tt>(H)istorical</tt>, <tt>(L)iving</tt>,
- # or <tt>(S)pecial</tt>.
- # * name The name of the language.
- #
- def initialize(two_code, three_code, scope, type, name)
- @two_code, @three_code, @scope, @type, @name = two_code, three_code, scope, type, name
-
- @individual = (scope == "I")
- @macro = (scope == "M")
- @special = (scope == "S")
- @constructed = (type == "C")
- @living = (type == "L")
- @extinct = (type == "E")
- @ancient = (type == "A")
- @historical = (type == "H")
- @special_type = (type == "S")
- end
-
- # Returns true if the language is an individual language according to the ISO 639-3 data.
- def individual?; @individual; end
-
- # Returns true if the language is a macro language according to the ISO 639-3 data.
- def macro?; @macro; end
-
- # Returns true if the language is a special language according to the ISO 639-3 data.
- def special?; @special; end
-
- # Returns true if the language is a constructed language according to the ISO 639-3 data.
- def constructed?; @constructed; end
-
- # Returns true if the language is a living language according to the ISO 639-3 data.
- def living?; @living; end
-
- # Returns true if the language is an extinct language according to the ISO 639-3 data.
- def extinct?; @extinct; end
-
- # Returns true if the language is an ancient language according to the ISO 639-3 data.
- def ancient?; @ancient; end
-
- # Returns true if the language is an historical language according to the ISO 639-3 data.
- def historical?; @historical; end
-
- # Returns true if the language is a special type language according to the ISO 639-3 data.
- def special_type?; @special_type; end
-
- # Returns the two or three code.
- def to_s
- two_code || tree_code
- end
-
- # Returns this object is valid as ISO 639 data.
- def iso_language?
- @@lang_two_codes[two_code] != nil || @@lang_three_codes[three_code] != nil
- end
- end
-
- @@lang_two_codes = Hash.new
- @@lang_three_codes = Hash.new
-
- Zlib::GzipReader.open(File.dirname(__FILE__) + "/../data/languages.tab.gz") do |gz|
- gz.readlines.each do |l|
- l.force_encoding('UTF-8') if l.respond_to?(:force_encoding)
- unless l =~ /^\s*$/
- parts = l.split(/\t/)
- lang = Language.new(parts[2], parts[0], parts[3], parts[4], parts[5].strip)
- @@lang_three_codes[parts[0]] = lang
- @@lang_two_codes[parts[2]] = lang if parts[2].length > 0
- end
- end
- end
-
- module_function
-
- # Returns a hash of all the ISO languages. The hash is {String, language} where
- # the string is the 3 digit language code from the ISO 639 data. This contains
- # all of the data from the ISO 639-3 data (7600 Languages).
- #
- # Need to require 'locale/info' or 'locale/language'.
- def three_languages
- @@lang_three_codes
- end
-
- # Returns a hash of all the ISO languages. The hash is {String, language} where
- # the string is the 2 digit language code from the ISO 639-1 data. This contains
- # all of the data from the ISO 639-1 data (186 Languages).
- #
- # Need to require 'locale/info' or 'locale/language'.
- def two_languages
- @@lang_two_codes
- end
-
- # Returns the language for the given 2 or 3 digit code.
- #
- # Need to require 'locale/info' or 'locale/language'.
- def get_language(code)
- @@lang_three_codes[code] || @@lang_two_codes[code]
- end
-
- # Returns the language code is valid.
- #
- # Need to require 'locale/info' or 'locale/language'.
- def language_code?(code)
- get_language(code) != nil
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/info/region.rb b/vendor/gems/locale-2.0.5/lib/locale/info/region.rb
deleted file mode 100644
index daf192410..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/info/region.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-# encoding: UTF-8
-=begin
-
- region.rb - Locale::Info::Region class
-
- Copyright (C) 2008 Masao Mutoh
-
- First Author:: Brian Pontarelli
-
- $Id: region.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require 'zlib'
-
-module Locale
-
- module Info
- # This class models out a region/country from the ISO 3166 standard for region codes.
- # In ISO3166, it's called "Country" but Ruby/Locale the word "Region" instead.
- class Region
- attr_reader :code, :name
-
- # code:: The 2 or 3 digit ISO 3166 region code.
- # name:: The name of the region.
- def initialize(code, name)
- @code = code
- @name = name
- end
-
- def iso_region?
- @@regions[code] != nil
- end
-
- def to_s
- "#{code}"
- end
- end
-
- @@regions = Hash.new
- Zlib::GzipReader.open(File.dirname(__FILE__) + "/../data/regions.tab.gz") do |gz|
- gz.readlines.each do |l|
- l.force_encoding('UTF-8') if l.respond_to?(:force_encoding)
- unless l =~ /^\s*$/
- parts = l.split(/\t/)
- region = Region.new(parts[0], parts[1].strip)
- @@regions[parts[0]] = region
- end
- end
- end
-
- module_function
-
- # Returns a hash of all the ISO regions. The hash is {String, Region} where
- # the string is the 2 digit region code from the ISO 3166 data.
- #
- # You need to require 'locale/info' or 'locale/region'.
- def regions
- @@regions
- end
-
- # Returns the region for the given code.
- #
- # You need to require 'locale/info' or 'locale/info/region'.
- def get_region(code)
- @@regions[code]
- end
-
- # Returns the region code is valid.
- #
- # You need to require 'locale/info' or 'locale/info/region'.
- def valid_region_code?(code)
- @@regions[code] != nil
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/tag.rb b/vendor/gems/locale-2.0.5/lib/locale/tag.rb
deleted file mode 100644
index f4be35ad3..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/tag.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-=begin
- tag.rb - Locale::Tag module
-
- Copyright (C) 2008,2009 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-=end
-
-require 'locale/tag/simple'
-require 'locale/tag/irregular'
-require 'locale/tag/common'
-require 'locale/tag/rfc'
-require 'locale/tag/cldr'
-require 'locale/tag/posix'
-require 'locale/util/memoizable'
-
-module Locale
-
- # Language tag / locale identifiers.
- module Tag
- include Util::Memoizable
- module_function
- # Parse a language tag/locale name and return Locale::Tag
- # object.
- # * tag: a tag as a String. e.g.) ja-Hira-JP
- # * Returns: a Locale::Tag subclass.
- def parse(tag)
- # Common is not used here.
- [Simple, Common, Rfc, Cldr, Posix].each do |parser|
- ret = parser.parse(tag)
- return ret if ret
- end
- Locale::Tag::Irregular.new(tag)
- end
- memoize :parse
- end
-end
-
diff --git a/vendor/gems/locale-2.0.5/lib/locale/tag/cldr.rb b/vendor/gems/locale-2.0.5/lib/locale/tag/cldr.rb
deleted file mode 100644
index 0a52d836d..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/tag/cldr.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-=begin
- locale/tag/cldr.rb - Locale::Tag::CLDR
-
- Copyright (C) 2008,2009 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-=end
-
-require 'locale/tag/common'
-
-module Locale
- module Tag
-
- # Unicode locale identifier class for CLDR-1.6.1.
- # (Unicode Common Locale Data Repository).
- class Cldr < Common
-
- VARIANT = "(#{ALPHANUM}{5,8}|#{DIGIT}#{ALPHANUM}{3})"
- EXTENSION = "#{ALPHANUM}+=[a-z0-9\-]+"
-
- TAG_RE = /\A#{LANGUAGE}(?:[-_]#{SCRIPT})?
- (?:[-_]#{REGION})?((?:[-_]#{VARIANT})*
- (?:@(#{EXTENSION};?)+)*)\Z/ix
-
- attr_reader :extensions
-
- class << self
- include Util::Memoizable
- # Parse the language tag and return the new Locale::Tag::CLDR.
- def parse(tag)
- if tag =~ /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
- nil
- elsif tag =~ TAG_RE
- lang, script, region, subtag = $1, $2, $3, $4
-
- extensions = {}
- subtag.scan(/#{EXTENSION}/i).each{|v|
- subtag.sub!(v, "")
- key, type = v.split("=")
- extensions[key] = type
- }
- variants = subtag.scan(/#{VARIANT}/i).collect{|v| v[0].upcase}
-
- ret = self.new(lang, script, region, variants, extensions)
- ret.tag = tag
- ret
- else
- nil
- end
- end
- memoize_dup :parse
- end
-
- # Create Locale::Tag::Cldr.
- #
- # variants should be upcase.
- def initialize(language, script = nil, region = nil,
- variants = [], extensions = {})
- @extensions = extensions
- super(language, script, region, variants.map{|v| v.upcase})
- end
-
- # Sets the extensions as an Hash.
- def extensions=(val)
- clear
- @extensions = val
- end
-
- private
- def convert_to(klass) # :nodoc:
- if klass == Cldr
- klass.new(language, script, region, variants, extensions)
- elsif klass == Rfc
- exts = []
- @extensions.to_a.sort.each do |k, v|
- exts << "k-#{k[0,8]}-#{v[0,8]}"
- end
-
- klass.new(language, script, region, variants, exts)
- else
- super
- end
- end
-
- # Returns the language tag.
- # (e.g.) "ja_Hira_JP_VARIANT1_VARIANT2@foo1=var1;foo2=var2"
- #
- # This is used in internal only. Use to_s instead.
- def to_string
- s = super
- if @extensions.size > 0
- s << "@" << @extensions.to_a.sort.map{|k, v| "#{k}=#{v}"}.join(";")
- end
- s
- end
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/tag/common.rb b/vendor/gems/locale-2.0.5/lib/locale/tag/common.rb
deleted file mode 100644
index ad85c18da..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/tag/common.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-=begin
- locale/tag/common.rb - Locale::Tag::Common
-
- Copyright (C) 2008,2009 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-=end
-
-require 'locale/tag/simple'
-
-module Locale
- module Tag
- # Common Language tag class for Ruby.
- # Java and MS Windows use this format.
- #
- # * ja (language: RFC4646)
- # * ja_JP (country: RFC4646(2 alpha or 3 digit))
- # * ja-JP
- # * ja_Hira_JP (script: 4 characters)
- # * ja-Hira-JP
- # * ja_Hira_JP_MOBILE (variants: more than 2 characters or 3 digit)
- # * ja_Hira_JP_MOBILE_IPHONE (2 variants example)
- #
- class Common < Simple
- LANGUAGE = "(#{ALPHA}{2,3}|#{ALPHA}{4}|#{ALPHA}{5,8})" #RFC4646 (ISO639/reserved/registered)
- SCRIPT = "(#{ALPHA}{4})"
- VARIANT = "(#{ALPHANUM}{3,}|#{DIGIT}#{ALPHANUM}{3})" #RFC3066 compatible
-
- TAG_RE = /\A#{LANGUAGE}(?:[-_]#{SCRIPT})?
- (?:[-_]#{REGION})?((?:[-_]#{VARIANT})*)\Z/ix
-
- attr_reader :script, :variants
-
- class << self
- include Util::Memoizable
- # Parse the language tag and return the new Locale::Tag::Common.
- def parse(tag)
- if tag =~ /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
- nil
- elsif tag =~ TAG_RE
- lang, script, region, subtag = $1, $2, $3, $4
- variants = subtag.scan(/(^|[-_])#{VARIANT}(?=([-_]|$))/i).collect{|v| v[1]}
-
- ret = self.new(lang, script, region, variants)
- ret.tag = tag
- ret
- else
- nil
- end
- end
- memoize_dup :parse
- end
-
- # Create a Locale::Tag::Common.
- def initialize(language, script = nil, region = nil, variants = [])
- @script, @variants = script, variants
- @script = @script.capitalize if @script
- super(language, region)
- end
-
- # Set the script (with capitalize)
- def script=(val)
- clear
- @script = val
- @script = @script.capitalize if @script
- @script
- end
-
- # Set the variants as an Array.
- def variants=(val)
- clear
- @variants = val
- end
-
- # Returns an Array of tag-candidates order by priority.
- # Use Locale.candidates instead of this method.
- #
- # Locale::Tag::Rfc, Cldr don't have their own candidates,
- # because it's meaningless to compare the extensions, privateuse, etc.
- def candidates
- [self.class.new(language, script, region, variants), #ja-Kana-JP-FOO
- self.class.new(language, script, region), #ja-Kana-JP
- self.class.new(language, nil, region, variants), #ja-JP-FOO
- self.class.new(language, nil, region), #ja-JP
- self.class.new(language, script, nil, variants), #ja-Kana-FOO
- self.class.new(language, script), #ja-Kana
- self.class.new(language, nil, nil, variants), #ja-FOO
- self.class.new(language)] #ja
- end
- memoize_dup :candidates
-
- private
- def convert_to(klass) #:nodoc:
- if klass == Simple
- super
- elsif klass == Posix
- if variants.size > 0
- var = variants.join("-")
- else
- var = nil
- end
- klass.new(language, region, nil, var)
- elsif klass == Cldr
- klass.new(language, script, region, variants.map{|v| v.upcase})
- else
- klass.new(language, script, region, variants)
- end
- end
-
- # Returns the common language tag with "_".
- # <language>_<Script>_<REGION>_VARIANTS1_VARIANTS2
- # (e.g.) "ja_Hira_JP_VARIANTS1_VARIANTS2"
- #
- # This is used in internal only. Use to_s instead.
- def to_string
- s = @language.dup
-
- s << "_" << @script if @script
- s << "_" << @region if @region
-
- @variants.each do |v|
- s << "_#{v}"
- end
- s
- end
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/tag/irregular.rb b/vendor/gems/locale-2.0.5/lib/locale/tag/irregular.rb
deleted file mode 100644
index ede85b600..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/tag/irregular.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-=begin
- locale/tag/irregular.rb - Locale::Tag::Irregular
-
- Copyright (C) 2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- $Id: irregular.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require 'locale/tag/simple'
-
-module Locale
-
- module Tag
- # Broken tag class.
- class Irregular < Simple
-
- def initialize(tag)
- tag = "en" if tag == nil or tag == ""
- super(tag.to_s)
- @tag = tag
- end
-
- # Returns an Array of tag-candidates order by priority.
- def candidates
- [Irregular.new(tag)]
- end
- memoize :candidates
-
- # Conver to the klass(the class of Language::Tag)
- private
- def convert_to(klass)
- klass.new(tag)
- end
- memoize :convert_to
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/tag/posix.rb b/vendor/gems/locale-2.0.5/lib/locale/tag/posix.rb
deleted file mode 100644
index b04aa54a1..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/tag/posix.rb
+++ /dev/null
@@ -1,97 +0,0 @@
-=begin
- locale/tag/posix.rb - Locale::Tag::Posix
-
- Copyright (C) 2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- $Id: posix.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-module Locale
- module Tag
-
- # Locale tag class for POSIX locale
- # * ja
- # * ja_JP
- # * ja_JP.UTF-8
- # * ja_JP.UTF-8@Osaka
- # * C/POSIX (-> en_US)
- class Posix < Simple
- LANGUAGE = "([a-z]{2,})"
- TAG_RE = /\A#{LANGUAGE}(?:_#{REGION})?(?:\.([^@]+))?(?:@(.*))?\Z/i
-
- attr_reader :charset, :modifier
-
- def initialize(language, region = nil, charset = nil, modifier = nil)
- @charset, @modifier = charset, modifier
- super(language, region)
- end
-
- def self.parse(tag)
- if tag =~ /^(C|POSIX)$/
- ret = self.new("en", "US")
- ret.tag = tag
- ret
- elsif tag =~ TAG_RE
- ret = self.new($1, $2, $3, $4)
- ret.tag = tag
- ret
- else
- nil
- end
- end
-
- # Returns the language tag.
- # <language>_<COUNTRY>.<CHARSET>@<MODIFIER>
- # (e.g.) "ja_JP.EUC-JP@Modifier"
- def to_s
- s = @language.dup
- s << "_#{@region}" if @region
- s << ".#{@charset}" if @charset
- s << "@#{@modifier}" if @modifier
- s
- end
-
- # Set the charset.
- def charset=(val)
- clear
- @charset = val
- end
-
- # Set the modifier as a String
- def modifier=(val)
- clear
- @modifier = val
- end
-
- # Returns an Array of tag-candidates order by priority.
- # Use Locale.candidates instead of this method.
- def candidates
- [self.class.new(language, region, charset, modifier), #ja_JP.UTF-8@Modifier
- self.class.new(language, region, charset), #ja_JP.UTF-8
- self.class.new(language, region, nil, modifier), #ja_JP@Modifier
- self.class.new(language, region, nil, nil), #ja_JP@Modifier
- self.class.new(language, nil, charset, modifier), #ja.UTF-8@Modifier
- self.class.new(language, nil, charset), #ja.UTF-8
- self.class.new(language, nil, nil, modifier), #ja@Modifier
- self.class.new(language)] #ja
- end
-
- # A modifier is converted to a variant.
- # If the modifier is less than 5 characters, it is not canonical value.
- private
- def convert_to(klass)
- if klass == Simple
- super
- elsif klass == Posix
- klass.new(language, region, charset, modifier)
- else
- klass.new(language, nil, region, modifier ? [modifier] : [])
- end
- end
-
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/tag/rfc.rb b/vendor/gems/locale-2.0.5/lib/locale/tag/rfc.rb
deleted file mode 100644
index 5a230b6e0..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/tag/rfc.rb
+++ /dev/null
@@ -1,112 +0,0 @@
-=begin
- locale/tag/rfc.rb - Locale::Tag::Rfc
-
- Copyright (C) 2008,2009 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-=end
-
-require 'locale/tag/common'
-
-module Locale
- module Tag
-
- # Language tag class for RFC4646(BCP47).
- class Rfc < Common
- SINGLETON = '[a-wyz0-9]'
- VARIANT = "(#{ALPHANUM}{5,8}|#{DIGIT}#{ALPHANUM}{3})"
- EXTENSION = "(#{SINGLETON}(?:-#{ALPHANUM}{2,8})+)"
- PRIVATEUSE = "(x(?:-#{ALPHANUM}{1,8})+)"
- GRANDFATHERED = "#{ALPHA}{1,3}(?:-#{ALPHANUM}{2,8}){1,2}"
-
- TAG_RE = /\A#{LANGUAGE}(?:-#{SCRIPT})?
- (?:-#{REGION})?((?:-#{VARIANT})*
- (?:-#{EXTENSION})*(?:-#{PRIVATEUSE})?)\Z/ix
-
- attr_reader :extensions, :privateuse
-
- class << self
- include Util::Memoizable
- # Parse the language tag and return the new Locale::Tag::Rfc.
- def parse(tag)
- if tag =~ /\APOSIX\Z/ # This is the special case of POSIX locale but match this regexp.
- nil
- elsif tag =~ TAG_RE
- lang, script, region, subtag = $1, $2, $3, $4
- extensions = []
- variants = []
- if subtag =~ /#{PRIVATEUSE}/
- subtag, privateuse = $`, $1
- # Private use for CLDR.
- if /x-ldml(.*)/ =~ privateuse
- p_subtag = $1
- extensions = p_subtag.scan(/(^|-)#{EXTENSION}/i).collect{|v| p_subtag.sub!(v[1], ""); v[1]}
- variants = p_subtag.scan(/(^|-)#{VARIANT}(?=(-|$))/i).collect{|v| v[1]}
- end
- end
- extensions += subtag.scan(/(^|-)#{EXTENSION}/i).collect{|v| subtag.sub!(v[1], ""); v[1]}
- variants += subtag.scan(/(^|-)#{VARIANT}(?=(-|$))/i).collect{|v| v[1]}
-
- ret = self.new(lang, script, region, variants, extensions, privateuse)
- ret.tag = tag
- ret
- else
- nil
- end
- end
- memoize_dup :parse
- end
-
- def initialize(language, script = nil, region = nil, variants = [],
- extensions = [], privateuse = nil)
- @extensions, @privateuse = extensions, privateuse
- super(language, script, region, variants)
- end
-
- # Sets the extensions as an Array.
- def extensions=(val)
- clear
- @extensions = val
- end
-
- # Sets the privateuse as a String
- def privateuse=(val)
- clear
- @privateuse = val
- end
-
- private
- def convert_to(klass)
- if klass == Rfc
- klass.new(language, script, region, variants, extensions, privateuse)
- elsif klass == Cldr
- exts = {}
- extensions.sort.each do |v|
- if v =~ /^k-(#{ALPHANUM}{2,})-(.*)$/i
- exts[$1] = $2
- end
- end
- klass.new(language, script, region, variants, exts)
- else
- super
- end
- end
-
- # Returns the language tag
- # <language>-<Script>-<REGION>-<variants>-<extensions>-<PRIVATEUSE>
- # (e.g.) "ja-Hira-JP-variant"
- #
- # This is used in internal only. Use to_s instead.
- def to_string
- s = super.gsub(/_/, "-")
- @extensions.sort.each do |v|
- s << "-#{v}"
- end
- s << "-#{@privateuse}" if @privateuse
- s
- end
-
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/tag/simple.rb b/vendor/gems/locale-2.0.5/lib/locale/tag/simple.rb
deleted file mode 100644
index bf3719b88..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/tag/simple.rb
+++ /dev/null
@@ -1,162 +0,0 @@
-=begin
- locale/tag/simple.rb - Locale::Tag::Simple
-
- Copyright (C) 2008,2009 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-=end
-
-require 'locale/util/memoizable'
-
-module Locale
- module Tag
- # Abstract language tag class.
- # This class has <language>, <region> which
- # all of language tag specifications have.
- #
- # * ja (language: ISO 639 (2 or 3 alpha))
- # * ja_JP (country: RFC4646 (ISO3166/UN M.49) (2 alpha or 3 digit)
- # * ja-JP
- # * ja-392
- class Simple
- include Util::Memoizable
-
- ALPHA = '[a-z]'
- DIGIT = '[0-9]'
- ALPHANUM = "[a-zA-Z0-9]"
-
- LANGUAGE = "(#{ALPHA}{2,3})" # ISO 639
- REGION = "(#{ALPHA}{2}|#{DIGIT}{3})" # RFC4646 (ISO3166/UN M.49)
-
- TAG_RE = /\A#{LANGUAGE}(?:[_-]#{REGION})?\Z/i
-
- include Util::Memoizable
-
- attr_reader :language, :region
-
- # tag is set when .parse method is called.
- # This value is used when the program want to know the original
- # String.
- attr_accessor :tag
-
- # call-seq:
- # to_common
- # to_posix
- # to_rfc
- # to_cldr
- #
- # Convert to each tag classes.
- [:simple, :common, :posix, :rfc, :cldr].each do |name|
- class_eval <<-EOS
- def to_#{name}
- convert_to(#{name.to_s.capitalize})
- end
- memoize_dup :to_#{name}
- EOS
- end
-
- class << self
- include Util::Memoizable
- # Parse the language tag and return the new Locale::Tag::Simple.
- def parse(tag)
- if tag =~ TAG_RE
- ret = self.new($1, $2)
- ret.tag = tag
- ret
- else
- nil
- end
- end
- memoize_dup :parse
- end
-
- # Create a Locale::Tag::Simple
- def initialize(language, region = nil)
- raise "language can't be nil." unless language
- @language, @region = language, region
- @language = @language.downcase if @language
- @region = @region.upcase if @region
- end
-
- # Returns the language tag as the String.
- # <language>_<REGION>
- # (e.g.) "ja_JP"
- def to_s
- to_string
- end
- memoize :to_s
-
- def to_str #:nodoc:
- to_s
- end
-
- def <=>(other)
- self.to_s <=> other.to_s
- end
-
- def ==(other) #:nodoc:
- other != nil and hash == other.hash
- end
-
- def eql?(other) #:nodoc:
- self.==(other)
- end
- memoize :eql?
-
- def hash #:nodoc:
- "#{self.class}:#{to_s}".hash
- end
- memoize :hash
-
- def inspect #:nodoc:
- %Q[#<#{self.class}: #{to_s}>]
- end
- memoize :inspect
-
- # For backward compatibility.
- def country; region end
-
- # Set the language (with downcase)
- def language=(val)
- clear
- @language = val
- @language = @language.downcase if @language
- @language
- end
-
- # Set the region (with upcase)
- def region=(val)
- clear
- @region = val
- @region = @region.upcase if @region
- @region
- end
-
- # Returns an Array of tag-candidates order by priority.
- # Use Locale.candidates instead of this method.
- def candidates
- [self.class.new(language, region), self.class.new(language)]
- end
- memoize_dup :candidates
-
- # Convert to the klass(the class of Language::Tag)
- private
- def convert_to(klass) #:nodoc:
- if klass == Simple || klass == Posix
- klass.new(language, region)
- else
- klass.new(language, nil, region)
- end
- end
-
- # Return simple language tag which format is"<lanuguage>_<REGION>".
- # This is to use internal only. Use to_s instead.
- def to_string
- s = @language.dup
- s << "_" << @region if @region
- s
- end
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/taglist.rb b/vendor/gems/locale-2.0.5/lib/locale/taglist.rb
deleted file mode 100644
index e5d879cc3..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/taglist.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-=begin
- taglist.rb - Locale module
-
- Copyright (C) 2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- $Id: taglist.rb 27 2008-12-03 15:06:50Z mutoh $
-=end
-
-require 'locale/util/memoizable'
-
-module Locale
- # This provides the subclass of Array which behaves like
- # the first(top priority) Locale::Tag object.
- # "Locale.current.language" is same with "Locale.current[0].language".
- #
- # Locale.current returns an Array of Tag(s) now.
- # But the old Locale.current(Ruby-GetText) and Locale.get
- # returns Locale::Object (similier with Locale::Tag::Posix).
- # This is the class for backward compatibility.
- #
- # It is recommanded to use Locale.current[0] or
- # Locale.candidates to find the current locale instead
- # of this function.
- #
- class TagList < Array
- include Util::Memoizable
-
- # Returns the top priority language. (simple)
- def language
- self[0].language
- end
- # Returns the top priority region/country. (simple)
- def country
- self[0].region
- end
- # Returns the top priority region/country. (simple)
- def region
- self[0].region
- end
- # Returns the top priority script. (common)
- def script
- self[0].script
- end
- # Returns the top priority charset. (posix)
- def charset
- if self[0].respond_to? :charset
- self[0].charset
- else
- ::Locale.driver_module.charset
- end
- end
- memoize :charset
-
- # Returns the top priority modifier. (posix)
- def modifier
- (self[0].respond_to? :modifier) ? self[0].modifier : nil
- end
- memoize :modifier
-
- # Returns the top priority variants.(common, rfc, cldr)
- def variants
- (self[0].respond_to? :variants) ? self[0].variants : nil
- end
- memoize :variants
-
- # Returns the top priority extensions.(common, rfc, cldr)
- def extensions
- (self[0].respond_to? :extensions) ? self[0].extensions : nil
- end
- memoize :extensions
-
- # Returns the top priority privateuse(rfc)
- def privateuse
- (self[0].respond_to? :privateuse) ? self[0].privateuse : nil
- end
- memoize :privateuse
-
- def to_str
- self[0].to_str
- end
-
- def to_s
- self[0].to_s
- end
-
- def to_common
- self[0].to_common
- end
-
- def to_simple
- self[0].to_simple
- end
-
- def to_rfc
- self[0].to_rfc
- end
-
- def to_cldr
- self[0].to_cldr
- end
-
- def to_posix
- self[0].to_posix
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/util/memoizable.rb b/vendor/gems/locale-2.0.5/lib/locale/util/memoizable.rb
deleted file mode 100644
index b26ffc86c..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/util/memoizable.rb
+++ /dev/null
@@ -1,108 +0,0 @@
-# Refer from activesupport-2.2.0.
-#
-# * Remove the dependecies to activesupport.
-# * change the key to hash value of args.
-# * Not Thread safe
-# * Add the clear method.
-module Locale
- module Util
- module Memoizable
- MEMOIZED_IVAR = Proc.new do |symbol|
- "#{symbol.to_s.sub(/\?\Z/, '_query').sub(/!\Z/, '_bang')}".to_sym
- end
-
- def self.included(base)
- mod = self
- base.class_eval do
- extend mod
- end
- end
-
- alias :freeze_without_memoizable :freeze #:nodoc:
- def freeze #:nodoc:
- unless frozen?
- @_memoized_ivars = {}
- freeze_without_memoizable
- end
- end
-
- # Clear memoized values. Deprecated.
- def clear # :nodoc:
- @_memoized_ivars = {}
- end
-
- # Clear memoized values.
- def memoize_clear
- @_memoized_ivars = {}
- end
-
- # Cache the result of the methods.
- #
- # include Memoizable
- # def foo
- # ......
- # end
- # def bar(a, b)
- # ......
- # end
- # memoize :foo, :bar(a, b)
- #
- # To clear cache, #clear_foo, #clear_bar is also defined.
- #
- # (NOTE)
- # * Consider to use this with huge objects to avoid memory leaks.
- # * Can't use this with super.<method> because of infinity loop.
- def memoize(*symbols)
- memoize_impl(false, *symbols)
- end
-
- # memoize with dup. A copy object is returned.
- def memoize_dup(*symbols)
- memoize_impl(true, *symbols)
- end
-
- def memoize_impl(is_dup, *symbols) #:nodoc:
- symbols.each do |symbol|
- original_method = "_unmemoized_#{symbol}"
- memoized_ivar = MEMOIZED_IVAR.call(symbol)
- dup_meth = is_dup ? "_dup" : ""
-
- class_eval <<-EOS, __FILE__, __LINE__
- alias #{original_method} #{symbol}
- def #{symbol}(*args)
- _memoize#{dup_meth}(:#{memoized_ivar}, args.hash) do
- #{original_method}(*args)
- end
- end
- EOS
- end
- end
-
- def _memoize(ivar, key) #:nodoc:
- @_memoized_ivars ||= {}
- @_memoized_ivars[ivar] ||= {}
-
- ret = @_memoized_ivars[ivar][key]
- unless ret
- ret = yield
- ret.freeze
- @_memoized_ivars[ivar][key] = ret
- end
- ret
- end
-
- def _memoize_dup(ivar, key) #:nodoc:
- ret = _memoize(ivar, key) do; yield; end
- if ret
- if ret.kind_of? Array
- ret.map{|v| v.dup}.dup
- else
- ret.dup
- end
- else
- nil
- end
- end
- end
- end
-end
diff --git a/vendor/gems/locale-2.0.5/lib/locale/version.rb b/vendor/gems/locale-2.0.5/lib/locale/version.rb
deleted file mode 100644
index 63bb15b35..000000000
--- a/vendor/gems/locale-2.0.5/lib/locale/version.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-=begin
- version - version information of Ruby-Locale
-
- Copyright (C) 2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-=end
-module Locale
- VERSION = "2.0.5"
-end
-
diff --git a/vendor/gems/locale-2.0.5/samples/cgi/README b/vendor/gems/locale-2.0.5/samples/cgi/README
deleted file mode 100644
index e11819306..000000000
--- a/vendor/gems/locale-2.0.5/samples/cgi/README
+++ /dev/null
@@ -1,20 +0,0 @@
-Sample script for CGI/ERB and Ruby/Locale.
-
-Run the http server.
-$ ruby http.rb
-
-Access the http server from WWW browser:
-
-http://localhost:10080/
-
-or
-
-If you want to set locale(lang) forcely, then:
-
-http://localhost:10080/?lang=ja
- #ja is a target locale in this sample.
-
-http.rb - an http server for samples using WEBrick
-index.cgi - a sample menu (CGI sample)
-cookie.cgi - Set lang to cookie value.
-locale.css - CSS file.
diff --git a/vendor/gems/locale-2.0.5/samples/cgi/cookie.cgi b/vendor/gems/locale-2.0.5/samples/cgi/cookie.cgi
deleted file mode 100755
index 06adbc813..000000000
--- a/vendor/gems/locale-2.0.5/samples/cgi/cookie.cgi
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env ruby
-=begin
- cookie.cgi - Set a selected locale to the cookie of WWW Browser.
-
- Set UTF-8 forcely as output charset.
-
- Recommanded to set UTF-8 forcely because some web browser
- doesn't send HTTP_ACCEPT_CHARSET correctly.
-
- Copyright (C) 2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-=end
-
-$:<< "../../lib"
-
-require 'locale'
-require 'cgi'
-
-# Initialization of Locale library.
-Locale.init(:driver => :cgi)
-cgi = CGI.new
-Locale.set_cgi(cgi)
-
-# Get "lang" from the query string.
-lang = cgi["lang"] or ""
-
-#
-# CGI part
-#
-print "Set-Cookie:lang=#{lang}\n"
-print "Content-type:text/html; charset=UTF-8\n\n"
-
-puts %Q[
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" type="text/css" href="locale.css" media="all">
- <title>Sample script for CGI and Ruby/Locale</title>
-</head>
-<body>
-
-<div style="text-align:center; margin:5em;">
-]
-
-if lang.size > 0
- puts %Q!<p><div id="result">Set [#{lang}] as the cookie of your WWW browser.</div></p>!
-else
- puts %Q!<p><div id="result">Clear "lang" value from your WWW browser.</div></p>!
-end
-
-puts %Q!
-<p style="margin:2em;"><a href="/">Back</a></p>
-</div>
-<div style="text-align:right">
- <p>Copyright (C) 2008 Masao Mutoh</p>
-</div>
-</body>
-</html>
-!
-
diff --git a/vendor/gems/locale-2.0.5/samples/cgi/http.rb b/vendor/gems/locale-2.0.5/samples/cgi/http.rb
deleted file mode 100755
index 033d451f3..000000000
--- a/vendor/gems/locale-2.0.5/samples/cgi/http.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#! /usr/bin/env ruby
-=begin
- http.rb - An WebServer for hello locale sample.
-
- Copyright (C) 2005-2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-
- Original: Ruby-GetText-Package 1.92.0
-
- $Id$
-=end
-
-require 'webrick'
-require 'cgi'
-require 'rbconfig'
-
-interpreter = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) +
- Config::CONFIG['EXEEXT']
-
-srv = WEBrick::HTTPServer.new({:BindAddress => '127.0.0.1',
- :Logger => WEBrick::Log::new($stderr, WEBrick::Log::DEBUG),
- # :CGIInterpreter => "ruby -d",
- :Port => 10080})
-
-['INT', 'TERM'].each { |signal|
- trap(signal){ srv.shutdown}
-}
-
-srv.mount("/", WEBrick::HTTPServlet::FileHandler, File.expand_path('.'))
-
-srv.mount_proc("/src/") do |req, res|
- res.header["Content-Type"] = "text/html; charset=UTF-8"
- if req.query_string
- file = File.open(req.query_string).read
- res.body = %Q[<html>
- <head>
- <title>View a source code</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" type="text/css" href="/gettext.css" media="all">
- </head>
- <body><h1>#{req.query_string}</h1>
- <pre>#{CGI.escapeHTML(file)}</pre>
- <p><a href="/">Back</a></p>
- </body>
- </html>
- ]
- end
-end
-
-srv.start
diff --git a/vendor/gems/locale-2.0.5/samples/cgi/index.cgi b/vendor/gems/locale-2.0.5/samples/cgi/index.cgi
deleted file mode 100755
index 47eb45237..000000000
--- a/vendor/gems/locale-2.0.5/samples/cgi/index.cgi
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env ruby
-=begin
- index.cgi - Sample script for CGI
-
- Copyright (C) 2008 Masao Mutoh
-
- You may redistribute it and/or modify it under the same
- license terms as Ruby.
-=end
-$:<< "../../lib"
-
-begin
- require 'rubygems'
-rescue LoadError
-end
-
-require 'locale'
-require 'cgi'
-
-# Initialize Locale library.
-Locale.init(:driver => :cgi)
-cgi = CGI.new
-Locale.set_cgi(cgi)
-
-
-url_base = "http://#{cgi.server_name}:#{cgi.server_port}/"
-
-sample_locales = ["en-US", "fr-FR", "ja-JP"]
-
-langs = Locale.candidates(:type => :common) #Try :rfc, :simple and others.
-
-
-#
-# CGI part
-#
-
-print "Content-type:text/html; charset=UTF-8\n\n"
-
-puts %Q[<html><head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" type="text/css" href="locale.css" media="all">
- <title>Sample script for CGI/ERB and Ruby/Locale</title>
-</head>
-<body>
-<h1>Ruby/Locale CGI sample scripts</h1>
-<p>Requested Locales order by the priority:</p>
-<div id="result">#{CGI.escapeHTML(langs.inspect)}</div>
-
-<h2>Auto-Detect the locale from the WWW browser</h2>
-<p><a href="./">#{url_base}</a></p>
-
-<h2>Set locale as the "lang" parameter</h2>
-<ol>
-]
-sample_locales.each do |lang|
- url = url_base + "?lang=" + lang
- puts %Q!<li> <a href="#{url}">#{CGI.escapeHTML(url)}</a> [#{lang}]</li>!
-end
-url = url_base + "?lang=zh_CN;lang=ko_KR"
-puts %Q!<li> <a href="#{url}">#{CGI.escapeHTML(url)}</a> [Plural locales]</li>!
-
-puts "</ol>"
-puts %Q[<h2>Set "lang" as the cookie value.</h2>
-<p>Click one of the link below, and then click "Auto-Detect the locale from the WWW browser".</p>
-<ol>]
-
-sample_locales.each do |lang|
- url = url_base + "cookie.cgi?lang=" + lang
- puts %Q!<li><a href="#{url}">#{CGI.escapeHTML(url)}</a> [#{lang}]</li>!
-end
-puts %Q!<li><a href="cookie.cgi">Clear the cookie value</a></li>!
-
-puts "</ol>"
-puts "<h2>Source codes</h2>"
-puts "<ol>"
-
-Dir.glob("*cgi\0*rb)").sort.each do |src|
- unless /http.rb|makemo.rb/ =~ src
- puts %Q[<li><a href="/src/?#{src}">#{src}</a></li>]
- end
-end
-puts %Q[</ol>
-<hr/>
- <div class="copyright">
- <p>Copyright (C) 2008 Masao Mutoh</p>
- </div>
-</body>
-</html>
-]
-
diff --git a/vendor/gems/locale-2.0.5/samples/cgi/locale.css b/vendor/gems/locale-2.0.5/samples/cgi/locale.css
deleted file mode 100644
index 6a7f9d8da..000000000
--- a/vendor/gems/locale-2.0.5/samples/cgi/locale.css
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- CSS for Ruby/Locale
- by Masao Mutoh.
-*/
-
-body {
- margin: 0px;
- padding: 0px;
- color: #000;
- background-color: #fff;
- font-size: 90%;
- font-family: Times, Sans-Serif;
- line-height: 1.5em;
-}
-
-h1 {
- color: #002288;
- text-align: left;
- clear: both;
- padding:0.4em;
- font-weight: bold;
- font-size: 1.8em;
- padding-left:0.5em;
- padding-right:10px;
- margin-top: 10px;
- margin-left: 20px;
- margin-bottom:1em;
- margin-right:5px;
- border: solid thin;
- border-left: solid;
- border-color: #9999ff;
- border-top-width: 0px;
- border-right-width: 0px;
- border-bottom-width: 1px;
- border-left-width: 15px;
-}
-h2 {
- margin: 0px;
- font-size: large;
- font-weight: bold;
- font-size: 1.4em;
- padding: 0.3em;
- padding-left:0.5em;
- padding-right:10px;
- margin-top: 1em;
- margin-left: 1.5em;
- margin-right: 10px;
- margin-bottom:0.8em;
- border: solid thin;
- border-left: solid;
- border-color: #9999ff;
- border-top-width: 0px;
- border-right-width: 0px;
- border-bottom-width: 1px;
- border-left-width: 15px;
-
-}
-
-h3 {
- margin:1em;
- margin-bottom: 0.5em;
- margin-top: 1.5em;
- margin-left: 2em;
- margin-right: 24px;
- padding: 0.1em;
- padding-top: 0;
- padding-left: 0.7em;
- font-size: 1.2em;
- border-style: dashed;
- border-width: 0px 0px 1px 1px;
- border-color: #ddddff;
-}
-
-p {
- padding-left: 1em;
- padding-right: 1em;
- margin-top: 0px;
- margin-left: 1.5em;
- margin-right: 1em;
- margin-bottom: 0.5em;
-}
-
-ol, ul {
- margin-top: 0.2em;
- margin-left: 3em;
- padding-left: 1.5em;
-}
-
-li {
- margin-top: 0.2em;
- margin-left: 0em;
- padding-left: 0em;
- line-height: 1.2em;
-}
-
-#result {
- color: red;
- font-weight: bold;
- padding-left: 3em;
- padding-right: 3em;
-}
-
-pre {
- margin: 2em;
- padding: 1em;
- border-style: solid;
- border-width: 1px 1px 1px 1px;
- border-color: #ddddff;
- background-color: #eeffee;
-}
-
-.copyright {
- text-align: right;
- padding: 2em;
-}
diff --git a/vendor/gems/locale-2.0.5/samples/rack/README b/vendor/gems/locale-2.0.5/samples/rack/README
deleted file mode 100644
index 9da49eeb4..000000000
--- a/vendor/gems/locale-2.0.5/samples/rack/README
+++ /dev/null
@@ -1,10 +0,0 @@
-= Install Rack:
-$ sudo gem install rack
-
-= Run rack server:
-$rackup hello_rack.ru
-
-= Access from WWW browser:
-http://localhost:9292/
-http://localhost:9292/?lang=ja
-
diff --git a/vendor/gems/locale-2.0.5/samples/rack/hello_rack.rb b/vendor/gems/locale-2.0.5/samples/rack/hello_rack.rb
deleted file mode 100644
index d6cb16013..000000000
--- a/vendor/gems/locale-2.0.5/samples/rack/hello_rack.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require 'rubygems'
-require 'rack'
-require 'locale'
-
-Locale.init(:driver => :cgi)
-
-class HelloRackApp
- def call(env)
- req = Rack::Request.new(env)
- Locale.set_request(req["lang"], req.cookies["lang"],
- env["HTTP_ACCEPT_LANGUAGE"], env["HTTP_ACCEPT_CHARSET"])
- str = "Language tag candidates of your request order by the priority:\n\n"
- str += Locale.candidates(:type => :rfc).map{|v| v.inspect + "\n"}.join
- [200, {"Content-Type" => "text/plain", "Content-Length" => str.length.to_s}, [str]]
- end
-end
-
diff --git a/vendor/gems/locale-2.0.5/samples/rack/hello_rack.ru b/vendor/gems/locale-2.0.5/samples/rack/hello_rack.ru
deleted file mode 100644
index a97748d05..000000000
--- a/vendor/gems/locale-2.0.5/samples/rack/hello_rack.ru
+++ /dev/null
@@ -1,5 +0,0 @@
-$LOAD_PATH.unshift "../../lib"
-
-require 'hello_rack'
-run HelloRackApp.new
-
diff --git a/vendor/gems/locale-2.0.5/samples/sample_1.rb b/vendor/gems/locale-2.0.5/samples/sample_1.rb
deleted file mode 100644
index 2be192fe4..000000000
--- a/vendor/gems/locale-2.0.5/samples/sample_1.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'rubygems'
-require 'locale'
-
-puts "Get the current locale."
-
-p Locale.current #=> Returns a language in a TagList.
-p Locale.charset
-p Locale.current.language
-p Locale.current[0].language #=> same result.
-
-ENV["LANGUAGE"] = "ja_JP.eucJP:fr_FR"
-puts "Set LANGUAGE." + ENV["LANGUAGE"]
-
-# Clear locale because the values are cached.
-Locale.clear
-
-p Locale.current #=> Return 2 languages in a TagList.
-p Locale.current[0].language
-p Locale.current[1].language
-p Locale.current.language #=> Same with Locale.current[0].language.
-p Locale.charset
-
-p "Locale.candidates"
-p Locale.current
-p Locale.candidates
diff --git a/vendor/gems/locale-2.0.5/samples/sample_info.rb b/vendor/gems/locale-2.0.5/samples/sample_info.rb
deleted file mode 100644
index 79681c58a..000000000
--- a/vendor/gems/locale-2.0.5/samples/sample_info.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rubygems'
-require 'locale/info'
-
-p Locale::Info.get_language("ja")
-p Locale::Info.get_region("JP")
-
diff --git a/vendor/gems/locale-2.0.5/setup.rb b/vendor/gems/locale-2.0.5/setup.rb
deleted file mode 100644
index 424a5f37c..000000000
--- a/vendor/gems/locale-2.0.5/setup.rb
+++ /dev/null
@@ -1,1585 +0,0 @@
-#
-# setup.rb
-#
-# Copyright (c) 2000-2005 Minero Aoki
-#
-# This program is free software.
-# You can distribute/modify this program under the terms of
-# the GNU LGPL, Lesser General Public License version 2.1.
-#
-
-unless Enumerable.method_defined?(:map) # Ruby 1.4.6
- module Enumerable
- alias map collect
- end
-end
-
-unless File.respond_to?(:read) # Ruby 1.6
- def File.read(fname)
- open(fname) {|f|
- return f.read
- }
- end
-end
-
-unless Errno.const_defined?(:ENOTEMPTY) # Windows?
- module Errno
- class ENOTEMPTY
- # We do not raise this exception, implementation is not needed.
- end
- end
-end
-
-def File.binread(fname)
- open(fname, 'rb') {|f|
- return f.read
- }
-end
-
-# for corrupted Windows' stat(2)
-def File.dir?(path)
- File.directory?((path[-1,1] == '/') ? path : path + '/')
-end
-
-
-class ConfigTable
-
- include Enumerable
-
- def initialize(rbconfig)
- @rbconfig = rbconfig
- @items = []
- @table = {}
- # options
- @install_prefix = nil
- @config_opt = nil
- @verbose = true
- @no_harm = false
- end
-
- attr_accessor :install_prefix
- attr_accessor :config_opt
-
- attr_writer :verbose
-
- def verbose?
- @verbose
- end
-
- attr_writer :no_harm
-
- def no_harm?
- @no_harm
- end
-
- def [](key)
- lookup(key).resolve(self)
- end
-
- def []=(key, val)
- lookup(key).set val
- end
-
- def names
- @items.map {|i| i.name }
- end
-
- def each(&block)
- @items.each(&block)
- end
-
- def key?(name)
- @table.key?(name)
- end
-
- def lookup(name)
- @table[name] or setup_rb_error "no such config item: #{name}"
- end
-
- def add(item)
- @items.push item
- @table[item.name] = item
- end
-
- def remove(name)
- item = lookup(name)
- @items.delete_if {|i| i.name == name }
- @table.delete_if {|name, i| i.name == name }
- item
- end
-
- def load_script(path, inst = nil)
- if File.file?(path)
- MetaConfigEnvironment.new(self, inst).instance_eval File.read(path), path
- end
- end
-
- def savefile
- '.config'
- end
-
- def load_savefile
- begin
- File.foreach(savefile()) do |line|
- k, v = *line.split(/=/, 2)
- self[k] = v.strip
- end
- rescue Errno::ENOENT
- setup_rb_error $!.message + "\n#{File.basename($0)} config first"
- end
- end
-
- def save
- @items.each {|i| i.value }
- File.open(savefile(), 'w') {|f|
- @items.each do |i|
- f.printf "%s=%s\n", i.name, i.value if i.value? and i.value
- end
- }
- end
-
- def load_standard_entries
- standard_entries(@rbconfig).each do |ent|
- add ent
- end
- end
-
- def standard_entries(rbconfig)
- c = rbconfig
-
- rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT'])
-
- major = c['MAJOR'].to_i
- minor = c['MINOR'].to_i
- teeny = c['TEENY'].to_i
- version = "#{major}.#{minor}"
-
- # ruby ver. >= 1.4.4?
- newpath_p = ((major >= 2) or
- ((major == 1) and
- ((minor >= 5) or
- ((minor == 4) and (teeny >= 4)))))
-
- if c['rubylibdir']
- # V > 1.6.3
- libruby = "#{c['prefix']}/lib/ruby"
- librubyver = c['rubylibdir']
- librubyverarch = c['archdir']
- siteruby = c['sitedir']
- siterubyver = c['sitelibdir']
- siterubyverarch = c['sitearchdir']
- elsif newpath_p
- # 1.4.4 <= V <= 1.6.3
- libruby = "#{c['prefix']}/lib/ruby"
- librubyver = "#{c['prefix']}/lib/ruby/#{version}"
- librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
- siteruby = c['sitedir']
- siterubyver = "$siteruby/#{version}"
- siterubyverarch = "$siterubyver/#{c['arch']}"
- else
- # V < 1.4.4
- libruby = "#{c['prefix']}/lib/ruby"
- librubyver = "#{c['prefix']}/lib/ruby/#{version}"
- librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
- siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby"
- siterubyver = siteruby
- siterubyverarch = "$siterubyver/#{c['arch']}"
- end
- parameterize = lambda {|path|
- path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')
- }
-
- if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
- makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
- else
- makeprog = 'make'
- end
-
- [
- ExecItem.new('installdirs', 'std/site/home',
- 'std: install under libruby; site: install under site_ruby; home: install under $HOME')\
- {|val, table|
- case val
- when 'std'
- table['rbdir'] = '$librubyver'
- table['sodir'] = '$librubyverarch'
- when 'site'
- table['rbdir'] = '$siterubyver'
- table['sodir'] = '$siterubyverarch'
- when 'home'
- setup_rb_error '$HOME was not set' unless ENV['HOME']
- table['prefix'] = ENV['HOME']
- table['rbdir'] = '$libdir/ruby'
- table['sodir'] = '$libdir/ruby'
- end
- },
- PathItem.new('prefix', 'path', c['prefix'],
- 'path prefix of target environment'),
- PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
- 'the directory for commands'),
- PathItem.new('libdir', 'path', parameterize.call(c['libdir']),
- 'the directory for libraries'),
- PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
- 'the directory for shared data'),
- PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
- 'the directory for man pages'),
- PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
- 'the directory for system configuration files'),
- PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']),
- 'the directory for local state data'),
- PathItem.new('libruby', 'path', libruby,
- 'the directory for ruby libraries'),
- PathItem.new('librubyver', 'path', librubyver,
- 'the directory for standard ruby libraries'),
- PathItem.new('librubyverarch', 'path', librubyverarch,
- 'the directory for standard ruby extensions'),
- PathItem.new('siteruby', 'path', siteruby,
- 'the directory for version-independent aux ruby libraries'),
- PathItem.new('siterubyver', 'path', siterubyver,
- 'the directory for aux ruby libraries'),
- PathItem.new('siterubyverarch', 'path', siterubyverarch,
- 'the directory for aux ruby binaries'),
- PathItem.new('rbdir', 'path', '$siterubyver',
- 'the directory for ruby scripts'),
- PathItem.new('sodir', 'path', '$siterubyverarch',
- 'the directory for ruby extentions'),
- PathItem.new('rubypath', 'path', rubypath,
- 'the path to set to #! line'),
- ProgramItem.new('rubyprog', 'name', rubypath,
- 'the ruby program using for installation'),
- ProgramItem.new('makeprog', 'name', makeprog,
- 'the make program to compile ruby extentions'),
- SelectItem.new('shebang', 'all/ruby/never', 'ruby',
- 'shebang line (#!) editing mode'),
- BoolItem.new('without-ext', 'yes/no', 'no',
- 'does not compile/install ruby extentions')
- ]
- end
- private :standard_entries
-
- def load_multipackage_entries
- multipackage_entries().each do |ent|
- add ent
- end
- end
-
- def multipackage_entries
- [
- PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
- 'package names that you want to install'),
- PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
- 'package names that you do not want to install')
- ]
- end
- private :multipackage_entries
-
- ALIASES = {
- 'std-ruby' => 'librubyver',
- 'stdruby' => 'librubyver',
- 'rubylibdir' => 'librubyver',
- 'archdir' => 'librubyverarch',
- 'site-ruby-common' => 'siteruby', # For backward compatibility
- 'site-ruby' => 'siterubyver', # For backward compatibility
- 'bin-dir' => 'bindir',
- 'bin-dir' => 'bindir',
- 'rb-dir' => 'rbdir',
- 'so-dir' => 'sodir',
- 'data-dir' => 'datadir',
- 'ruby-path' => 'rubypath',
- 'ruby-prog' => 'rubyprog',
- 'ruby' => 'rubyprog',
- 'make-prog' => 'makeprog',
- 'make' => 'makeprog'
- }
-
- def fixup
- ALIASES.each do |ali, name|
- @table[ali] = @table[name]
- end
- @items.freeze
- @table.freeze
- @options_re = /\A--(#{@table.keys.join('|')})(?:=(.*))?\z/
- end
-
- def parse_opt(opt)
- m = @options_re.match(opt) or setup_rb_error "config: unknown option #{opt}"
- m.to_a[1,2]
- end
-
- def dllext
- @rbconfig['DLEXT']
- end
-
- def value_config?(name)
- lookup(name).value?
- end
-
- class Item
- def initialize(name, template, default, desc)
- @name = name.freeze
- @template = template
- @value = default
- @default = default
- @description = desc
- end
-
- attr_reader :name
- attr_reader :description
-
- attr_accessor :default
- alias help_default default
-
- def help_opt
- "--#{@name}=#{@template}"
- end
-
- def value?
- true
- end
-
- def value
- @value
- end
-
- def resolve(table)
- @value.gsub(%r<\$([^/]+)>) { table[$1] }
- end
-
- def set(val)
- @value = check(val)
- end
-
- private
-
- def check(val)
- setup_rb_error "config: --#{name} requires argument" unless val
- val
- end
- end
-
- class BoolItem < Item
- def config_type
- 'bool'
- end
-
- def help_opt
- "--#{@name}"
- end
-
- private
-
- def check(val)
- return 'yes' unless val
- case val
- when /\Ay(es)?\z/i, /\At(rue)?\z/i then 'yes'
- when /\An(o)?\z/i, /\Af(alse)\z/i then 'no'
- else
- setup_rb_error "config: --#{@name} accepts only yes/no for argument"
- end
- end
- end
-
- class PathItem < Item
- def config_type
- 'path'
- end
-
- private
-
- def check(path)
- setup_rb_error "config: --#{@name} requires argument" unless path
- path[0,1] == '$' ? path : File.expand_path(path)
- end
- end
-
- class ProgramItem < Item
- def config_type
- 'program'
- end
- end
-
- class SelectItem < Item
- def initialize(name, selection, default, desc)
- super
- @ok = selection.split('/')
- end
-
- def config_type
- 'select'
- end
-
- private
-
- def check(val)
- unless @ok.include?(val.strip)
- setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
- end
- val.strip
- end
- end
-
- class ExecItem < Item
- def initialize(name, selection, desc, &block)
- super name, selection, nil, desc
- @ok = selection.split('/')
- @action = block
- end
-
- def config_type
- 'exec'
- end
-
- def value?
- false
- end
-
- def resolve(table)
- setup_rb_error "$#{name()} wrongly used as option value"
- end
-
- undef set
-
- def evaluate(val, table)
- v = val.strip.downcase
- unless @ok.include?(v)
- setup_rb_error "invalid option --#{@name}=#{val} (use #{@template})"
- end
- @action.call v, table
- end
- end
-
- class PackageSelectionItem < Item
- def initialize(name, template, default, help_default, desc)
- super name, template, default, desc
- @help_default = help_default
- end
-
- attr_reader :help_default
-
- def config_type
- 'package'
- end
-
- private
-
- def check(val)
- unless File.dir?("packages/#{val}")
- setup_rb_error "config: no such package: #{val}"
- end
- val
- end
- end
-
- class MetaConfigEnvironment
- def initialize(config, installer)
- @config = config
- @installer = installer
- end
-
- def config_names
- @config.names
- end
-
- def config?(name)
- @config.key?(name)
- end
-
- def bool_config?(name)
- @config.lookup(name).config_type == 'bool'
- end
-
- def path_config?(name)
- @config.lookup(name).config_type == 'path'
- end
-
- def value_config?(name)
- @config.lookup(name).config_type != 'exec'
- end
-
- def add_config(item)
- @config.add item
- end
-
- def add_bool_config(name, default, desc)
- @config.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
- end
-
- def add_path_config(name, default, desc)
- @config.add PathItem.new(name, 'path', default, desc)
- end
-
- def set_config_default(name, default)
- @config.lookup(name).default = default
- end
-
- def remove_config(name)
- @config.remove(name)
- end
-
- # For only multipackage
- def packages
- raise '[setup.rb fatal] multi-package metaconfig API packages() called for single-package; contact application package vendor' unless @installer
- @installer.packages
- end
-
- # For only multipackage
- def declare_packages(list)
- raise '[setup.rb fatal] multi-package metaconfig API declare_packages() called for single-package; contact application package vendor' unless @installer
- @installer.packages = list
- end
- end
-
-end # class ConfigTable
-
-
-# This module requires: #verbose?, #no_harm?
-module FileOperations
-
- def mkdir_p(dirname, prefix = nil)
- dirname = prefix + File.expand_path(dirname) if prefix
- $stderr.puts "mkdir -p #{dirname}" if verbose?
- return if no_harm?
-
- # Does not check '/', it's too abnormal.
- dirs = File.expand_path(dirname).split(%r<(?=/)>)
- if /\A[a-z]:\z/i =~ dirs[0]
- disk = dirs.shift
- dirs[0] = disk + dirs[0]
- end
- dirs.each_index do |idx|
- path = dirs[0..idx].join('')
- Dir.mkdir path unless File.dir?(path)
- end
- end
-
- def rm_f(path)
- $stderr.puts "rm -f #{path}" if verbose?
- return if no_harm?
- force_remove_file path
- end
-
- def rm_rf(path)
- $stderr.puts "rm -rf #{path}" if verbose?
- return if no_harm?
- remove_tree path
- end
-
- def remove_tree(path)
- if File.symlink?(path)
- remove_file path
- elsif File.dir?(path)
- remove_tree0 path
- else
- force_remove_file path
- end
- end
-
- def remove_tree0(path)
- Dir.foreach(path) do |ent|
- next if ent == '.'
- next if ent == '..'
- entpath = "#{path}/#{ent}"
- if File.symlink?(entpath)
- remove_file entpath
- elsif File.dir?(entpath)
- remove_tree0 entpath
- else
- force_remove_file entpath
- end
- end
- begin
- Dir.rmdir path
- rescue Errno::ENOTEMPTY
- # directory may not be empty
- end
- end
-
- def move_file(src, dest)
- force_remove_file dest
- begin
- File.rename src, dest
- rescue
- File.open(dest, 'wb') {|f|
- f.write File.binread(src)
- }
- File.chmod File.stat(src).mode, dest
- File.unlink src
- end
- end
-
- def force_remove_file(path)
- begin
- remove_file path
- rescue
- end
- end
-
- def remove_file(path)
- File.chmod 0777, path
- File.unlink path
- end
-
- def install(from, dest, mode, prefix = nil)
- $stderr.puts "install #{from} #{dest}" if verbose?
- return if no_harm?
-
- realdest = prefix ? prefix + File.expand_path(dest) : dest
- realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
- str = File.binread(from)
- if diff?(str, realdest)
- verbose_off {
- rm_f realdest if File.exist?(realdest)
- }
- File.open(realdest, 'wb') {|f|
- f.write str
- }
- File.chmod mode, realdest
-
- File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
- if prefix
- f.puts realdest.sub(prefix, '')
- else
- f.puts realdest
- end
- }
- end
- end
-
- def diff?(new_content, path)
- return true unless File.exist?(path)
- new_content != File.binread(path)
- end
-
- def command(*args)
- $stderr.puts args.join(' ') if verbose?
- system(*args) or raise RuntimeError,
- "system(#{args.map{|a| a.inspect }.join(' ')}) failed"
- end
-
- def ruby(*args)
- command config('rubyprog'), *args
- end
-
- def make(task = nil)
- command(*[config('makeprog'), task].compact)
- end
-
- def extdir?(dir)
- File.exist?("#{dir}/MANIFEST") or File.exist?("#{dir}/extconf.rb")
- end
-
- def files_of(dir)
- Dir.open(dir) {|d|
- return d.select {|ent| File.file?("#{dir}/#{ent}") }
- }
- end
-
- DIR_REJECT = %w( . .. CVS SCCS RCS CVS.adm .svn )
-
- def directories_of(dir)
- Dir.open(dir) {|d|
- return d.select {|ent| File.dir?("#{dir}/#{ent}") } - DIR_REJECT
- }
- end
-
-end
-
-
-# This module requires: #srcdir_root, #objdir_root, #relpath
-module HookScriptAPI
-
- def get_config(key)
- @config[key]
- end
-
- alias config get_config
-
- # obsolete: use metaconfig to change configuration
- def set_config(key, val)
- @config[key] = val
- end
-
- #
- # srcdir/objdir (works only in the package directory)
- #
-
- def curr_srcdir
- "#{srcdir_root()}/#{relpath()}"
- end
-
- def curr_objdir
- "#{objdir_root()}/#{relpath()}"
- end
-
- def srcfile(path)
- "#{curr_srcdir()}/#{path}"
- end
-
- def srcexist?(path)
- File.exist?(srcfile(path))
- end
-
- def srcdirectory?(path)
- File.dir?(srcfile(path))
- end
-
- def srcfile?(path)
- File.file?(srcfile(path))
- end
-
- def srcentries(path = '.')
- Dir.open("#{curr_srcdir()}/#{path}") {|d|
- return d.to_a - %w(. ..)
- }
- end
-
- def srcfiles(path = '.')
- srcentries(path).select {|fname|
- File.file?(File.join(curr_srcdir(), path, fname))
- }
- end
-
- def srcdirectories(path = '.')
- srcentries(path).select {|fname|
- File.dir?(File.join(curr_srcdir(), path, fname))
- }
- end
-
-end
-
-
-class ToplevelInstaller
-
- Version = '3.4.1'
- Copyright = 'Copyright (c) 2000-2005 Minero Aoki'
-
- TASKS = [
- [ 'all', 'do config, setup, then install' ],
- [ 'config', 'saves your configurations' ],
- [ 'show', 'shows current configuration' ],
- [ 'setup', 'compiles ruby extentions and others' ],
- [ 'install', 'installs files' ],
- [ 'test', 'run all tests in test/' ],
- [ 'clean', "does `make clean' for each extention" ],
- [ 'distclean',"does `make distclean' for each extention" ]
- ]
-
- def ToplevelInstaller.invoke
- config = ConfigTable.new(load_rbconfig())
- config.load_standard_entries
- config.load_multipackage_entries if multipackage?
- config.fixup
- klass = (multipackage?() ? ToplevelInstallerMulti : ToplevelInstaller)
- klass.new(File.dirname($0), config).invoke
- end
-
- def ToplevelInstaller.multipackage?
- File.dir?(File.dirname($0) + '/packages')
- end
-
- def ToplevelInstaller.load_rbconfig
- if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
- ARGV.delete(arg)
- load File.expand_path(arg.split(/=/, 2)[1])
- $".push 'rbconfig.rb'
- else
- require 'rbconfig'
- end
- ::Config::CONFIG
- end
-
- def initialize(ardir_root, config)
- @ardir = File.expand_path(ardir_root)
- @config = config
- # cache
- @valid_task_re = nil
- end
-
- def config(key)
- @config[key]
- end
-
- def inspect
- "#<#{self.class} #{__id__()}>"
- end
-
- def invoke
- run_metaconfigs
- case task = parsearg_global()
- when nil, 'all'
- parsearg_config
- init_installers
- exec_config
- exec_setup
- exec_install
- else
- case task
- when 'config', 'test'
- ;
- when 'clean', 'distclean'
- @config.load_savefile if File.exist?(@config.savefile)
- else
- @config.load_savefile
- end
- __send__ "parsearg_#{task}"
- init_installers
- __send__ "exec_#{task}"
- end
- end
-
- def run_metaconfigs
- @config.load_script "#{@ardir}/metaconfig"
- end
-
- def init_installers
- @installer = Installer.new(@config, @ardir, File.expand_path('.'))
- end
-
- #
- # Hook Script API bases
- #
-
- def srcdir_root
- @ardir
- end
-
- def objdir_root
- '.'
- end
-
- def relpath
- '.'
- end
-
- #
- # Option Parsing
- #
-
- def parsearg_global
- while arg = ARGV.shift
- case arg
- when /\A\w+\z/
- setup_rb_error "invalid task: #{arg}" unless valid_task?(arg)
- return arg
- when '-q', '--quiet'
- @config.verbose = false
- when '--verbose'
- @config.verbose = true
- when '--help'
- print_usage $stdout
- exit 0
- when '--version'
- puts "#{File.basename($0)} version #{Version}"
- exit 0
- when '--copyright'
- puts Copyright
- exit 0
- else
- setup_rb_error "unknown global option '#{arg}'"
- end
- end
- nil
- end
-
- def valid_task?(t)
- valid_task_re() =~ t
- end
-
- def valid_task_re
- @valid_task_re ||= /\A(?:#{TASKS.map {|task,desc| task }.join('|')})\z/
- end
-
- def parsearg_no_options
- unless ARGV.empty?
- task = caller(0).first.slice(%r<`parsearg_(\w+)'>, 1)
- setup_rb_error "#{task}: unknown options: #{ARGV.join(' ')}"
- end
- end
-
- alias parsearg_show parsearg_no_options
- alias parsearg_setup parsearg_no_options
- alias parsearg_test parsearg_no_options
- alias parsearg_clean parsearg_no_options
- alias parsearg_distclean parsearg_no_options
-
- def parsearg_config
- evalopt = []
- set = []
- @config.config_opt = []
- while i = ARGV.shift
- if /\A--?\z/ =~ i
- @config.config_opt = ARGV.dup
- break
- end
- name, value = *@config.parse_opt(i)
- if @config.value_config?(name)
- @config[name] = value
- else
- evalopt.push [name, value]
- end
- set.push name
- end
- evalopt.each do |name, value|
- @config.lookup(name).evaluate value, @config
- end
- # Check if configuration is valid
- set.each do |n|
- @config[n] if @config.value_config?(n)
- end
- end
-
- def parsearg_install
- @config.no_harm = false
- @config.install_prefix = ''
- while a = ARGV.shift
- case a
- when '--no-harm'
- @config.no_harm = true
- when /\A--prefix=/
- path = a.split(/=/, 2)[1]
- path = File.expand_path(path) unless path[0,1] == '/'
- @config.install_prefix = path
- else
- setup_rb_error "install: unknown option #{a}"
- end
- end
- end
-
- def print_usage(out)
- out.puts 'Typical Installation Procedure:'
- out.puts " $ ruby #{File.basename $0} config"
- out.puts " $ ruby #{File.basename $0} setup"
- out.puts " # ruby #{File.basename $0} install (may require root privilege)"
- out.puts
- out.puts 'Detailed Usage:'
- out.puts " ruby #{File.basename $0} <global option>"
- out.puts " ruby #{File.basename $0} [<global options>] <task> [<task options>]"
-
- fmt = " %-24s %s\n"
- out.puts
- out.puts 'Global options:'
- out.printf fmt, '-q,--quiet', 'suppress message outputs'
- out.printf fmt, ' --verbose', 'output messages verbosely'
- out.printf fmt, ' --help', 'print this message'
- out.printf fmt, ' --version', 'print version and quit'
- out.printf fmt, ' --copyright', 'print copyright and quit'
- out.puts
- out.puts 'Tasks:'
- TASKS.each do |name, desc|
- out.printf fmt, name, desc
- end
-
- fmt = " %-24s %s [%s]\n"
- out.puts
- out.puts 'Options for CONFIG or ALL:'
- @config.each do |item|
- out.printf fmt, item.help_opt, item.description, item.help_default
- end
- out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's"
- out.puts
- out.puts 'Options for INSTALL:'
- out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
- out.printf fmt, '--prefix=path', 'install path prefix', ''
- out.puts
- end
-
- #
- # Task Handlers
- #
-
- def exec_config
- @installer.exec_config
- @config.save # must be final
- end
-
- def exec_setup
- @installer.exec_setup
- end
-
- def exec_install
- @installer.exec_install
- end
-
- def exec_test
- @installer.exec_test
- end
-
- def exec_show
- @config.each do |i|
- printf "%-20s %s\n", i.name, i.value if i.value?
- end
- end
-
- def exec_clean
- @installer.exec_clean
- end
-
- def exec_distclean
- @installer.exec_distclean
- end
-
-end # class ToplevelInstaller
-
-
-class ToplevelInstallerMulti < ToplevelInstaller
-
- include FileOperations
-
- def initialize(ardir_root, config)
- super
- @packages = directories_of("#{@ardir}/packages")
- raise 'no package exists' if @packages.empty?
- @root_installer = Installer.new(@config, @ardir, File.expand_path('.'))
- end
-
- def run_metaconfigs
- @config.load_script "#{@ardir}/metaconfig", self
- @packages.each do |name|
- @config.load_script "#{@ardir}/packages/#{name}/metaconfig"
- end
- end
-
- attr_reader :packages
-
- def packages=(list)
- raise 'package list is empty' if list.empty?
- list.each do |name|
- raise "directory packages/#{name} does not exist"\
- unless File.dir?("#{@ardir}/packages/#{name}")
- end
- @packages = list
- end
-
- def init_installers
- @installers = {}
- @packages.each do |pack|
- @installers[pack] = Installer.new(@config,
- "#{@ardir}/packages/#{pack}",
- "packages/#{pack}")
- end
- with = extract_selection(config('with'))
- without = extract_selection(config('without'))
- @selected = @installers.keys.select {|name|
- (with.empty? or with.include?(name)) \
- and not without.include?(name)
- }
- end
-
- def extract_selection(list)
- a = list.split(/,/)
- a.each do |name|
- setup_rb_error "no such package: #{name}" unless @installers.key?(name)
- end
- a
- end
-
- def print_usage(f)
- super
- f.puts 'Inluded packages:'
- f.puts ' ' + @packages.sort.join(' ')
- f.puts
- end
-
- #
- # Task Handlers
- #
-
- def exec_config
- run_hook 'pre-config'
- each_selected_installers {|inst| inst.exec_config }
- run_hook 'post-config'
- @config.save # must be final
- end
-
- def exec_setup
- run_hook 'pre-setup'
- each_selected_installers {|inst| inst.exec_setup }
- run_hook 'post-setup'
- end
-
- def exec_install
- run_hook 'pre-install'
- each_selected_installers {|inst| inst.exec_install }
- run_hook 'post-install'
- end
-
- def exec_test
- run_hook 'pre-test'
- each_selected_installers {|inst| inst.exec_test }
- run_hook 'post-test'
- end
-
- def exec_clean
- rm_f @config.savefile
- run_hook 'pre-clean'
- each_selected_installers {|inst| inst.exec_clean }
- run_hook 'post-clean'
- end
-
- def exec_distclean
- rm_f @config.savefile
- run_hook 'pre-distclean'
- each_selected_installers {|inst| inst.exec_distclean }
- run_hook 'post-distclean'
- end
-
- #
- # lib
- #
-
- def each_selected_installers
- Dir.mkdir 'packages' unless File.dir?('packages')
- @selected.each do |pack|
- $stderr.puts "Processing the package `#{pack}' ..." if verbose?
- Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
- Dir.chdir "packages/#{pack}"
- yield @installers[pack]
- Dir.chdir '../..'
- end
- end
-
- def run_hook(id)
- @root_installer.run_hook id
- end
-
- # module FileOperations requires this
- def verbose?
- @config.verbose?
- end
-
- # module FileOperations requires this
- def no_harm?
- @config.no_harm?
- end
-
-end # class ToplevelInstallerMulti
-
-
-class Installer
-
- FILETYPES = %w( bin lib ext data conf man )
-
- include FileOperations
- include HookScriptAPI
-
- def initialize(config, srcroot, objroot)
- @config = config
- @srcdir = File.expand_path(srcroot)
- @objdir = File.expand_path(objroot)
- @currdir = '.'
- end
-
- def inspect
- "#<#{self.class} #{File.basename(@srcdir)}>"
- end
-
- def noop(rel)
- end
-
- #
- # Hook Script API base methods
- #
-
- def srcdir_root
- @srcdir
- end
-
- def objdir_root
- @objdir
- end
-
- def relpath
- @currdir
- end
-
- #
- # Config Access
- #
-
- # module FileOperations requires this
- def verbose?
- @config.verbose?
- end
-
- # module FileOperations requires this
- def no_harm?
- @config.no_harm?
- end
-
- def verbose_off
- begin
- save, @config.verbose = @config.verbose?, false
- yield
- ensure
- @config.verbose = save
- end
- end
-
- #
- # TASK config
- #
-
- def exec_config
- exec_task_traverse 'config'
- end
-
- alias config_dir_bin noop
- alias config_dir_lib noop
-
- def config_dir_ext(rel)
- extconf if extdir?(curr_srcdir())
- end
-
- alias config_dir_data noop
- alias config_dir_conf noop
- alias config_dir_man noop
-
- def extconf
- ruby "#{curr_srcdir()}/extconf.rb", *@config.config_opt
- end
-
- #
- # TASK setup
- #
-
- def exec_setup
- exec_task_traverse 'setup'
- end
-
- def setup_dir_bin(rel)
- files_of(curr_srcdir()).each do |fname|
- update_shebang_line "#{curr_srcdir()}/#{fname}"
- end
- end
-
- alias setup_dir_lib noop
-
- def setup_dir_ext(rel)
- make if extdir?(curr_srcdir())
- end
-
- alias setup_dir_data noop
- alias setup_dir_conf noop
- alias setup_dir_man noop
-
- def update_shebang_line(path)
- return if no_harm?
- return if config('shebang') == 'never'
- old = Shebang.load(path)
- if old
- $stderr.puts "warning: #{path}: Shebang line includes too many args. It is not portable and your program may not work." if old.args.size > 1
- new = new_shebang(old)
- return if new.to_s == old.to_s
- else
- return unless config('shebang') == 'all'
- new = Shebang.new(config('rubypath'))
- end
- $stderr.puts "updating shebang: #{File.basename(path)}" if verbose?
- open_atomic_writer(path) {|output|
- File.open(path, 'rb') {|f|
- f.gets if old # discard
- output.puts new.to_s
- output.print f.read
- }
- }
- end
-
- def new_shebang(old)
- if /\Aruby/ =~ File.basename(old.cmd)
- Shebang.new(config('rubypath'), old.args)
- elsif File.basename(old.cmd) == 'env' and old.args.first == 'ruby'
- Shebang.new(config('rubypath'), old.args[1..-1])
- else
- return old unless config('shebang') == 'all'
- Shebang.new(config('rubypath'))
- end
- end
-
- def open_atomic_writer(path, &block)
- tmpfile = File.basename(path) + '.tmp'
- begin
- File.open(tmpfile, 'wb', &block)
- File.rename tmpfile, File.basename(path)
- ensure
- File.unlink tmpfile if File.exist?(tmpfile)
- end
- end
-
- class Shebang
- def Shebang.load(path)
- line = nil
- File.open(path) {|f|
- line = f.gets
- }
- return nil unless /\A#!/ =~ line
- parse(line)
- end
-
- def Shebang.parse(line)
- cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ')
- new(cmd, args)
- end
-
- def initialize(cmd, args = [])
- @cmd = cmd
- @args = args
- end
-
- attr_reader :cmd
- attr_reader :args
-
- def to_s
- "#! #{@cmd}" + (@args.empty? ? '' : " #{@args.join(' ')}")
- end
- end
-
- #
- # TASK install
- #
-
- def exec_install
- rm_f 'InstalledFiles'
- exec_task_traverse 'install'
- end
-
- def install_dir_bin(rel)
- install_files targetfiles(), "#{config('bindir')}/#{rel}", 0755
- end
-
- def install_dir_lib(rel)
- install_files libfiles(), "#{config('rbdir')}/#{rel}", 0644
- end
-
- def install_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- install_files rubyextentions('.'),
- "#{config('sodir')}/#{File.dirname(rel)}",
- 0555
- end
-
- def install_dir_data(rel)
- install_files targetfiles(), "#{config('datadir')}/#{rel}", 0644
- end
-
- def install_dir_conf(rel)
- # FIXME: should not remove current config files
- # (rename previous file to .old/.org)
- install_files targetfiles(), "#{config('sysconfdir')}/#{rel}", 0644
- end
-
- def install_dir_man(rel)
- install_files targetfiles(), "#{config('mandir')}/#{rel}", 0644
- end
-
- def install_files(list, dest, mode)
- mkdir_p dest, @config.install_prefix
- list.each do |fname|
- install fname, dest, mode, @config.install_prefix
- end
- end
-
- def libfiles
- glob_reject(%w(*.y *.output), targetfiles())
- end
-
- def rubyextentions(dir)
- ents = glob_select("*.#{@config.dllext}", targetfiles())
- if ents.empty?
- setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first"
- end
- ents
- end
-
- def targetfiles
- mapdir(existfiles() - hookfiles())
- end
-
- def mapdir(ents)
- ents.map {|ent|
- if File.exist?(ent)
- then ent # objdir
- else "#{curr_srcdir()}/#{ent}" # srcdir
- end
- }
- end
-
- # picked up many entries from cvs-1.11.1/src/ignore.c
- JUNK_FILES = %w(
- core RCSLOG tags TAGS .make.state
- .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
- *~ *.old *.bak *.BAK *.orig *.rej _$* *$
-
- *.org *.in .*
- )
-
- def existfiles
- glob_reject(JUNK_FILES, (files_of(curr_srcdir()) | files_of('.')))
- end
-
- def hookfiles
- %w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt|
- %w( config setup install clean ).map {|t| sprintf(fmt, t) }
- }.flatten
- end
-
- def glob_select(pat, ents)
- re = globs2re([pat])
- ents.select {|ent| re =~ ent }
- end
-
- def glob_reject(pats, ents)
- re = globs2re(pats)
- ents.reject {|ent| re =~ ent }
- end
-
- GLOB2REGEX = {
- '.' => '\.',
- '$' => '\$',
- '#' => '\#',
- '*' => '.*'
- }
-
- def globs2re(pats)
- /\A(?:#{
- pats.map {|pat| pat.gsub(/[\.\$\#\*]/) {|ch| GLOB2REGEX[ch] } }.join('|')
- })\z/
- end
-
- #
- # TASK test
- #
-
- TESTDIR = 'test'
-
- def exec_test
- unless File.directory?('test')
- $stderr.puts 'no test in this package' if verbose?
- return
- end
- $stderr.puts 'Running tests...' if verbose?
- begin
- require 'test/unit'
- rescue LoadError
- setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'
- end
- runner = Test::Unit::AutoRunner.new(true)
- runner.to_run << TESTDIR
- runner.run
- end
-
- #
- # TASK clean
- #
-
- def exec_clean
- exec_task_traverse 'clean'
- rm_f @config.savefile
- rm_f 'InstalledFiles'
- end
-
- alias clean_dir_bin noop
- alias clean_dir_lib noop
- alias clean_dir_data noop
- alias clean_dir_conf noop
- alias clean_dir_man noop
-
- def clean_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- make 'clean' if File.file?('Makefile')
- end
-
- #
- # TASK distclean
- #
-
- def exec_distclean
- exec_task_traverse 'distclean'
- rm_f @config.savefile
- rm_f 'InstalledFiles'
- end
-
- alias distclean_dir_bin noop
- alias distclean_dir_lib noop
-
- def distclean_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- make 'distclean' if File.file?('Makefile')
- end
-
- alias distclean_dir_data noop
- alias distclean_dir_conf noop
- alias distclean_dir_man noop
-
- #
- # Traversing
- #
-
- def exec_task_traverse(task)
- run_hook "pre-#{task}"
- FILETYPES.each do |type|
- if type == 'ext' and config('without-ext') == 'yes'
- $stderr.puts 'skipping ext/* by user option' if verbose?
- next
- end
- traverse task, type, "#{task}_dir_#{type}"
- end
- run_hook "post-#{task}"
- end
-
- def traverse(task, rel, mid)
- dive_into(rel) {
- run_hook "pre-#{task}"
- __send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '')
- directories_of(curr_srcdir()).each do |d|
- traverse task, "#{rel}/#{d}", mid
- end
- run_hook "post-#{task}"
- }
- end
-
- def dive_into(rel)
- return unless File.dir?("#{@srcdir}/#{rel}")
-
- dir = File.basename(rel)
- Dir.mkdir dir unless File.dir?(dir)
- prevdir = Dir.pwd
- Dir.chdir dir
- $stderr.puts '---> ' + rel if verbose?
- @currdir = rel
- yield
- Dir.chdir prevdir
- $stderr.puts '<--- ' + rel if verbose?
- @currdir = File.dirname(rel)
- end
-
- def run_hook(id)
- path = [ "#{curr_srcdir()}/#{id}",
- "#{curr_srcdir()}/#{id}.rb" ].detect {|cand| File.file?(cand) }
- return unless path
- begin
- instance_eval File.read(path), path, 1
- rescue
- raise if $DEBUG
- setup_rb_error "hook #{path} failed:\n" + $!.message
- end
- end
-
-end # class Installer
-
-
-class SetupError < StandardError; end
-
-def setup_rb_error(msg)
- raise SetupError, msg
-end
-
-if $0 == __FILE__
- begin
- ToplevelInstaller.invoke
- rescue SetupError
- raise if $DEBUG
- $stderr.puts $!.message
- $stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
- exit 1
- end
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_detect_cgi.rb b/vendor/gems/locale-2.0.5/test/test_detect_cgi.rb
deleted file mode 100644
index e2adbfc62..000000000
--- a/vendor/gems/locale-2.0.5/test/test_detect_cgi.rb
+++ /dev/null
@@ -1,216 +0,0 @@
-require 'cgi'
-require 'locale'
-require 'test/unit'
-
-class CGI
- module QueryExtension
- # Override this method to avoid to put warning messages.
- module_function
- def readlines=(str)
- @@lines = [str]
- end
- def readlines
- @@lines
- end
- def read_from_cmdline
- require "shellwords"
- string = readlines.join(' ').gsub(/\n/n, '').gsub(/\\=/n, '%3D').gsub(/\\&/n, '%26')
-
- words = Shellwords.shellwords(string)
-
- if words.find{|x| /=/n.match(x) }
- words.join('&')
- else
- words.join('+')
- end
- end
- private :read_from_cmdline
- end
-end
-
-class TestDetectCGI < Test::Unit::TestCase
- def setup_cgi(str)
- CGI::QueryExtension.readlines = str
- Locale.init(:driver => :cgi)
- cgi = CGI.new
- Locale.cgi = cgi
- Locale.clear_all
- end
-
- def test_query_string
- #query string
- setup_cgi("lang=ja_JP")
- lang = Locale.current[0]
- assert_equal(Locale::Tag::Simple, lang.class)
- assert_equal("ja_JP", lang.to_s)
-
- setup_cgi("lang=ja-jp")
- lang = Locale.current[0]
- assert_equal(Locale::Tag::Simple, lang.class)
- assert_equal("ja_JP", lang.to_s)
- assert_equal("ja-JP", lang.to_rfc.to_s)
- setup_cgi("lang=ja-jp")
- assert_equal("ja_JP", lang.to_s)
- assert_equal("ja-JP", lang.to_rfc.to_s)
-
- end
-
- def test_cookie
- #cockie
- setup_cgi("Set-Cookie: lang=en-us")
- assert_equal("en_US", Locale.current.to_s)
- end
-
- def test_accept_language
- ENV["HTTP_ACCEPT_LANGUAGE"] = ""
- ENV["HTTP_ACCEPT_CHARSET"] = ""
- setup_cgi("")
- lang = Locale.current[0]
- assert_equal(Locale::Tag::Simple, lang.class)
- assert_equal("en", lang.to_s)
- assert_equal("en", lang.to_rfc.to_s)
-
- ENV["HTTP_ACCEPT_LANGUAGE"] = "ja,en-us;q=0.7,en;q=0.3"
- setup_cgi("")
- lang1, lang2, lang3 = Locale.current
- assert_equal("ja", lang1.to_rfc.to_s)
- assert_equal("en-US", lang2.to_rfc.to_s)
- assert_equal("en", lang3.to_rfc.to_s)
-
- ENV["HTTP_ACCEPT_LANGUAGE"] = "en-us,ja;q=0.7,en;q=0.3"
- setup_cgi("")
- lang1, lang2, lang3 = Locale.current
- assert_equal("en-US", lang1.to_rfc.to_s)
- assert_equal("ja", lang2.to_rfc.to_s)
- assert_equal("en", lang3.to_rfc.to_s)
-
- ENV["HTTP_ACCEPT_LANGUAGE"] = "en"
- setup_cgi("")
- lang = Locale.current[0]
- assert_equal("en", lang.to_rfc.to_s)
- end
-
- def test_accept_charset
- #accept charset
- ENV["HTTP_ACCEPT_CHARSET"] = "Shift_JIS"
- setup_cgi("")
- assert_equal("Shift_JIS", Locale.charset)
-
- ENV["HTTP_ACCEPT_CHARSET"] = "EUC-JP,*,utf-8"
- setup_cgi("")
- assert_equal("EUC-JP", Locale.charset)
-
- ENV["HTTP_ACCEPT_CHARSET"] = "*"
- setup_cgi("")
- assert_equal("UTF-8", Locale.charset)
-
- ENV["HTTP_ACCEPT_CHARSET"] = ""
- setup_cgi("")
- assert_equal("UTF-8", Locale.charset)
- end
-
- def test_default
- Locale.set_default(nil)
- Locale.set_default("ja-JP")
- ENV["HTTP_ACCEPT_LANGUAGE"] = ""
- ENV["HTTP_ACCEPT_CHARSET"] = ""
- setup_cgi("")
- assert_equal("ja-JP", Locale.default.to_rfc.to_s)
- assert_equal("ja-JP", Locale.current.to_rfc.to_s)
- Locale.set_default(nil)
- end
-
- def common(*ary)
- ary.map{|v| Locale::Tag::Common.parse(v)}
- end
-
- def rfc(*ary)
- ary.map{|v| Locale::Tag::Rfc.parse(v)}
- end
-
- def cldr(*ary)
- ary.map{|v| Locale::Tag::Cldr.parse(v)}
- end
-
- def simple(*ary)
- ary.map{|v| Locale::Tag::Simple.parse(v)}
- end
-
- def test_candidates
-
- ENV["HTTP_ACCEPT_LANGUAGE"] = "fr-fr,zh_CN;q=0.7,zh_TW;q=0.2,ja_JP;q=0.1"
- setup_cgi("")
-
- assert_equal common("fr-FR", "zh-CN", "zh-TW", "ja-JP",
- "fr", "zh", "ja", "en"), Locale.candidates
-
- assert_equal rfc("fr-FR", "zh-CN", "zh-TW", "ja-JP", "fr",
- "zh", "ja", "en"), Locale.candidates(:type => :rfc)
-
- assert_equal cldr("fr_FR", "zh_CN", "zh_TW", "ja_JP", "fr",
- "zh", "ja", "en"), Locale.candidates(:type => :cldr)
-
- assert_equal simple("fr-FR", "zh-CN", "zh-TW", "ja-JP",
- "fr", "zh", "ja", "en"), Locale.candidates(:type => :simple)
-
- taglist = Locale.candidates(:type => :rfc)
- assert_equal Locale::TagList, taglist.class
- assert_equal "fr", taglist.language
- assert_equal "FR", taglist.region
-
- end
-
- def test_candidates_with_supported_language_tags
- ENV["HTTP_ACCEPT_LANGUAGE"] = "fr-fr,zh_CN;q=0.7,zh_TW;q=0.2,ja_JP;q=0.1"
- setup_cgi("")
-
- assert_equal common("fr_FR", "zh", "ja"), Locale.candidates(:type => :common,
- :supported_language_tags => ["fr_FR", "ja", "zh"])
-
- assert_equal simple("fr-FR", "zh", "ja"), Locale.candidates(:type => :simple,
- :supported_language_tags => ["fr-FR", "ja", "zh"])
- #supported_language_tags includes "pt" as not in HTTP_ACCEPT_LANGUAGE
- assert_equal simple("fr-FR", "zh", "ja"),
- Locale.candidates(:type => :simple,
- :supported_language_tags => ["fr-FR", "ja", "zh", "pt"])
-
- end
-
- def test_candidates_with_default
- ENV["HTTP_ACCEPT_LANGUAGE"] = "fr-fr,zh_CN;q=0.7,zh_TW;q=0.2,ja_JP;q=0.1"
- setup_cgi("")
-
- Locale.default = "zh_TW"
- assert_equal simple("fr-FR", "zh", "ja"),
- Locale.candidates(:type => :simple,
- :supported_language_tags => ["fr-FR", "ja", "zh", "pt"])
-
- Locale.default = "pt"
- assert_equal simple("fr-FR", "zh", "ja", "pt"),
- Locale.candidates(:type => :simple,
- :supported_language_tags => ["fr-FR", "ja", "zh", "pt"])
-
- # default value is selected even if default is not in supported_language_tags.
- assert_equal simple("pt"), Locale.candidates(:type => :simple,
- :supported_language_tags => ["aa"])
- Locale.default = "en"
- end
-
-
- def test_candidates_with_app_language_tags
- Locale.set_app_language_tags("fr-FR", "ja")
-
- ENV["HTTP_ACCEPT_LANGUAGE"] = "fr-fr,zh_CN;q=0.7,zh_TW;q=0.2,ja_JP;q=0.1"
- setup_cgi("")
-
- assert_equal common("fr-FR", "ja"), Locale.candidates
-
- # default value is selected if default is not in app_language_tags.
- Locale.set_app_language_tags("no", "pt")
- Locale.default = "zh"
- assert_equal common("zh"), Locale.candidates
-
- Locale.default = "en"
- Locale.set_app_language_tags(nil)
- end
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_detect_general.rb b/vendor/gems/locale-2.0.5/test/test_detect_general.rb
deleted file mode 100644
index 08b912df1..000000000
--- a/vendor/gems/locale-2.0.5/test/test_detect_general.rb
+++ /dev/null
@@ -1,164 +0,0 @@
-require 'locale'
-require 'test/unit'
-
-class TestDetectGeneral < Test::Unit::TestCase
-
- def setup
- Locale.clear_all
- ENV["LC_ALL"] = nil
- ENV["LC_MESSAGES"] = nil
- ENV["LANG"] = nil
- ENV["LANGUAGE"] = nil
- end
-
- def test_lc_all
- ENV["LC_ALL"] = "ja_JP.eucJP"
- ENV["LC_MESSAGES"] = "zh_CN.UTF-8" #Ignored.
- ENV["LANG"] = "ko_KR.UTF-8" #Ignored.
- ENV["LANGUAGE"] = nil
-
- lang = Locale.current[0]
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "eucJP", lang.charset
- assert_equal Locale::Tag::Posix.new("ja", "JP", "eucJP"), lang
-
- assert_equal "eucJP", Locale.charset
- end
-
- def test_lc_messages
- ENV["LC_ALL"] = nil
- ENV["LC_MESSAGES"] = "ja_JP.eucJP"
- ENV["LANG"] = "ko_KR.UTF-8" #Ignored.
- ENV["LANGUAGE"] = nil
-
- lang = Locale.current[0]
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "eucJP", lang.charset
- assert_equal Locale::Tag::Posix.new("ja", "JP", "eucJP"), lang
-
- assert_equal "eucJP", Locale.charset
- end
-
- def test_lang
- ENV["LC_ALL"] = nil
- ENV["LC_MESSAGES"] = nil
- ENV["LANG"] = "ja_JP.eucJP"
- ENV["LANGUAGE"] = nil
-
- lang = Locale.current[0]
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "eucJP", lang.charset
- assert_equal Locale::Tag::Posix.new("ja", "JP", "eucJP"), lang
-
- assert_equal "eucJP", Locale.charset
- end
-
- def test_lang_complex
- ENV["LC_ALL"] = "zh_CN.UTF-8" # Ignored.
- ENV["LC_MESSAGES"] = "ko_KR.UTF-8" #Ingored.
- ENV["LANG"] = "en_US.UTF-8" # Ignored.
- ENV["LANGUAGE"] ="ja_JP.eucJP:zh_CN.UTF-8"
-
- lang = Locale.current[0]
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "eucJP", lang.charset
- assert_equal Locale::Tag::Posix.new("ja", "JP", "eucJP"), lang
-
- # Use the LANG value (locale charmap don't use LANGUAGE)
- assert_equal "UTF-8", Locale.charset
- end
-
- def test_language
- ENV["LC_ALL"] = "ja_JP.Shift_JIS"
- ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP"
-
- tags = Locale.current
- assert_equal Locale::Tag::Posix, tags[0].class
- assert_equal Locale::Tag::Posix, tags[1].class
-
- assert_equal "zh", tags.language
- assert_equal "CN", tags.region
- assert_equal "UTF-8", tags.charset
-
- assert_equal "zh", tags[0].language
- assert_equal "CN", tags[0].region
- assert_equal "UTF-8", tags[0].charset
-
- assert_equal "ja", tags[1].language
- assert_equal "JP", tags[1].region
- assert_equal nil, tags[1].charset
-
- assert_equal Locale::TagList.new([Locale::Tag::Posix.new("zh", "CN", "UTF-8"),
- Locale::Tag::Posix.new("ja", "JP")]), tags
-
- assert_equal "Shift_JIS", Locale.charset
- end
-
- def test_no_charset
- ENV["LC_ALL"] = "cs_CZ"
-
- lang = Locale.current[0]
- assert_equal Locale::Tag::Posix, lang.class
-
- assert_equal "cs", lang.language
- assert_equal "CZ", lang.region
- assert_equal nil, lang.charset
- assert_equal Locale::Tag::Posix.new("cs", "CZ"), lang
-
-=begin
- This test doesn't work any environment such as Ubuntu.
- Because this method gets the system locale via "locale -a" command.
- if /linux|bsd/ =~ RUBY_PLATFORM
- assert_equal "ISO-8859-2", Locale.charset
- end
-=end
- end
-
- def test_default
- return unless /linux|bsd/ =~ RUBY_PLATFORM
- Locale.set_default("yo_NG")
- assert_equal Locale::Tag.parse("yo_NG"), Locale.default
- assert_equal Locale::Tag.parse("yo_NG"), Locale.current[0]
- Locale.set_default(nil)
-
- Locale.default = "fr"
- assert_equal Locale::Tag.parse("fr"), Locale.default
- assert_equal Locale::Tag.parse("fr"), Locale.current[0]
- Locale.default = nil
- end
-
- def test_current
- Locale.set_current("yo_NG")
- assert_equal Locale::Tag.parse("yo_NG"), Locale.current[0]
-
- Locale.current = "fr"
- assert_equal Locale::Tag.parse("fr"), Locale.current[0]
-
- Locale.set_default("yo_NG")
- Locale.current = "fr"
- assert_equal Locale::Tag.parse("yo_NG"), Locale.default
- assert_equal Locale::Tag.parse("fr"), Locale.current[0]
- Locale.set_default(nil)
- end
-
- def test_clear
- ENV["LC_ALL"] = "ja_JP.Shift_JIS"
- ENV["LANGUAGE"] = nil
-
- assert_equal Locale::Tag.parse("ja_JP.Shift_JIS"), Locale.current[0]
- Locale.clear
- ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP"
- assert_equal Locale::Tag::Posix.parse("zh_CN.UTF-8"), Locale.current[0]
- assert_equal Locale::Tag::Posix.parse("ja_JP"), Locale.current[1]
-
- end
-
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_driver_jruby.rb b/vendor/gems/locale-2.0.5/test/test_driver_jruby.rb
deleted file mode 100644
index 692d34029..000000000
--- a/vendor/gems/locale-2.0.5/test/test_driver_jruby.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-
-begin
- require 'locale/driver/jruby'
- require 'test/unit'
- class TestDiverJRuby < Test::Unit::TestCase
-
- def setup
- ENV["LC_ALL"] = nil
- ENV["LC_MESSAGES"] = nil
- ENV["LANG"] = nil
- ENV["LANGUAGE"] = nil
- end
-
- def set_locale(tag)
- java.util.Locale.setDefault(java.util.Locale.new(tag.language, tag.region, tag.variants.to_s))
- end
-
- def test_charset
- # Depends on system value when jvm is started.
- end
-
- def test_locales
- tag = Locale::Tag::Common.parse("ja-JP")
- set_locale(tag)
- assert_equal [tag], Locale::Driver::JRuby.locales
- end
-
- def test_locales_with_env
- ENV["LC_ALL"] = "ja_JP.EUC-JP"
- assert_equal Locale::Tag::Posix.parse("ja_JP.EUC-JP"), Locale::Driver::JRuby.locales[0]
- assert_equal "EUC-JP", Locale::Driver::JRuby.charset
-
- ENV["LC_ALL"] = "ja_JP"
- assert_equal Locale::Tag::Posix.parse("ja_JP"), Locale::Driver::JRuby.locales[0]
-
- ENV["LC_ALL"] = "C"
- assert_equal Locale::Tag::Posix.parse("C"), Locale::Driver::JRuby.locales[0]
- end
- end
-
-rescue LoadError
- puts "jruby test was skipped."
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_driver_win32.rb b/vendor/gems/locale-2.0.5/test/test_driver_win32.rb
deleted file mode 100644
index 604cd6efe..000000000
--- a/vendor/gems/locale-2.0.5/test/test_driver_win32.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-begin
- require 'locale/driver/win32'
- require 'test/unit'
-
- class TestDiverWin32 < Test::Unit::TestCase
-
- def setup
- ENV["LC_ALL"] = nil
- ENV["LC_MESSAGES"] = nil
- ENV["LANG"] = nil
- ENV["LANGUAGE"] = nil
- Locale::Driver::Win32.set_thread_locale_id(nil)
- end
-
- def test_charset
- Locale::Driver::Win32.set_thread_locale_id(0x0404)
- assert_equal "CP950", Locale::Driver::Win32.charset
-
- Locale::Driver::Win32.set_thread_locale_id(0x0411)
- assert_equal "CP932", Locale::Driver::Win32.charset
-
- Locale::Driver::Win32.set_thread_locale_id(0x201A)
- assert_equal "CP1251", Locale::Driver::Win32.charset
-
- Locale::Driver::Win32.set_thread_locale_id(0x0465)
- assert_equal "UNICODE", Locale::Driver::Win32.charset
-
- Locale::Driver::Win32.set_thread_locale_id(0x2222) # invalid
- assert_equal "CP1252", Locale::Driver::Win32.charset
- end
-
- def test_locales
- Locale::Driver::Win32.set_thread_locale_id(0x0404)
- assert_equal Locale::Tag::Common.parse("zh-TW"), Locale::Driver::Win32.locales[0]
-
- Locale::Driver::Win32.set_thread_locale_id(0x0411)
- assert_equal Locale::Tag::Common.parse("ja-JP"), Locale::Driver::Win32.locales[0]
-
- Locale::Driver::Win32.set_thread_locale_id(0x201A)
- assert_equal Locale::Tag::Common.parse("bs-Cyrl-BA"), Locale::Driver::Win32.locales[0]
-
- Locale::Driver::Win32.set_thread_locale_id(0x0465)
- assert_equal Locale::Tag::Common.parse("div-MV"), Locale::Driver::Win32.locales[0]
-
- Locale::Driver::Win32.set_thread_locale_id(0x2222) # invalid
- assert_equal nil, Locale::Driver::Win32.locales
- end
-
- def test_locales_with_env
- ENV["LC_ALL"] = "ja_JP.UTF-8"
- assert_equal Locale::Tag::Posix.parse("ja_JP.UTF-8"), Locale::Driver::Win32.locales[0]
- assert_equal "UTF-8", Locale::Driver::Win32.charset
-
- ENV["LC_ALL"] = "ja_JP"
- assert_equal Locale::Tag::Posix.parse("ja_JP"), Locale::Driver::Win32.locales[0]
- assert_equal "CP932", Locale::Driver::Win32.charset
-
- ENV["LC_ALL"] = "C"
- assert_equal Locale::Tag::Posix.parse("C"), Locale::Driver::Win32.locales[0]
- assert_equal "CP1252", Locale::Driver::Win32.charset
- end
- end
-rescue LoadError
- puts "win32 test was skipped."
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_info.rb b/vendor/gems/locale-2.0.5/test/test_info.rb
deleted file mode 100644
index d34efe8fa..000000000
--- a/vendor/gems/locale-2.0.5/test/test_info.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# encoding: UTF-8
-
-require 'locale/info'
-require 'test/unit'
-
-class TestLocaleInfo < Test::Unit::TestCase
- def test_languages
- langs = Locale::Info.three_languages
- assert_equal 7600, langs.length
- assert_equal "English", langs["eng"].name
- assert langs["eng"].living?
- assert langs["eng"].individual?
-
- langs = Locale::Info.two_languages
- assert_equal 185, langs.length
- assert_equal "English", langs["en"].name
- assert langs["en"].living?
- assert langs["en"].individual?
- end
-
- def test_regions
- regions = Locale::Info.regions
- assert_equal 243, regions.length
- assert_equal "United States", regions["US"].name
-
- assert_equal "ÅLand Islands", regions['AX'].name
- end
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_memoizable.rb b/vendor/gems/locale-2.0.5/test/test_memoizable.rb
deleted file mode 100644
index 6ce7092e4..000000000
--- a/vendor/gems/locale-2.0.5/test/test_memoizable.rb
+++ /dev/null
@@ -1,133 +0,0 @@
-require 'locale/util/memoizable'
-require 'test/unit'
-
-class A
- include Locale::Util::Memoizable
- def initialize
- @count = 0
- @a = ""
- end
- def test1(a)
- @a += String(a)
- @count += 1
- end
- memoize :test1
- attr_reader :a
-end
-
-class B < A
-end
-
-class C < A
- def test1(a)
- @a = String(a) + @a
- @count += 1
- end
- memoize :test1
-end
-
-class D
- class << self
- include Locale::Util::Memoizable
- def init
- @@count = 0
- @@a = "a"
- end
- def test1(a)
- @@a = @@a + "b" * a
- @@count += 1
- end
- memoize :test1
- def a
- @@a
- end
- end
-end
-
-class E
- include Locale::Util::Memoizable
- def test2
- "aa"
- end
- memoize :test2
-
- def test2_dup
- "bb"
- end
- memoize_dup :test2_dup
-end
-
-class TestMemoizable < Test::Unit::TestCase
- def test_simple
- t = A.new
- assert_equal 1, t.test1(1)
- assert_equal "1", t.a
- assert_equal 1, t.test1(1)
- assert_equal "1", t.a
- assert_equal 2, t.test1(2)
- assert_equal "12", t.a
- assert_equal 2, t.test1(2)
- assert_equal "12", t.a
- assert_equal 1, t.test1(1)
- assert_equal "12", t.a
- end
-
- def test_simple_inherited
- t = B.new
- assert_equal 1, t.test1(1)
- assert_equal "1", t.a
- assert_equal 1, t.test1(1)
- assert_equal "1", t.a
- assert_equal 2, t.test1(2)
- assert_equal "12", t.a
- assert_equal 2, t.test1(2)
- assert_equal "12", t.a
- assert_equal 1, t.test1(1)
- assert_equal "12", t.a
- end
-
- def test_override
- t = C.new
- assert_equal 1, t.test1(1)
- assert_equal "1", t.a
- assert_equal 1, t.test1(1)
- assert_equal "1", t.a
- assert_equal 2, t.test1(2)
- assert_equal "21", t.a
- assert_equal 2, t.test1(2)
- assert_equal "21", t.a
- assert_equal 1, t.test1(1)
- assert_equal "21", t.a
- end
-
- def test_class_method
- D.init
- assert_equal 1, D.test1(1)
- assert_equal "ab", D.a
- assert_equal 1, D.test1(1)
- assert_equal "ab", D.a
- assert_equal 2, D.test1(2)
- assert_equal "abbb", D.a
- assert_equal 2, D.test1(2)
- assert_equal "abbb", D.a
- assert_equal 1, D.test1(1)
- assert_equal "abbb", D.a
- end
-
- def test_freeze_or_dup
- t = E.new
- assert_equal "aa", t.test2
- # When modification attempted on frozen objects,
- # ruby 1.9 raises RuntimeError instead of TypeError.
- # http://redmine.ruby-lang.org/issues/show/409
- # http://redmine.ruby-lang.org/repositories/diff/ruby-19/error.c?rev=7294
- if RUBY_VERSION < '1.9.0'
- assert_raise(TypeError){ t.test2 << "a" }
- else
- assert_raise(RuntimeError){ t.test2 << "a" }
- end
- assert_equal "bb", t.test2_dup
- assert_equal "bbb", t.test2_dup << "b"
- assert_equal "bb", t.test2_dup
- end
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_tag.rb b/vendor/gems/locale-2.0.5/test/test_tag.rb
deleted file mode 100644
index ded243995..000000000
--- a/vendor/gems/locale-2.0.5/test/test_tag.rb
+++ /dev/null
@@ -1,1233 +0,0 @@
-require 'locale/tag'
-require 'test/unit'
-
-class TagTest < Test::Unit::TestCase
-
- def test_simple_lang
- #ja-JP, ja-392
- lang = Locale::Tag.parse("ja")
- assert_equal Locale::Tag::Simple, lang.class
- assert_equal "ja", lang.language
- assert_equal nil, lang.region
- assert_equal [Locale::Tag::Simple.parse("ja"),
- Locale::Tag::Simple.parse("ja")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja"), lang.to_posix
-
- lang = Locale::Tag.parse("kok")
- assert_equal Locale::Tag::Simple, lang.class
- assert_equal "kok", lang.language
- assert_equal nil, lang.region
- assert_equal [Locale::Tag::Simple.parse("kok"),
- Locale::Tag::Simple.parse("kok")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("kok"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("kok"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("kok"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("kok"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("kok"), lang.to_posix
- end
-
- def test_simple_lang_region
- lang = Locale::Tag.parse("ja-JP")
- assert_equal Locale::Tag::Simple, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal [Locale::Tag::Simple.parse("ja_JP"),
- Locale::Tag::Simple.parse("ja")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_JP"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-JP"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja-JP"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP"), lang.to_posix
-
- lang = Locale::Tag.parse("ja_JP")
- assert_equal Locale::Tag::Simple, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal [Locale::Tag::Simple.parse("ja_JP"),
- Locale::Tag::Simple.parse("ja")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_JP"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-JP"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja-JP"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP"), lang.to_posix
- end
-
- def test_simple_unm49
- # UN_M.49(Country code)
- lang = Locale::Tag.parse("ja-392")
- assert_equal Locale::Tag::Simple, lang.class
- assert_equal "ja", lang.language
- assert_equal "392", lang.region
- assert_equal [Locale::Tag::Simple.parse("ja_392"),
- Locale::Tag::Simple.parse("ja")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja-392"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja-392"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-392"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja-392"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_392"), lang.to_posix
-
- lang = Locale::Tag.parse("jpn-392")
- assert_equal Locale::Tag::Simple, lang.class
- assert_equal "jpn", lang.language
- assert_equal "392", lang.region
- assert_equal [Locale::Tag::Simple.parse("jpn-392"),
- Locale::Tag::Simple.parse("jpn")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("jpn-392"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("jpn-392"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("jpn-392"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("jpn-392"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("jpn_392"), lang.to_posix
-
- lang = Locale::Tag.parse("es-419")
- assert_equal Locale::Tag::Simple, lang.class
- assert_equal "es", lang.language
- assert_equal "419", lang.region
- assert_equal [Locale::Tag::Simple.parse("es-419"),
- Locale::Tag::Simple.parse("es")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("es-419"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("es-419"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("es-419"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("es_419"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("es_419"), lang.to_posix
- end
-
- def test_simple_writer
- lang = Locale::Tag.parse("ja-JP")
- assert_equal Locale::Tag::Simple, lang.class
- assert_equal "ja_JP", lang.to_s
- assert_equal [Locale::Tag::Simple.parse("ja-JP"),
- Locale::Tag::Simple.parse("ja")], lang.candidates
- lang.language = "en"
- assert_equal "en", lang.language
- assert_equal "en_JP", lang.to_s
- assert_equal [Locale::Tag::Simple.parse("en-JP"),
- Locale::Tag::Simple.parse("en")], lang.candidates
-
- lang.region = "US"
- assert_equal "en", lang.language
- assert_equal "US", lang.region
- assert_equal "en_US", lang.to_s
- assert_equal [Locale::Tag::Simple.parse("en-US"),
- Locale::Tag::Simple.parse("en")], lang.candidates
-
- end
-
- #lang, region, script, variants
- def test_common_lang_script
- lang = Locale::Tag.parse("az_Arab")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "az", lang.language
- assert_equal nil, lang.region
- assert_equal "Arab", lang.script
- assert_equal [Locale::Tag::Common.parse("az_Arab"),
- Locale::Tag::Common.parse("az_Arab"),
- Locale::Tag::Common.parse("az"),
- Locale::Tag::Common.parse("az"),
- Locale::Tag::Common.parse("az_Arab"),
- Locale::Tag::Common.parse("az_Arab"),
- Locale::Tag::Common.parse("az"),
- Locale::Tag::Common.parse("az"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("az"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("az_Arab"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("az-Arab"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("az_Arab"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("az"), lang.to_posix
-
-
- lang = Locale::Tag.parse("uz-Cyrl")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "uz", lang.language
- assert_equal nil, lang.region
- assert_equal "Cyrl", lang.script
- assert_equal [Locale::Tag::Common.parse("uz-Cyrl"),
- Locale::Tag::Common.parse("uz-Cyrl"),
- Locale::Tag::Common.parse("uz"),
- Locale::Tag::Common.parse("uz"),
- Locale::Tag::Common.parse("uz-Cyrl"),
- Locale::Tag::Common.parse("uz-Cyrl"),
- Locale::Tag::Common.parse("uz"),
- Locale::Tag::Common.parse("uz"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("uz"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("uz_Cyrl"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("uz-Cyrl"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("uz_Cyrl"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("uz"), lang.to_posix
- end
-
- def test_common_lang_script_region
- lang = Locale::Tag.parse("ja-Kana-JP")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "Kana", lang.script
- assert_equal [Locale::Tag::Common.parse("ja-Kana-JP"),
- Locale::Tag::Common.parse("ja-Kana-JP"),
- Locale::Tag::Common.parse("ja-JP"),
- Locale::Tag::Common.parse("ja-JP"),
- Locale::Tag::Common.parse("ja-Kana"),
- Locale::Tag::Common.parse("ja-Kana"),
- Locale::Tag::Common.parse("ja"),
- Locale::Tag::Common.parse("ja")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_Kana_JP"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-Kana-JP"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_Kana_JP"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP"), lang.to_posix
-
- # 3 char language
- lang = Locale::Tag.parse("jpn-Hira-JP")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "jpn", lang.language
- assert_equal "JP", lang.region
- assert_equal "Hira", lang.script
- assert_equal [Locale::Tag::Common.parse("jpn-Hira-JP"),
- Locale::Tag::Common.parse("jpn-Hira-JP"),
- Locale::Tag::Common.parse("jpn-JP"),
- Locale::Tag::Common.parse("jpn-JP"),
- Locale::Tag::Common.parse("jpn-Hira"),
- Locale::Tag::Common.parse("jpn-Hira"),
- Locale::Tag::Common.parse("jpn"),
- Locale::Tag::Common.parse("jpn")], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("jpn_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("jpn_Hira_JP"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("jpn-Hira-JP"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("jpn_Hira_JP"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("jpn_JP"), lang.to_posix
- end
-
- def test_common_lang_script_unm49
- lang = Locale::Tag.parse("jpn-Hira-392")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "jpn", lang.language
- assert_equal "392", lang.region
- assert_equal "Hira", lang.script
- assert_equal [Locale::Tag::Common.parse("jpn_Hira_392"),
- Locale::Tag::Common.parse("jpn_Hira_392"),
- Locale::Tag::Common.parse("jpn_392"),
- Locale::Tag::Common.parse("jpn_392"),
- Locale::Tag::Common.parse("jpn_Hira"),
- Locale::Tag::Common.parse("jpn_Hira"),
- Locale::Tag::Common.parse("jpn"),
- Locale::Tag::Common.parse("jpn")], lang.candidates
-
-
- assert_equal Locale::Tag::Simple.parse("jpn_392"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("jpn_Hira_392"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("jpn-Hira-392"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("jpn_Hira_392"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("jpn_392"), lang.to_posix
- end
-
- def test_common_lang_script_region_variants
- lang = Locale::Tag.parse("en_Latn_US_NYNORSK")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "en", lang.language
- assert_equal "US", lang.region
- assert_equal ["NYNORSK"], lang.variants
- assert_equal [Locale::Tag::Common.parse("en_Latn_US_NYNORSK"),
- Locale::Tag::Common.parse("en_Latn_US"),
- Locale::Tag::Common.parse("en_US_NYNORSK"),
- Locale::Tag::Common.parse("en_US"),
- Locale::Tag::Common.parse("en_Latn_NYNORSK"),
- Locale::Tag::Common.parse("en_Latn"),
- Locale::Tag::Common.parse("en_NYNORSK"),
- Locale::Tag::Common.parse("en")], lang.candidates
-
-
- assert_equal Locale::Tag::Simple.parse("en-US"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en_Latn_US_NYNORSK"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en-Latn-US-NYNORSK"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en_Latn_US_NYNORSK"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en_US@NYNORSK"), lang.to_posix
- end
-
-
- def test_common_lang_variants
- lang = Locale::Tag.parse("ja-osaka")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal nil, lang.region
- assert_equal nil, lang.script
- assert_equal ["osaka"], lang.variants
-
- assert_equal [Locale::Tag::Common.parse("ja-osaka"),
- Locale::Tag::Common.parse("ja"),
- Locale::Tag::Common.parse("ja-osaka"),
- Locale::Tag::Common.parse("ja"),
- Locale::Tag::Common.parse("ja-osaka"),
- Locale::Tag::Common.parse("ja"),
- Locale::Tag::Common.parse("ja-osaka"),
- Locale::Tag::Common.parse("ja")
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja-osaka"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-osaka"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_OSAKA"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja@osaka"), lang.to_posix
- end
-
- def test_common_lang_region_variants
- lang = Locale::Tag.parse("ja-JP-osaka")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal nil, lang.script
- assert_equal ["osaka"], lang.variants
-
- assert_equal [Locale::Tag::Common.parse("ja_JP_osaka"),
- Locale::Tag::Common.parse("ja_JP"),
- Locale::Tag::Common.parse("ja_JP_osaka"),
- Locale::Tag::Common.parse("ja_JP"),
- Locale::Tag::Common.parse("ja_osaka"),
- Locale::Tag::Common.parse("ja"),
- Locale::Tag::Common.parse("ja_osaka"),
- Locale::Tag::Common.parse("ja")
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_JP_osaka"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-JP-osaka"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_JP_OSAKA"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP@osaka"), lang.to_posix
- end
-
- def test_common_lang_script_region_5length_variants
- lang = Locale::Tag.parse("ja-Kana-JP-osaka")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "Kana", lang.script
- assert_equal ["osaka"], lang.variants
-
- assert_equal [Locale::Tag::Common.parse("ja-Kana-JP-osaka"),
- Locale::Tag::Common.parse("ja-Kana-JP"),
- Locale::Tag::Common.parse("ja-JP-osaka"),
- Locale::Tag::Common.parse("ja-JP"),
- Locale::Tag::Common.parse("ja-Kana-osaka"),
- Locale::Tag::Common.parse("ja-Kana"),
- Locale::Tag::Common.parse("ja-osaka"),
- Locale::Tag::Common.parse("ja")
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_Kana-JP_osaka"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-Kana-JP-osaka"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_Kana_JP_OSAKA"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP@osaka"), lang.to_posix
- end
-
- def test_common_lang_script_region_mid_length_variants
- #middle length
- lang = Locale::Tag.parse("ja-Kana-JP-aomori")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "Kana", lang.script
- assert_equal ["aomori"], lang.variants
-
- assert_equal [Locale::Tag::Common.parse("ja-Kana-JP-aomori"),
- Locale::Tag::Common.parse("ja-Kana-JP"),
- Locale::Tag::Common.parse("ja-JP-aomori"),
- Locale::Tag::Common.parse("ja-JP"),
- Locale::Tag::Common.parse("ja-Kana-aomori"),
- Locale::Tag::Common.parse("ja-Kana"),
- Locale::Tag::Common.parse("ja-aomori"),
- Locale::Tag::Common.parse("ja")
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_Kana-JP_aomori"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-Kana-JP-aomori"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_Kana_JP_AOMORI"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP@aomori"), lang.to_posix
-
- end
-
- def test_common_lang_script_region_8length_variants
- #8 length
- lang = Locale::Tag.parse("ja-Kana-JP-hokuriku")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "Kana", lang.script
- assert_equal ["hokuriku"], lang.variants
-
- assert_equal [Locale::Tag::Common.parse("ja-Kana-JP-hokuriku"),
- Locale::Tag::Common.parse("ja-Kana-JP"),
- Locale::Tag::Common.parse("ja-JP-hokuriku"),
- Locale::Tag::Common.parse("ja-JP"),
- Locale::Tag::Common.parse("ja-Kana-hokuriku"),
- Locale::Tag::Common.parse("ja-Kana"),
- Locale::Tag::Common.parse("ja-hokuriku"),
- Locale::Tag::Common.parse("ja")
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_Kana-JP_hokuriku"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-Kana-JP-hokuriku"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_Kana_JP_HOKURIKU"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP@hokuriku"), lang.to_posix
- end
-
- def test_common_lang_script_region_special_variants
- #1 digit and 3 alpha
- lang = Locale::Tag.parse("ja-Kana-JP-0abc")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "Kana", lang.script
- assert_equal ["0abc"], lang.variants
-
- assert_equal [Locale::Tag::Common.parse("ja-Kana-JP-0abc"),
- Locale::Tag::Common.parse("ja-Kana-JP"),
- Locale::Tag::Common.parse("ja-JP-0abc"),
- Locale::Tag::Common.parse("ja-JP"),
- Locale::Tag::Common.parse("ja-Kana-0abc"),
- Locale::Tag::Common.parse("ja-Kana"),
- Locale::Tag::Common.parse("ja-0abc"),
- Locale::Tag::Common.parse("ja")
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_Kana-JP_0abc"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-Kana-JP-0abc"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_Kana_JP_0ABC"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP@0abc"), lang.to_posix
- end
-
- def test_common_lang_region_4digits_variants
- #4 digits
- lang = Locale::Tag.parse("de-CH-1996")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "de", lang.language
- assert_equal "CH", lang.region
- assert_equal nil, lang.script
- assert_equal ["1996"], lang.variants
- assert_equal [Locale::Tag::Common.parse("de_CH_1996"),
- Locale::Tag::Common.parse("de_CH"),
- Locale::Tag::Common.parse("de_CH_1996"),
- Locale::Tag::Common.parse("de_CH"),
- Locale::Tag::Common.parse("de_1996"),
- Locale::Tag::Common.parse("de"),
- Locale::Tag::Common.parse("de_1996"),
- Locale::Tag::Common.parse("de"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("de-CH"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("de-CH-1996"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("de-CH-1996"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("de_CH_1996"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("de_CH@1996"), lang.to_posix
- end
-
- def test_common_lang_region_plural_variants
- #Plural
- lang = Locale::Tag.parse("ja-Kana-JP-hokuriku-aomori")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "Kana", lang.script
- assert_equal ["hokuriku", "aomori"], lang.variants
-
- assert_equal [Locale::Tag::Common.parse("ja-Kana-JP-hokuriku-aomori"),
- Locale::Tag::Common.parse("ja-Kana-JP"),
- Locale::Tag::Common.parse("ja-JP-hokuriku-aomori"),
- Locale::Tag::Common.parse("ja-JP"),
- Locale::Tag::Common.parse("ja-Kana-hokuriku-aomori"),
- Locale::Tag::Common.parse("ja-Kana"),
- Locale::Tag::Common.parse("ja-hokuriku-aomori"),
- Locale::Tag::Common.parse("ja"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja-JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja-Kana-JP-hokuriku-aomori"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-Kana-JP-hokuriku-aomori"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja-Kana-JP_HOKURIKU_AOMORI"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP@hokuriku-aomori"), lang.to_posix
- end
-
- def test_common_cases
- #cases
- lang = Locale::Tag.parse("mn-Cyrl-MN")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "mn", lang.language
- assert_equal "MN", lang.region
- assert_equal "Cyrl", lang.script
-
- assert_equal [Locale::Tag::Common.parse("mn-Cyrl-MN"),
- Locale::Tag::Common.parse("mn-Cyrl-MN"),
- Locale::Tag::Common.parse("mn-MN"),
- Locale::Tag::Common.parse("mn-MN"),
- Locale::Tag::Common.parse("mn-Cyrl"),
- Locale::Tag::Common.parse("mn-Cyrl"),
- Locale::Tag::Common.parse("mn"),
- Locale::Tag::Common.parse("mn"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("mn_MN"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("mn_Cyrl_MN"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("mn-Cyrl-MN"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("mn-Cyrl-MN"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("mn_MN"), lang.to_posix
-
- lang = Locale::Tag.parse("mN-cYrL-Mn")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "mn", lang.language
- assert_equal "MN", lang.region
- assert_equal "Cyrl", lang.script
-
- assert_equal Locale::Tag::Simple.parse("mn_MN"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("mn_Cyrl_MN"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("mn-Cyrl-MN"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("mn-Cyrl-MN"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("mn_MN"), lang.to_posix
-
- lang = Locale::Tag.parse("MN-cYRL-mn")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "mn", lang.language
- assert_equal "MN", lang.region
- assert_equal "Cyrl", lang.script
-
- assert_equal Locale::Tag::Simple.parse("mn_MN"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("mn_Cyrl_MN"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("mn-Cyrl-MN"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("mn-Cyrl-MN"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("mn_MN"), lang.to_posix
-
- lang = Locale::Tag.parse("zh-Latn-CN-variant1")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "zh", lang.language
- assert_equal "CN", lang.region
- assert_equal "Latn", lang.script
- assert_equal ["variant1"], lang.variants
-
- assert_equal [Locale::Tag::Common.parse("zh-Latn-CN-variant1"),
- Locale::Tag::Common.parse("zh-Latn-CN"),
- Locale::Tag::Common.parse("zh-CN-variant1"),
- Locale::Tag::Common.parse("zh-CN"),
- Locale::Tag::Common.parse("zh-Latn-variant1"),
- Locale::Tag::Common.parse("zh-Latn"),
- Locale::Tag::Common.parse("zh-variant1"),
- Locale::Tag::Common.parse("zh"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("zh_CN"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("zh_Latn_CN-variant1"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("zh-Latn-CN-variant1"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("zh-Latn-CN_VARIANT1"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("zh_CN@variant1"), lang.to_posix
- end
-
- def test_common_lang_region_variants_rfc3066
- # RFC3066 compatible
- lang = Locale::Tag.parse("ja-jp-mac")
- assert_equal Locale::Tag::Common, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal ["mac"], lang.variants
- assert_equal nil, lang.script
- assert_equal [Locale::Tag::Common.parse("ja_JP_mac"),
- Locale::Tag::Common.parse("ja_JP"),
- Locale::Tag::Common.parse("ja_JP_mac"),
- Locale::Tag::Common.parse("ja_JP"),
- Locale::Tag::Common.parse("ja_mac"),
- Locale::Tag::Common.parse("ja"),
- Locale::Tag::Common.parse("ja_mac"),
- Locale::Tag::Common.parse("ja"),
- ], lang.candidates
-
- end
-
- def test_common_writer
- lang = Locale::Tag.parse("zh-Latn-CN-variant1")
- lang.language = "ja"
- assert_equal "ja_Latn_CN_variant1", lang.to_s
- lang.script = "Hira"
- assert_equal "ja_Hira_CN_variant1", lang.to_s
- lang.region = "JP"
- assert_equal "ja_Hira_JP_variant1", lang.to_s
- lang.variants = ["variant1", "variant2"]
- assert_equal "ja_Hira_JP_variant1_variant2", lang.to_s
-
- assert_equal [Locale::Tag::Common.parse("ja-Hira-JP-variant1-variant2"),
- Locale::Tag::Common.parse("ja-Hira-JP"),
- Locale::Tag::Common.parse("ja-JP-variant1-variant2"),
- Locale::Tag::Common.parse("ja-JP"),
- Locale::Tag::Common.parse("ja-Hira-variant1-variant2"),
- Locale::Tag::Common.parse("ja-Hira"),
- Locale::Tag::Common.parse("ja-variant1-variant2"),
- Locale::Tag::Common.parse("ja"),
- ], lang.candidates
-
- end
-
- def test_rfc_lang_script_region_variant_extension
- lang = Locale::Tag.parse("zh-Latn-CN-variant1-a-extend1")
- assert_equal Locale::Tag::Rfc, lang.class
- assert_equal "zh", lang.language
- assert_equal "CN", lang.region
- assert_equal "Latn", lang.script
- assert_equal ["variant1"], lang.variants
- assert_equal ["a-extend1"], lang.extensions
- assert_equal nil, lang.privateuse
-
- assert_equal [Locale::Tag::Rfc.parse("zh-Latn-CN-variant1"),
- Locale::Tag::Rfc.parse("zh-Latn-CN"),
- Locale::Tag::Rfc.parse("zh-CN-variant1"),
- Locale::Tag::Rfc.parse("zh-CN"),
- Locale::Tag::Rfc.parse("zh-Latn-variant1"),
- Locale::Tag::Rfc.parse("zh-Latn"),
- Locale::Tag::Rfc.parse("zh-variant1"),
- Locale::Tag::Rfc.parse("zh"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("zh_CN"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("zh-Latn-CN_variant1"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("zh-Latn-CN-variant1-a-extend1"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("zh_Latn_CN_VARIANT1"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("zh_CN@variant1"), lang.to_posix
- end
-
- def test_rfc_lang_script_region_extensions
- lang = Locale::Tag.parse("ja-Kana-JP-0abc-y-aa-z-bbccdd-b-nnnnnnnn")
- assert_equal Locale::Tag::Rfc, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "Kana", lang.script
- assert_equal ["0abc"], lang.variants
- assert_equal ["y-aa", "z-bbccdd", "b-nnnnnnnn"], lang.extensions
-
- assert_equal [Locale::Tag::Rfc.parse("ja-Kana-JP-0abc"),
- Locale::Tag::Rfc.parse("ja-Kana-JP"),
- Locale::Tag::Rfc.parse("ja-JP-0abc"),
- Locale::Tag::Rfc.parse("ja-JP"),
- Locale::Tag::Rfc.parse("ja-Kana-0abc"),
- Locale::Tag::Rfc.parse("ja-Kana"),
- Locale::Tag::Rfc.parse("ja-0abc"),
- Locale::Tag::Rfc.parse("ja"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja-Kana-JP-0abc"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-Kana-JP-0abc-y-aa-z-bbccdd-b-nnnnnnnn"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_Kana_JP_0abc"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP@0abc"), lang.to_posix
- end
-
- def test_rfc_lang_region_variants_extensions
- lang = Locale::Tag.parse("ja-JP-0abc-y-aa-z-bbccdd-b-xxxnnnnn")
- assert_equal Locale::Tag::Rfc, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal nil, lang.script
- assert_equal ["0abc"], lang.variants
- assert_equal ["y-aa", "z-bbccdd", "b-xxxnnnnn"], lang.extensions
-
- assert_equal [Locale::Tag::Rfc.parse("ja-JP-0abc"),
- Locale::Tag::Rfc.parse("ja-JP"),
- Locale::Tag::Rfc.parse("ja-JP-0abc"),
- Locale::Tag::Rfc.parse("ja-JP"),
- Locale::Tag::Rfc.parse("ja-0abc"),
- Locale::Tag::Rfc.parse("ja"),
- Locale::Tag::Rfc.parse("ja-0abc"),
- Locale::Tag::Rfc.parse("ja"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja-JP-0abc"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-JP-0abc-y-aa-z-bbccdd-b-xxxnnnnn"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_JP_0abc"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP@0abc"), lang.to_posix
-
- end
-
- def test_rfc_lang_extensions
- lang = Locale::Tag.parse("ja-y-aa-z-bbccdd-b-xxnnnnn")
- assert_equal Locale::Tag::Rfc, lang.class
- assert_equal "ja", lang.language
- assert_equal nil, lang.region
- assert_equal nil, lang.script
- assert_equal [], lang.variants
- assert_equal ["y-aa", "z-bbccdd", "b-xxnnnnn"], lang.extensions
-
- assert_equal [Locale::Tag::Rfc.parse("ja"),
- Locale::Tag::Rfc.parse("ja"),
- Locale::Tag::Rfc.parse("ja"),
- Locale::Tag::Rfc.parse("ja"),
- Locale::Tag::Rfc.parse("ja"),
- Locale::Tag::Rfc.parse("ja"),
- Locale::Tag::Rfc.parse("ja"),
- Locale::Tag::Rfc.parse("ja"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-y-aa-z-bbccdd-b-xxnnnnn"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja"), lang.to_posix
- end
-
- def test_rfc_privateuse
- #Privateuse
- lang = Locale::Tag.parse("zh-Latn-CN-variant1-a-extend1-x-wadegile-private1")
- assert_equal Locale::Tag::Rfc, lang.class
- assert_equal "zh", lang.language
- assert_equal "CN", lang.region
- assert_equal "Latn", lang.script
- assert_equal ["variant1"], lang.variants
- assert_equal ["a-extend1"], lang.extensions
- assert_equal "x-wadegile-private1", lang.privateuse
-
- assert_equal [Locale::Tag::Rfc.parse("zh-Latn-CN-variant1"),
- Locale::Tag::Rfc.parse("zh-Latn-CN"),
- Locale::Tag::Rfc.parse("zh-CN-variant1"),
- Locale::Tag::Rfc.parse("zh-CN"),
- Locale::Tag::Rfc.parse("zh-Latn-variant1"),
- Locale::Tag::Rfc.parse("zh-Latn"),
- Locale::Tag::Rfc.parse("zh-variant1"),
- Locale::Tag::Rfc.parse("zh"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("zh_CN"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("zh-Latn-CN_variant1"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("zh-Latn-CN-variant1-a-extend1-x-wadegile-private1"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("zh_Latn_CN_VARIANT1"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("zh_CN@variant1"), lang.to_posix
- end
-
- def test_rfc_cldr_conversion
- #Privateuse with x-ldml (CLDR conversion)
- lang = Locale::Tag.parse("en-US-x-ldml-POSIX-k-calendar-islamic-k-collatio-traditio-k-colStren-secondar")
- assert_equal Locale::Tag::Rfc, lang.class
- assert_equal "en", lang.language
- assert_equal "US", lang.region
- assert_equal ["POSIX"], lang.variants
- assert_equal ["k-calendar-islamic", "k-collatio-traditio", "k-colStren-secondar"], lang.extensions
- assert_equal "x-ldml-POSIX-k-calendar-islamic-k-collatio-traditio-k-colStren-secondar", lang.privateuse
-
- assert_equal [Locale::Tag::Rfc.parse("en-US-POSIX"),
- Locale::Tag::Rfc.parse("en-US"),
- Locale::Tag::Rfc.parse("en-US-POSIX"),
- Locale::Tag::Rfc.parse("en-US"),
- Locale::Tag::Rfc.parse("en-POSIX"),
- Locale::Tag::Rfc.parse("en"),
- Locale::Tag::Rfc.parse("en-POSIX"),
- Locale::Tag::Rfc.parse("en"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("en_US"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en-US_POSIX"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en-US-x-ldml-POSIX-k-calendar-islamic-k-collatio-traditio-k-colStren-secondar"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en_US_POSIX@calendar=islamic;collatio=traditio;colStren=secondar"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en_US@POSIX"), lang.to_posix
-
- lang = Locale::Tag.parse("en-US-x-ldml-k-calendar-islamic-k-collatio-traditio-k-colStren-secondar")
- assert_equal Locale::Tag::Rfc, lang.class
- assert_equal "en", lang.language
- assert_equal "US", lang.region
- assert_equal [], lang.variants
- assert_equal ["k-calendar-islamic", "k-collatio-traditio", "k-colStren-secondar"], lang.extensions
- assert_equal "x-ldml-k-calendar-islamic-k-collatio-traditio-k-colStren-secondar", lang.privateuse
-
- assert_equal [Locale::Tag::Rfc.parse("en-US"),
- Locale::Tag::Rfc.parse("en-US"),
- Locale::Tag::Rfc.parse("en-US"),
- Locale::Tag::Rfc.parse("en-US"),
- Locale::Tag::Rfc.parse("en"),
- Locale::Tag::Rfc.parse("en"),
- Locale::Tag::Rfc.parse("en"),
- Locale::Tag::Rfc.parse("en"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("en_US"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en-US"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en-US-x-ldml-k-calendar-islamic-k-collatio-traditio-k-colStren-secondar"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en_US@calendar=islamic;collatio=traditio;colStren=secondar"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en_US"), lang.to_posix
- end
-
- def test_rfc_writer
- lang = Locale::Tag.parse("zh-Latn-CN-variant1-a-extend1-x-wadegile-private1")
- lang.language = "ja"
- assert_equal "ja-Latn-CN-variant1-a-extend1-x-wadegile-private1", lang.to_s
- lang.script = "Hira"
- assert_equal "ja-Hira-CN-variant1-a-extend1-x-wadegile-private1", lang.to_s
- lang.region = "JP"
- assert_equal "ja-Hira-JP-variant1-a-extend1-x-wadegile-private1", lang.to_s
- lang.variants = ["variant2"]
- assert_equal "ja-Hira-JP-variant2-a-extend1-x-wadegile-private1", lang.to_s
- lang.extensions = ["b-extend2"]
- assert_equal "ja-Hira-JP-variant2-b-extend2-x-wadegile-private1", lang.to_s
- lang.privateuse = "x-foooo"
- assert_equal "ja-Hira-JP-variant2-b-extend2-x-foooo", lang.to_s
-
- assert_equal [Locale::Tag::Rfc.parse("ja-Hira-JP-variant2"),
- Locale::Tag::Rfc.parse("ja-Hira-JP"),
- Locale::Tag::Rfc.parse("ja-JP-variant2"),
- Locale::Tag::Rfc.parse("ja-JP"),
- Locale::Tag::Rfc.parse("ja-Hira-variant2"),
- Locale::Tag::Rfc.parse("ja-Hira"),
- Locale::Tag::Rfc.parse("ja-variant2"),
- Locale::Tag::Rfc.parse("ja"),
- ], lang.candidates
- end
-
- def test_cldr_lang_extensions
- lang = Locale::Tag.parse("de@collation=phonebook")
- assert_equal Locale::Tag::Cldr, lang.class
- assert_equal "de", lang.language
- assert_equal nil, lang.region
- assert_equal "phonebook", lang.extensions["collation"]
-
- assert_equal [Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("de"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("de"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("de-k-collatio-phoneboo"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("de@collation=phonebook"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("de"), lang.to_posix
- end
-
- def test_cldr_lang_script_extension
- lang = Locale::Tag.parse("az_Arab@collation=phonebook")
- assert_equal Locale::Tag::Cldr, lang.class
- assert_equal "az", lang.language
- assert_equal nil, lang.region
- assert_equal "Arab", lang.script
- assert_equal "phonebook", lang.extensions["collation"]
-
- assert_equal [Locale::Tag::Cldr.parse("az_Arab"),
- Locale::Tag::Cldr.parse("az_Arab"),
- Locale::Tag::Cldr.parse("az"),
- Locale::Tag::Cldr.parse("az"),
- Locale::Tag::Cldr.parse("az_Arab"),
- Locale::Tag::Cldr.parse("az_Arab"),
- Locale::Tag::Cldr.parse("az"),
- Locale::Tag::Cldr.parse("az"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("az"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("az_Arab"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("az-Arab-k-collatio-phoneboo"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("az_Arab@collation=phonebook"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("az"), lang.to_posix
-
- end
-
- def test_cldr_lang_region_extensions
- lang = Locale::Tag.parse("de_DE@collation=phonebook;currency=DDM")
- assert_equal Locale::Tag::Cldr, lang.class
- assert_equal "de", lang.language
- assert_equal "DE", lang.region
- assert_equal "phonebook", lang.extensions["collation"]
- assert_equal "DDM", lang.extensions["currency"]
-
- assert_equal [Locale::Tag::Cldr.parse("de_DE"),
- Locale::Tag::Cldr.parse("de_DE"),
- Locale::Tag::Cldr.parse("de_DE"),
- Locale::Tag::Cldr.parse("de_DE"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- Locale::Tag::Cldr.parse("de"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("de_DE"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("de_DE"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("de-DE-k-collatio-phoneboo-k-currency-DDM"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("de_DE@collation=phonebook;currency=DDM"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("de_DE"), lang.to_posix
-
- lang = Locale::Tag.parse("en_US@calendar=islamic;collation=traditional;colStrength=secondary")
- assert_equal Locale::Tag::Cldr, lang.class
- assert_equal "en", lang.language
- assert_equal "US", lang.region
- assert_equal [], lang.variants
- assert_equal "islamic", lang.extensions["calendar"]
- assert_equal "traditional", lang.extensions["collation"]
- assert_equal "secondary", lang.extensions["colStrength"]
-
- assert_equal [Locale::Tag::Cldr.parse("en_US"),
- Locale::Tag::Cldr.parse("en_US"),
- Locale::Tag::Cldr.parse("en_US"),
- Locale::Tag::Cldr.parse("en_US"),
- Locale::Tag::Cldr.parse("en"),
- Locale::Tag::Cldr.parse("en"),
- Locale::Tag::Cldr.parse("en"),
- Locale::Tag::Cldr.parse("en"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("en_US"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en_US"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en-US-k-calendar-islamic-k-collatio-traditio-k-colStren-secondar"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en_US@calendar=islamic;collation=traditional;colStrength=secondary"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en_US"), lang.to_posix
-
- end
-
- def test_cldr_lang_region_variants_extensions
- lang = Locale::Tag.parse("en_US_POSIX@calendar=islamic;collation=traditional;colStrength=secondary")
- assert_equal Locale::Tag::Cldr, lang.class
- assert_equal "en", lang.language
- assert_equal "US", lang.region
- assert_equal ["POSIX"], lang.variants
- assert_equal "islamic", lang.extensions["calendar"]
- assert_equal "traditional", lang.extensions["collation"]
- assert_equal "secondary", lang.extensions["colStrength"]
-
- assert_equal [Locale::Tag::Cldr.parse("en_US_POSIX"),
- Locale::Tag::Cldr.parse("en_US"),
- Locale::Tag::Cldr.parse("en_US_POSIX"),
- Locale::Tag::Cldr.parse("en_US"),
- Locale::Tag::Cldr.parse("en_POSIX"),
- Locale::Tag::Cldr.parse("en"),
- Locale::Tag::Cldr.parse("en_POSIX"),
- Locale::Tag::Cldr.parse("en"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("en_US"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en_US_POSIX"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en-US-POSIX-k-calendar-islamic-k-collatio-traditio-k-colStren-secondar"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en_US_POSIX@calendar=islamic;collation=traditional;colStrength=secondary"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en_US@POSIX"), lang.to_posix
- end
-
- def test_cldr_writer
- lang = Locale::Tag.parse("en_US@calendar=islamic;colStrength=secondary")
- lang.language = "ja"
- assert_equal "ja_US@calendar=islamic;colStrength=secondary", lang.to_s
- lang.script = "Hira"
- assert_equal "ja_Hira_US@calendar=islamic;colStrength=secondary", lang.to_s
- lang.region = "JP"
- assert_equal "ja_Hira_JP@calendar=islamic;colStrength=secondary", lang.to_s
- lang.variants = ["POSIX"]
- assert_equal "ja_Hira_JP_POSIX@calendar=islamic;colStrength=secondary", lang.to_s
- lang.extensions = {:collation => "traditional"}
- assert_equal "ja_Hira_JP_POSIX@collation=traditional", lang.to_s
-
- assert_equal [Locale::Tag::Cldr.parse("ja_Hira_JP_POSIX"),
- Locale::Tag::Cldr.parse("ja_Hira_JP"),
- Locale::Tag::Cldr.parse("ja_JP_POSIX"),
- Locale::Tag::Cldr.parse("ja_JP"),
- Locale::Tag::Cldr.parse("ja_Hira_POSIX"),
- Locale::Tag::Cldr.parse("ja_Hira"),
- Locale::Tag::Cldr.parse("ja_POSIX"),
- Locale::Tag::Cldr.parse("ja"),
- ], lang.candidates
- end
-
- def test_posix_c_and_posix
- lang = Locale::Tag.parse("C")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "en", lang.language
- assert_equal "US", lang.region
- assert_equal "C", lang.tag
-
- assert_equal [Locale::Tag::Posix.parse("en_US"),
- Locale::Tag::Posix.parse("en_US"),
- Locale::Tag::Posix.parse("en_US"),
- Locale::Tag::Posix.parse("en_US"),
- Locale::Tag::Posix.parse("en"),
- Locale::Tag::Posix.parse("en"),
- Locale::Tag::Posix.parse("en"),
- Locale::Tag::Posix.parse("en"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("en_US"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en_US"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en-US"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en_US"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en_US"), lang.to_posix
-
- lang = Locale::Tag.parse("POSIX")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "en", lang.language
- assert_equal "US", lang.region
- assert_equal "POSIX", lang.tag
-
- assert_equal [Locale::Tag::Posix.parse("en_US"),
- Locale::Tag::Posix.parse("en_US"),
- Locale::Tag::Posix.parse("en_US"),
- Locale::Tag::Posix.parse("en_US"),
- Locale::Tag::Posix.parse("en"),
- Locale::Tag::Posix.parse("en"),
- Locale::Tag::Posix.parse("en"),
- Locale::Tag::Posix.parse("en"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("en_US"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en_US"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en-US"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en_US"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en_US"), lang.to_posix
- end
-
- def test_posix_irregular_format
- lang = Locale::Tag.parse("japanese.euc")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "japanese", lang.language
- assert_equal nil, lang.region
- assert_equal "euc", lang.charset
-
- assert_equal [Locale::Tag::Posix.parse("japanese.euc"),
- Locale::Tag::Posix.parse("japanese.euc"),
- Locale::Tag::Posix.parse("japanese"),
- Locale::Tag::Posix.parse("japanese"),
- Locale::Tag::Posix.parse("japanese.euc"),
- Locale::Tag::Posix.parse("japanese.euc"),
- Locale::Tag::Posix.parse("japanese"),
- Locale::Tag::Posix.parse("japanese"),
- ], lang.candidates
-
- lang = Locale::Tag.parse("univ.utf8")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "univ", lang.language
- assert_equal nil, lang.region
- assert_equal "utf8", lang.charset
-
- assert_equal [Locale::Tag::Posix.parse("univ.utf8"),
- Locale::Tag::Posix.parse("univ.utf8"),
- Locale::Tag::Posix.parse("univ"),
- Locale::Tag::Posix.parse("univ"),
- Locale::Tag::Posix.parse("univ.utf8"),
- Locale::Tag::Posix.parse("univ.utf8"),
- Locale::Tag::Posix.parse("univ"),
- Locale::Tag::Posix.parse("univ"),
- ], lang.candidates
- end
-
- def test_posix_lang_charset
- lang = Locale::Tag.parse("es.iso885915")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "es", lang.language
- assert_equal nil, lang.region
- assert_equal "iso885915", lang.charset
- assert_equal nil, lang.modifier
-
- assert_equal [Locale::Tag::Posix.parse("es.iso885915"),
- Locale::Tag::Posix.parse("es.iso885915"),
- Locale::Tag::Posix.parse("es"),
- Locale::Tag::Posix.parse("es"),
- Locale::Tag::Posix.parse("es.iso885915"),
- Locale::Tag::Posix.parse("es.iso885915"),
- Locale::Tag::Posix.parse("es"),
- Locale::Tag::Posix.parse("es"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("es"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("es"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("es"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("es"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("es.iso885915"), lang.to_posix
- end
-
- def test_posix_lang_region_charset
- lang = Locale::Tag.parse("es_ES.iso885915")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "es", lang.language
- assert_equal "ES", lang.region
- assert_equal "iso885915", lang.charset
- assert_equal nil, lang.modifier
-
- assert_equal [Locale::Tag::Posix.parse("es_ES.iso885915"),
- Locale::Tag::Posix.parse("es_ES.iso885915"),
- Locale::Tag::Posix.parse("es_ES"),
- Locale::Tag::Posix.parse("es_ES"),
- Locale::Tag::Posix.parse("es.iso885915"),
- Locale::Tag::Posix.parse("es.iso885915"),
- Locale::Tag::Posix.parse("es"),
- Locale::Tag::Posix.parse("es"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("es_ES"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("es_ES"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("es-ES"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("es_ES"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("es_ES.iso885915"), lang.to_posix
-
- lang = Locale::Tag.parse("ja_JP.UTF-8")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "ja", lang.language
- assert_equal "JP", lang.region
- assert_equal "UTF-8", lang.charset
-
- assert_equal [Locale::Tag::Posix.parse("ja_JP.UTF-8"),
- Locale::Tag::Posix.parse("ja_JP.UTF-8"),
- Locale::Tag::Posix.parse("ja_JP"),
- Locale::Tag::Posix.parse("ja_JP"),
- Locale::Tag::Posix.parse("ja.UTF-8"),
- Locale::Tag::Posix.parse("ja.UTF-8"),
- Locale::Tag::Posix.parse("ja"),
- Locale::Tag::Posix.parse("ja"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("ja_JP"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("ja_JP"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-JP"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_JP"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP.UTF-8"), lang.to_posix
- end
-
- def test_posix_lang_modifier
- lang = Locale::Tag.parse("es@euro")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "es", lang.language
- assert_equal nil, lang.region
- assert_equal nil, lang.charset
- assert_equal "euro", lang.modifier
-
- assert_equal [Locale::Tag::Posix.parse("es@euro"),
- Locale::Tag::Posix.parse("es"),
- Locale::Tag::Posix.parse("es@euro"),
- Locale::Tag::Posix.parse("es"),
- Locale::Tag::Posix.parse("es@euro"),
- Locale::Tag::Posix.parse("es"),
- Locale::Tag::Posix.parse("es@euro"),
- Locale::Tag::Posix.parse("es"),
- ], lang.candidates
-
- # A modifier is converted to a variant.
- # If the modifier is less than 5 characters, it is not canonical value.
- assert_equal Locale::Tag::Simple.parse("es"), lang.to_simple
- assert_equal Locale::Tag::Common.new("es", nil, nil, ["euro"]), lang.to_common
- assert_equal Locale::Tag::Rfc.new("es", nil, nil, ["euro"]), lang.to_rfc
- assert_equal Locale::Tag::Cldr.new("es", nil, nil, ["euro"]), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("es@euro"), lang.to_posix
- end
-
- def test_posix_lang_region_modifier
- lang = Locale::Tag.parse("es_ES@euro")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "es", lang.language
- assert_equal "ES", lang.region
- assert_equal nil, lang.charset
- assert_equal "euro", lang.modifier
-
- assert_equal [Locale::Tag::Posix.parse("es_ES@euro"),
- Locale::Tag::Posix.parse("es_ES"),
- Locale::Tag::Posix.parse("es_ES@euro"),
- Locale::Tag::Posix.parse("es_ES"),
- Locale::Tag::Posix.parse("es@euro"),
- Locale::Tag::Posix.parse("es"),
- Locale::Tag::Posix.parse("es@euro"),
- Locale::Tag::Posix.parse("es"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("es_ES"), lang.to_simple
- assert_equal Locale::Tag::Common.new("es", nil, "ES", ["euro"]), lang.to_common
- assert_equal Locale::Tag::Rfc.new("es", nil, "ES", ["euro"]), lang.to_rfc
- assert_equal Locale::Tag::Cldr.new("es", nil, "ES", ["EURO"]), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("es_ES@euro"), lang.to_posix
-
- end
-
- def test_posix_lang_region_charset_modifier
- lang = Locale::Tag.parse("es_ES.iso885915@euro")
- assert_equal Locale::Tag::Posix, lang.class
- assert_equal "es", lang.language
- assert_equal "ES", lang.region
- assert_equal "iso885915", lang.charset
- assert_equal "euro", lang.modifier
-
- assert_equal [Locale::Tag::Posix.parse("es_ES.iso885915@euro"),
- Locale::Tag::Posix.parse("es_ES.iso885915"),
- Locale::Tag::Posix.parse("es_ES@euro"),
- Locale::Tag::Posix.parse("es_ES"),
- Locale::Tag::Posix.parse("es.iso885915@euro"),
- Locale::Tag::Posix.parse("es.iso885915"),
- Locale::Tag::Posix.parse("es@euro"),
- Locale::Tag::Posix.parse("es"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("es_ES"), lang.to_simple
- assert_equal Locale::Tag::Common.new("es", nil, "ES", ["euro"]), lang.to_common
- assert_equal Locale::Tag::Rfc.new("es", nil, "ES", ["euro"]), lang.to_rfc
- assert_equal Locale::Tag::Cldr.new("es", nil, "ES", ["EURO"]), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("es_ES.iso885915@euro"), lang.to_posix
-
- end
-
- def test_posix_writer
- lang = Locale::Tag.parse("es_ES.iso885915@euro")
- lang.language = "ja"
- assert_equal "ja_ES.iso885915@euro", lang.to_s
- lang.region = "JP"
- assert_equal "ja_JP.iso885915@euro", lang.to_s
- lang.charset = "EUC-JP"
- assert_equal "ja_JP.EUC-JP@euro", lang.to_s
- lang.modifier = "osaka"
- assert_equal "ja_JP.EUC-JP@osaka", lang.to_s
- assert_equal [Locale::Tag::Posix.parse("ja_JP.EUC-JP@osaka"),
- Locale::Tag::Posix.parse("ja_JP.EUC-JP"),
- Locale::Tag::Posix.parse("ja_JP@osaka"),
- Locale::Tag::Posix.parse("ja_JP"),
- Locale::Tag::Posix.parse("ja.EUC-JP@osaka"),
- Locale::Tag::Posix.parse("ja.EUC-JP"),
- Locale::Tag::Posix.parse("ja@osaka"),
- Locale::Tag::Posix.parse("ja"),
- ], lang.candidates
- end
-
- def test_invaild
- lang = Locale::Tag.parse("")
- assert_equal Locale::Tag::Irregular, lang.class
- assert_equal "en", lang.language
- assert_equal nil, lang.region
-
- assert_equal [Locale::Tag::Irregular.new("en"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("en"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en"), lang.to_posix
-
- lang = Locale::Tag.parse(nil)
- assert_equal Locale::Tag::Irregular, lang.class
- assert_equal "en", lang.language
- assert_equal nil, lang.region
-
- assert_equal [Locale::Tag::Irregular.new("en"),
- ], lang.candidates
-
- assert_equal Locale::Tag::Simple.parse("en"), lang.to_simple
- assert_equal Locale::Tag::Common.parse("en"), lang.to_common
- assert_equal Locale::Tag::Rfc.parse("en"), lang.to_rfc
- assert_equal Locale::Tag::Cldr.parse("en"), lang.to_cldr
- assert_equal Locale::Tag::Posix.parse("en"), lang.to_posix
- end
-
- def test_raise_error
- assert_raise(RuntimeError){
- Locale::Tag::Simple.new(nil)
- }
- end
-
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_taglist.rb b/vendor/gems/locale-2.0.5/test/test_taglist.rb
deleted file mode 100644
index 5a426a7d3..000000000
--- a/vendor/gems/locale-2.0.5/test/test_taglist.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# encoding: UTF-8
-
-require 'locale/tag'
-require 'locale/taglist'
-require 'test/unit'
-
-class TestTagList < Test::Unit::TestCase
- def test_taglist_posix
- list = Locale::TagList.new([Locale::Tag.parse("ja_JP.eucJP@mobile"),
- Locale::Tag.parse("en_US.iso8859-1")])
-
- assert_equal "ja", list.language
- assert_equal "JP", list.region
- assert_equal "eucJP", list.charset
- assert_equal "mobile", list.modifier
- assert_equal "ja_JP.eucJP@mobile", list.to_s
- assert_equal Locale::Tag::Common.parse("ja_JP_mobile"), list.to_common
- assert_equal Locale::Tag::Rfc.parse("ja-JP-mobile"), list.to_rfc
- assert_equal Locale::Tag::Cldr.parse("ja_JP_mobile"), list.to_cldr
- assert_equal Locale::Tag::Posix.parse("ja_JP.eucJP@mobile"), list.to_posix
- assert_equal Locale::Tag::Posix.parse("en_US.iso8859-1"), list[1]
- end
-
- def test_taglist_rfc
- list = Locale::TagList.new([Locale::Tag.parse("ja-Hira-JP-MOBILE-y-aaa-x-bbb"),
- Locale::Tag.parse("en-US-mobile")])
- assert_equal "ja", list.language
- assert_equal "Hira", list.script
- assert_equal "JP", list.region
- assert_equal ["MOBILE"], list.variants
- assert_equal ["y-aaa"], list.extensions
- assert_equal "x-bbb", list.privateuse
- end
-end
diff --git a/vendor/gems/locale-2.0.5/test/test_thread.rb b/vendor/gems/locale-2.0.5/test/test_thread.rb
deleted file mode 100644
index 43dba513e..000000000
--- a/vendor/gems/locale-2.0.5/test/test_thread.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-require 'locale'
-require 'thread'
-require 'test/unit'
-
-class TestThread < Test::Unit::TestCase
-
- def setup
- Locale.init(:driver => :env)
- @mutex = Mutex.new
- end
-
- def invoke_thread(tag, sleep_time)
- Thread.start do
- @mutex.synchronize {
- ENV["LC_ALL"] = tag
- Locale.current
- }
- (1..10).each do |v|
-# puts "#{tag}: locale = #{Locale.current}"
- assert_equal tag, Locale.current.to_posix.to_s
- print "."
- $stdout.flush
- sleep sleep_time
- end
- Locale.clear # Clear this thread only.
- end
- end
-
- def test_thread
- th1 = invoke_thread("ja_JP.eucJP", 0.3)
- th2 = invoke_thread("zh_CN.UTF-8", 0.2)
- th3 = invoke_thread("en", 0.1)
- th1.join
- th2.join
- th3.join
- end
-end