Module: TwitterCldr::Resources

Defined in:
lib/twitter_cldr/resources.rb,
lib/twitter_cldr/resources/loader.rb,
lib/twitter_cldr/resources/download.rb,
lib/twitter_cldr/resources/tries_dumper.rb,
lib/twitter_cldr/resources/tailoring_importer.rb,
lib/twitter_cldr/resources/phone_codes_importer.rb,
lib/twitter_cldr/resources/postal_codes_importer.rb,
lib/twitter_cldr/resources/unicode_data_importer.rb,
lib/twitter_cldr/resources/locales_resources_importer.rb,
lib/twitter_cldr/resources/canonical_compositions_updater.rb,
lib/twitter_cldr/resources/composition_exclusions_importer.rb,
lib/twitter_cldr/resources/custom_locales_resources_importer.rb

Defined Under Namespace

Modules: TriesDumper Classes: CanonicalCompositionsUpdater, CompositionExclusionsImporter, CustomLocalesResourcesImporter, Loader, LocalesResourcesImporter, PhoneCodesImporter, PostalCodesImporter, TailoringImporter, UnicodeDataImporter

Constant Summary collapse

CLDR_URL =
'http://unicode.org/Public/cldr/21/core.zip'

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
# 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
    puts "Downloading CLDR data from '#{url}' to '#{path}'."
    Cldr.download(url, path)
  end

  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