Class: Fontist::Import::MacosImporter
- Inherits:
-
Object
- Object
- Fontist::Import::MacosImporter
- Defined in:
- lib/fontist/import/macos_importer.rb
Constant Summary collapse
- HOMEPAGE =
"https://support.apple.com/en-om/HT211240#document".freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(catalog_path, formulas_dir: nil, font_name: nil, force: false, verbose: false, import_cache: nil, schema_version: 4) ⇒ MacosImporter
constructor
A new instance of MacosImporter.
Constructor Details
#initialize(catalog_path, formulas_dir: nil, font_name: nil, force: false, verbose: false, import_cache: nil, schema_version: 4) ⇒ MacosImporter
Returns a new instance of MacosImporter.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fontist/import/macos_importer.rb', line 10 def initialize(catalog_path, formulas_dir: nil, font_name: nil, force: false, verbose: false, import_cache: nil, schema_version: 4) @catalog_path = catalog_path @custom_formulas_dir = formulas_dir @font_name_filter = font_name @force = force @verbose = verbose @import_cache = import_cache @schema_version = schema_version @success_count = 0 @failure_count = 0 @skipped_count = 0 @overwritten_count = 0 @total_bytes = 0 @failures = [] # Track {name, reason} for each failure @parser = Fontist::Macos::Catalog::CatalogManager.parser_for(@catalog_path) end |
Instance Method Details
#call ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fontist/import/macos_importer.rb', line 28 def call print_header assets = filter_assets(@parser.assets) # Exit early if no fonts match filter if assets.empty? Fontist.ui.say("") Fontist.ui.say(Paint["No fonts to import. Exiting.", :yellow]) return end if @font_name_filter Fontist.ui.say("🔍 Filter: #{Paint[@font_name_filter, :cyan, :bright]}") end Fontist.ui.say("📦 Found #{Paint[assets.size, :yellow, :bright]} font packages in catalog") Fontist.ui.say("📁 Saving formulas to: #{Paint[formula_dir(@parser.framework_version), :cyan]}") Fontist.ui.say("🔄 Mode: #{if @force Paint['Force (overwrite existing)', :red, :bright] else Paint['Normal (skip existing)', :green] end}") Fontist.ui.say("") assets.each_with_index do |asset, index| process_asset(asset, index + 1, assets.size) end print_summary(assets.size) end |