Module: Glossarist::Tasks::SyncModel
- Defined in:
- lib/glossarist/tasks/sync_model.rb
Overview
Syncs vendored concept-model data artifacts from glossarist/concept-model.
concept-model is a data-only repo (TTL, JSON-LD, YAML schemas). It is not a gem. We vendor the small set of artifacts we need (shapes, context, ontology) and load them at runtime via ShaclValidator.
Constant Summary collapse
- REPO =
"glossarist/concept-model"- OUT_DIR =
File.("data/concept-model", File.join(__dir__, "..", "..", ".."))
- TARGETS =
{ "prefixes.ttl" => %w[ ontologies/prefixes.ttl prefixes.ttl ].freeze, "glossarist.context.jsonld" => %w[ ontologies/glossarist.context.jsonld glossarist.context.jsonld ].freeze, "glossarist.ttl" => %w[ ontologies/glossarist.ttl glossarist.ttl ].freeze, "shapes/glossarist.shacl.ttl" => %w[ ontologies/shapes/glossarist.shacl.ttl shapes/glossarist.shacl.ttl ].freeze, }.freeze
Class Method Summary collapse
Class Method Details
.call(ref: nil) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/glossarist/tasks/sync_model.rb', line 40 def call(ref: nil) ref ||= latest_tag FileUtils.mkdir_p(File.join(OUT_DIR, "shapes")) TARGETS.each do |out_rel, candidates| content = fetch_any(ref, candidates) out_path = File.join(OUT_DIR, out_rel) FileUtils.mkdir_p(File.dirname(out_path)) File.write(out_path, content) puts " ✓ #{out_rel} (#{content.length} bytes)" end write_source_manifest(ref) puts "\nSynced #{TARGETS.length} file(s) from #{REPO}@#{ref}." end |