Module: Fontisan::Cldr::Downloader

Defined in:
lib/fontisan/cldr/downloader.rb

Overview

Fetches CLDR JSON archives from unicode-org/cldr-json GitHub releases and unpacks them into the cache.

Single entry point: Downloader.download(version, force:). Idempotent unless force: true. Returns the path to the extracted main/ characters directory.

Class Method Summary collapse

Class Method Details

.download(version, force: false) ⇒ Pathname

Download and unpack CLDR JSON for version.

Parameters:

  • version (String)

    e.g. "46.0.0"

  • force (Boolean) (defaults to: false)

    if false and cache already has the extracted files, return without re-fetching.

Returns:

  • (Pathname)

    path to the extracted main/ characters dir

Raises:



25
26
27
28
29
30
31
32
33
# File 'lib/fontisan/cldr/downloader.rb', line 25

def download(version, force: false)
  target = CacheManager.characters_main_dir(version)
  return target if target.exist? && !force

  CacheManager.ensure_version_dir!(version)
  zip_data = fetch_zip(version)
  extract_archive(zip_data, CacheManager.json_dir(version))
  target
end