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
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 |
# File 'lib/fontist/system_index.rb', line 776 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)
805 806 807 808 |
# File 'lib/fontist/system_index.rb', line 805 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)
796 797 798 799 800 801 |
# File 'lib/fontist/system_index.rb', line 796 def self.reset_cache @system_index = nil @system_index_path = nil @fontist_index = nil @fontist_index_path = nil end |
.system_index ⇒ Object
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 |
# File 'lib/fontist/system_index.rb', line 757 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 |