Module: Ucode::Repo::Paths
- Defined in:
- lib/ucode/repo/paths.rb
Overview
Pure functions describing the on-disk layout of the output tree.
The only code that knows the path conventions. Site generator, CLI, glyph writer, and fontisan adapter all go through here.
All methods are pure: no I/O, no global state, no side effects. Returns Pathname instances so callers can compose further.
Class Method Summary collapse
- .block_dir(output_root, block_id) ⇒ Pathname
- .block_metadata_path(output_root, block_id) ⇒ Pathname
- .blocks_index_path(output_root) ⇒ Pathname
- .codepoint_dir(output_root, block_id, cp_id) ⇒ Pathname
- .codepoint_glyph_path(output_root, block_id, cp_id) ⇒ Pathname
- .codepoint_json_path(output_root, block_id, cp_id) ⇒ Pathname
-
.cp_id(cp) ⇒ String
Format an integer codepoint as the canonical “U+XXXX” id used everywhere (paths, JSON, cross-references).
- .labels_index_path(output_root) ⇒ Pathname
- .manifest_path(output_root) ⇒ Pathname
- .names_index_path(output_root) ⇒ Pathname
- .plane_metadata_path(output_root, plane_number) ⇒ Pathname
- .script_metadata_path(output_root, script_code) ⇒ Pathname
-
.tmp_path(path) ⇒ Pathname
Temporary path for atomic writes — same directory as ‘path`, so rename stays within one filesystem.
Class Method Details
.block_dir(output_root, block_id) ⇒ Pathname
39 40 41 |
# File 'lib/ucode/repo/paths.rb', line 39 def block_dir(output_root, block_id) Pathname(output_root).join(BLOCKS_DIR, block_id) end |
.block_metadata_path(output_root, block_id) ⇒ Pathname
70 71 72 |
# File 'lib/ucode/repo/paths.rb', line 70 def (output_root, block_id) block_dir(output_root, block_id).join(INDEX_FILENAME) end |
.blocks_index_path(output_root) ⇒ Pathname
76 77 78 |
# File 'lib/ucode/repo/paths.rb', line 76 def blocks_index_path(output_root) Pathname(output_root).join(BLOCKS_DIR, INDEX_FILENAME) end |
.codepoint_dir(output_root, block_id, cp_id) ⇒ Pathname
47 48 49 |
# File 'lib/ucode/repo/paths.rb', line 47 def codepoint_dir(output_root, block_id, cp_id) block_dir(output_root, block_id).join(cp_id) end |
.codepoint_glyph_path(output_root, block_id, cp_id) ⇒ Pathname
63 64 65 |
# File 'lib/ucode/repo/paths.rb', line 63 def codepoint_glyph_path(output_root, block_id, cp_id) codepoint_dir(output_root, block_id, cp_id).join(GLYPH_FILENAME) end |
.codepoint_json_path(output_root, block_id, cp_id) ⇒ Pathname
55 56 57 |
# File 'lib/ucode/repo/paths.rb', line 55 def codepoint_json_path(output_root, block_id, cp_id) codepoint_dir(output_root, block_id, cp_id).join(INDEX_FILENAME) end |
.cp_id(cp) ⇒ String
Format an integer codepoint as the canonical “U+XXXX” id used everywhere (paths, JSON, cross-references). Always at least 4 hex digits, uppercase, no extra padding.
32 33 34 |
# File 'lib/ucode/repo/paths.rb', line 32 def cp_id(cp) format("U+%04X", cp) end |
.labels_index_path(output_root) ⇒ Pathname
102 103 104 |
# File 'lib/ucode/repo/paths.rb', line 102 def labels_index_path(output_root) Pathname(output_root).join(INDEX_DIR, "labels.json") end |
.manifest_path(output_root) ⇒ Pathname
108 109 110 |
# File 'lib/ucode/repo/paths.rb', line 108 def manifest_path(output_root) Pathname(output_root).join("manifest.json") end |
.names_index_path(output_root) ⇒ Pathname
96 97 98 |
# File 'lib/ucode/repo/paths.rb', line 96 def names_index_path(output_root) Pathname(output_root).join(INDEX_DIR, "names.json") end |
.plane_metadata_path(output_root, plane_number) ⇒ Pathname
83 84 85 |
# File 'lib/ucode/repo/paths.rb', line 83 def (output_root, plane_number) Pathname(output_root).join(PLANES_DIR, "#{plane_number}.json") end |
.script_metadata_path(output_root, script_code) ⇒ Pathname
90 91 92 |
# File 'lib/ucode/repo/paths.rb', line 90 def (output_root, script_code) Pathname(output_root).join(SCRIPTS_DIR, "#{script_code}.json") end |
.tmp_path(path) ⇒ Pathname
Temporary path for atomic writes — same directory as ‘path`, so rename stays within one filesystem.
116 117 118 |
# File 'lib/ucode/repo/paths.rb', line 116 def tmp_path(path) path.parent.join("#{path.basename}.tmp") end |