aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/bin
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/bin')
-rwxr-xr-xactivesupport/bin/generate_tables31
-rwxr-xr-xactivesupport/bin/test4
2 files changed, 18 insertions, 17 deletions
diff --git a/activesupport/bin/generate_tables b/activesupport/bin/generate_tables
index 2193533588..06dcff4e87 100755
--- a/activesupport/bin/generate_tables
+++ b/activesupport/bin/generate_tables
@@ -1,18 +1,17 @@
#!/usr/bin/env ruby
begin
- $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
- require 'active_support'
+ $:.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
+ require "active_support"
rescue IOError
end
-require 'open-uri'
-require 'tmpdir'
+require "open-uri"
+require "tmpdir"
module ActiveSupport
module Multibyte
module Unicode
-
class UnicodeDatabase
def load; end
end
@@ -20,10 +19,10 @@ module ActiveSupport
class DatabaseGenerator
BASE_URI = "http://www.unicode.org/Public/#{UNICODE_VERSION}/ucd/"
SOURCES = {
- :codepoints => BASE_URI + 'UnicodeData.txt',
- :composition_exclusion => BASE_URI + 'CompositionExclusions.txt',
- :grapheme_break_property => BASE_URI + 'auxiliary/GraphemeBreakProperty.txt',
- :cp1252 => 'http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT'
+ codepoints: BASE_URI + "UnicodeData.txt",
+ composition_exclusion: BASE_URI + "CompositionExclusions.txt",
+ grapheme_break_property: BASE_URI + "auxiliary/GraphemeBreakProperty.txt",
+ cp1252: "http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT"
}
def initialize
@@ -52,9 +51,9 @@ module ActiveSupport
codepoint.code = $1.hex
codepoint.combining_class = Integer($4)
codepoint.decomp_type = $7
- codepoint.decomp_mapping = ($8=='') ? nil : $8.split.collect(&:hex)
- codepoint.uppercase_mapping = ($16=='') ? 0 : $16.hex
- codepoint.lowercase_mapping = ($17=='') ? 0 : $17.hex
+ codepoint.decomp_mapping = ($8=="") ? nil : $8.split.collect(&:hex)
+ codepoint.uppercase_mapping = ($16=="") ? 0 : $16.hex
+ codepoint.lowercase_mapping = ($17=="") ? 0 : $17.hex
@ucd.codepoints[codepoint.code] = codepoint
end
@@ -62,8 +61,8 @@ module ActiveSupport
if line =~ /^([0-9A-F.]+)\s*;\s*([\w]+)\s*#/
type = $2.downcase.intern
@ucd.boundary[type] ||= []
- if $1.include? '..'
- parts = $1.split '..'
+ if $1.include? ".."
+ parts = $1.split ".."
@ucd.boundary[type] << (parts[0].hex..parts[1].hex)
else
@ucd.boundary[type] << $1.hex
@@ -105,7 +104,7 @@ module ActiveSupport
filename = File.join(Dir.tmpdir, "#{url.split('/').last}")
unless File.exist?(filename)
$stderr.puts "Downloading #{url.split('/').last}"
- File.open(filename, 'wb') do |target|
+ File.open(filename, "wb") do |target|
open(url) do |source|
source.each_line { |line| target.write line }
end
@@ -120,7 +119,7 @@ module ActiveSupport
end
def dump_to(filename)
- File.open(filename, 'wb') do |f|
+ File.open(filename, "wb") do |f|
f.write Marshal.dump([@ucd.codepoints, @ucd.composition_exclusion, @ucd.composition_map, @ucd.boundary, @ucd.cp1252])
end
end
diff --git a/activesupport/bin/test b/activesupport/bin/test
index 404cabba51..84a05bba08 100755
--- a/activesupport/bin/test
+++ b/activesupport/bin/test
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
-COMPONENT_ROOT = File.expand_path("../../", __FILE__)
+
+COMPONENT_ROOT = File.expand_path("..", __dir__)
require File.expand_path("../tools/test", COMPONENT_ROOT)
+
exit Minitest.run(ARGV)