Class: Fontist::SystemIndex
- Inherits:
-
Object
- Object
- Fontist::SystemIndex
- Includes:
- Utils::Locking
- Defined in:
- lib/fontist/system_index.rb
Class Method Summary collapse
- .fontist_index ⇒ Object
-
.rebuild(verbose: false) ⇒ Object
Rebuild the system font index Called after installing fonts to system directories (e.g., apple_cdn).
-
.reset_cache ⇒ Object
Reset cached indexes (useful for testing).
- .system_index ⇒ Object
Methods included from Utils::Locking
Class Method Details
.fontist_index ⇒ Object
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File 'lib/fontist/system_index.rb', line 742 def self.fontist_index current_path = Fontist.fontist_index_path return @fontist_index if !@fontist_index.nil? && @fontist_index_path == current_path @fontist_index_path = current_path @fontist_index = SystemIndexFontCollection.from_file( path: current_path, paths_loader: -> { SystemFont.fontist_font_paths }, ) # Validate the index before marking as verified if File.exist?(current_path) @fontist_index.check_index @fontist_index.mark_verified! end @fontist_index end |
.rebuild(verbose: false) ⇒ Object
Rebuild the system font index Called after installing fonts to system directories (e.g., apple_cdn)
771 772 773 774 |
# File 'lib/fontist/system_index.rb', line 771 def self.rebuild(verbose: false) system_index.rebuild(verbose: verbose) Fontist.ui.success("System font index rebuilt successfully.") if verbose end |
.reset_cache ⇒ Object
Reset cached indexes (useful for testing)
762 763 764 765 766 767 |
# File 'lib/fontist/system_index.rb', line 762 def self.reset_cache @system_index = nil @system_index_path = nil @fontist_index = nil @fontist_index_path = nil end |
.system_index ⇒ Object
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
# File 'lib/fontist/system_index.rb', line 723 def self.system_index current_path = Fontist.system_index_path return @system_index if !@system_index.nil? && @system_index_path == current_path @system_index_path = current_path @system_index = SystemIndexFontCollection.from_file( path: current_path, paths_loader: -> { SystemFont.font_paths }, ) # Validate the index before marking as verified if File.exist?(current_path) @system_index.check_index @system_index.mark_verified! end @system_index end |