Module: TwitterCldr::Resources
- Defined in:
- lib/twitter_cldr/resources.rb,
lib/twitter_cldr/resources/uli.rb,
lib/twitter_cldr/resources/loader.rb,
lib/twitter_cldr/resources/download.rb,
lib/twitter_cldr/resources/properties.rb,
lib/twitter_cldr/resources/readme_renderer.rb,
lib/twitter_cldr/resources/unicode_importer.rb,
lib/twitter_cldr/resources/bidi_test_importer.rb,
lib/twitter_cldr/resources/rbnf_test_importer.rb,
lib/twitter_cldr/resources/tailoring_importer.rb,
lib/twitter_cldr/resources/phone_codes_importer.rb,
lib/twitter_cldr/resources/regexp_ast_generator.rb,
lib/twitter_cldr/resources/postal_codes_importer.rb,
lib/twitter_cldr/resources/unicode_data_importer.rb,
lib/twitter_cldr/resources/collation_tries_dumper.rb,
lib/twitter_cldr/resources/segment_tests_importer.rb,
lib/twitter_cldr/resources/language_codes_importer.rb,
lib/twitter_cldr/resources/casefolder_class_generator.rb,
lib/twitter_cldr/resources/locales_resources_importer.rb,
lib/twitter_cldr/resources/properties/property_importer.rb,
lib/twitter_cldr/resources/properties/prop_list_importer.rb,
lib/twitter_cldr/resources/properties/properties_importer.rb,
lib/twitter_cldr/resources/uli/segment_exceptions_importer.rb,
lib/twitter_cldr/resources/properties/age_property_importer.rb,
lib/twitter_cldr/resources/custom_locales_resources_importer.rb,
lib/twitter_cldr/resources/properties/jamo_property_importer.rb,
lib/twitter_cldr/resources/unicode_property_aliases_importer.rb,
lib/twitter_cldr/resources/properties/blocks_property_importer.rb,
lib/twitter_cldr/resources/properties/script_property_importer.rb,
lib/twitter_cldr/resources/properties/line_break_property_importer.rb,
lib/twitter_cldr/resources/properties/word_break_property_importer.rb,
lib/twitter_cldr/resources/properties/bidi_brackets_property_importer.rb,
lib/twitter_cldr/resources/properties/arabic_shaping_property_importer.rb,
lib/twitter_cldr/resources/properties/derived_core_properties_importer.rb,
lib/twitter_cldr/resources/properties/grapheme_break_property_importer.rb,
lib/twitter_cldr/resources/properties/sentence_break_property_importer.rb,
lib/twitter_cldr/resources/properties/unicode_data_properties_importer.rb,
lib/twitter_cldr/resources/properties/east_asian_width_property_importer.rb,
lib/twitter_cldr/resources/properties/script_extensions_property_importer.rb,
lib/twitter_cldr/resources/properties/hangul_syllable_type_property_importer.rb,
lib/twitter_cldr/resources/properties/indic_syllabic_category_property_importer.rb,
lib/twitter_cldr/resources/properties/indic_positional_category_property_importer.rb
Defined Under Namespace
Modules: CollationTriesDumper, Properties, Uli
Classes: BidiTestImporter, CasefolderClassGenerator, CustomLocalesResourcesImporter, LanguageCodesImporter, Loader, LocalesResourcesImporter, PhoneCodesImporter, PostalCodesImporter, RbnfTestImporter, ReadmeAssertionFailure, ReadmeRenderer, RegexpAstGenerator, ResourceLoadError, SegmentTestsImporter, TailoringImporter, UnicodeDataImporter, UnicodeImporter, UnicodePropertyAliasesImporter
Constant Summary
collapse
- CLDR_URL =
"http://unicode.org/Public/cldr/#{Versions.cldr_version}/core.zip"
- ICU4J_URL =
"http://download.icu-project.org/files/icu4j/#{Versions.icu_version}/icu4j-#{Versions.icu_version.gsub('.', '_')}.jar"
- UNICODE_URL =
"ftp://ftp.unicode.org/Public/#{Versions.unicode_version}"
Class Method Summary
collapse
Class Method Details
.download_cldr_if_necessary(path, url = CLDR_URL) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/twitter_cldr/resources/download.rb', line 27
def download_cldr_if_necessary(path, url = CLDR_URL)
if File.directory?(path)
puts "Using CLDR data from '#{path}'."
else
begin
require 'zip'
rescue LoadError
raise StandardError.new("Unable to require 'zip'. Please switch to at least Ruby 1.9, then rebundle and try again.")
end
require 'cldr/download'
puts "Downloading CLDR data from '#{url}' to '#{path}'."
Cldr.download(url, path)
end
path
end
|
.download_icu4j_if_necessary(path, url = ICU4J_URL) ⇒ Object
46
47
48
49
|
# File 'lib/twitter_cldr/resources/download.rb', line 46
def download_icu4j_if_necessary(path, url = ICU4J_URL)
download_if_necessary(path, url)
path
end
|
.download_if_necessary(path, url) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/twitter_cldr/resources/download.rb', line 15
def download_if_necessary(path, url)
if File.file?(path)
puts "Using '#{path}'."
else
puts "Downloading '#{url}' to '#{path}'."
FileUtils.mkdir_p(File.dirname(path))
system("curl #{url} -o #{path}")
end
path
end
|
.download_unicode_data_if_necessary(path, url) ⇒ Object
51
52
53
|
# File 'lib/twitter_cldr/resources/download.rb', line 51
def download_unicode_data_if_necessary(path, url)
download_if_necessary(path, join_urls(UNICODE_URL, url))
end
|