Class: Fontist::Import::Macos
- Inherits:
-
Object
- Object
- Fontist::Import::Macos
- Defined in:
- lib/fontist/import/macos.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) ⇒ Macos
constructor
A new instance of Macos.
Constructor Details
#initialize(catalog_path, formulas_dir: nil, font_name: nil, force: false, verbose: false, import_cache: nil) ⇒ Macos
Returns a new instance of Macos.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fontist/import/macos.rb', line 16 def initialize(catalog_path, formulas_dir: nil, font_name: nil, force: false, verbose: false, import_cache: nil) @catalog_path = catalog_path @custom_formulas_dir = formulas_dir @font_name_filter = font_name @force = force @verbose = verbose @import_cache = import_cache @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
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 63 64 65 66 67 |
# File 'lib/fontist/import/macos.rb', line 33 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 |