Sha256: 0d3400d6b0430f0c4da6958a83768e9f2c89d5b21c7576979d9f9f396ba1e70e

Contents?: true

Size: 1.28 KB

Versions: 8

Compression:

Stored size: 1.28 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true
require "fontist"
require "rubygems"
require "yaml"

flavors = ARGV

Fontist::Formula.update_formulas_repo

flavors.each do |flavor|
  begin
    gem_name = "metanorma-#{flavor}"
    require gem_name

    submodule = case flavor
                when "jcgm"
                  "Bipm"
                else
                  flavor.capitalize
                end
    processor_class = "Metanorma::#{submodule}::Processor"

    processor = Object
      .const_get(processor_class)
      .new

    unless processor.respond_to?(:fonts_manifest)
      puts "#{flavor} don't require any fonts"
      exit(0)
    end

    manifest = processor.fonts_manifest

    Fontist::Manifest::Install.from_hash(
      manifest,
      confirmation: "yes",
    )

    puts "#{flavor}-related fonts:"
    puts Fontist::Manifest::Locations.from_hash(manifest).to_yaml
  rescue LoadError => e
    STDERR.puts "Could not load gem '#{gem_name}': #{e.message}"
    exit(1)
  rescue NameError => e
    STDERR.puts "Could not find class '#{processor_class}': #{e.message}"
    exit(1)
  rescue => e
    if e.class.to_s.start_with?("Fontist::Errors::")
      STDERR.puts "Fontist failed with: #{e.message}"
    else
      STDERR.puts "Unknown error: #{e.message}"
    end
    exit(1)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
metanorma-cli-1.12.1 bin/font-test
metanorma-cli-1.12.0 bin/font-test
metanorma-cli-1.11.6 bin/font-test
metanorma-cli-1.11.5 bin/font-test
metanorma-cli-1.11.4 bin/font-test
metanorma-cli-1.11.3 bin/font-test
metanorma-cli-1.11.2 bin/font-test
metanorma-cli-1.11.1 bin/font-test