fontist 2.1.4 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop_todo.yml +411 -10
  4. data/Gemfile +1 -0
  5. data/docs/.vitepress/config.ts +17 -0
  6. data/docs/cli/create-formula.md +6 -0
  7. data/docs/cli/import.md +4 -0
  8. data/docs/guide/formulas.md +73 -0
  9. data/docs/guide/installation.md +62 -0
  10. data/docs/guide/maintainer/import.md +372 -0
  11. data/docs/guide/maintainer/index.md +37 -0
  12. data/docs/guide/platforms/index.md +72 -0
  13. data/docs/guide/platforms/macos.md +151 -0
  14. data/docs/guide/platforms/windows.md +220 -0
  15. data/fontist.gemspec +0 -1
  16. data/lib/fontist/cache/manager.rb +0 -2
  17. data/lib/fontist/cache.rb +6 -0
  18. data/lib/fontist/cli/thor_ext.rb +0 -2
  19. data/lib/fontist/cli.rb +0 -9
  20. data/lib/fontist/collection_file.rb +0 -3
  21. data/lib/fontist/font.rb +0 -6
  22. data/lib/fontist/font_collection.rb +0 -1
  23. data/lib/fontist/font_file.rb +0 -1
  24. data/lib/fontist/font_installer.rb +0 -5
  25. data/lib/fontist/font_model.rb +0 -1
  26. data/lib/fontist/font_path.rb +0 -2
  27. data/lib/fontist/formula.rb +0 -13
  28. data/lib/fontist/formula_picker.rb +0 -2
  29. data/lib/fontist/google_import_source.rb +0 -2
  30. data/lib/fontist/import/convert_formulas.rb +0 -2
  31. data/lib/fontist/import/create_formula.rb +0 -4
  32. data/lib/fontist/import/files/collection_file.rb +0 -1
  33. data/lib/fontist/import/files.rb +8 -0
  34. data/lib/fontist/import/font_metadata_extractor.rb +0 -1
  35. data/lib/fontist/import/formula_builder.rb +0 -6
  36. data/lib/fontist/import/google/api.rb +0 -9
  37. data/lib/fontist/import/google/data_sources/base.rb +0 -1
  38. data/lib/fontist/import/google/data_sources/github.rb +0 -3
  39. data/lib/fontist/import/google/data_sources/ttf.rb +0 -2
  40. data/lib/fontist/import/google/data_sources/vf.rb +0 -2
  41. data/lib/fontist/import/google/data_sources/woff2.rb +0 -2
  42. data/lib/fontist/import/google/data_sources.rb +13 -0
  43. data/lib/fontist/import/google/font_database.rb +0 -10
  44. data/lib/fontist/import/google/metadata_adapter.rb +0 -1
  45. data/lib/fontist/import/google/models/font_family.rb +0 -1
  46. data/lib/fontist/import/google/models/metadata.rb +1 -9
  47. data/lib/fontist/import/google/models/source_metadata.rb +0 -1
  48. data/lib/fontist/import/google/models.rb +16 -0
  49. data/lib/fontist/import/google.rb +7 -2
  50. data/lib/fontist/import/google_fonts_importer.rb +0 -5
  51. data/lib/fontist/import/google_import.rb +1 -8
  52. data/lib/fontist/import/helpers.rb +8 -0
  53. data/lib/fontist/import/macos.rb +0 -6
  54. data/lib/fontist/import/manual_formula_builder.rb +0 -2
  55. data/lib/fontist/import/models.rb +7 -0
  56. data/lib/fontist/import/otf/font_file.rb +0 -2
  57. data/lib/fontist/import/otf.rb +7 -0
  58. data/lib/fontist/import/recursive_extraction.rb +0 -5
  59. data/lib/fontist/import/sil_import.rb +0 -3
  60. data/lib/fontist/import/upgrade_formulas.rb +1 -11
  61. data/lib/fontist/import.rb +23 -0
  62. data/lib/fontist/import_cli.rb +0 -9
  63. data/lib/fontist/index.rb +0 -4
  64. data/lib/fontist/index_cli.rb +0 -2
  65. data/lib/fontist/indexes/base_font_collection_index.rb +0 -1
  66. data/lib/fontist/indexes/default_family_font_index.rb +0 -2
  67. data/lib/fontist/indexes/directory_snapshot.rb +0 -2
  68. data/lib/fontist/indexes/filename_index.rb +0 -2
  69. data/lib/fontist/indexes/font_index.rb +0 -3
  70. data/lib/fontist/indexes/fontist_index.rb +0 -2
  71. data/lib/fontist/indexes/incremental_index_updater.rb +0 -4
  72. data/lib/fontist/indexes/preferred_family_font_index.rb +0 -2
  73. data/lib/fontist/indexes/system_index.rb +0 -2
  74. data/lib/fontist/indexes/user_index.rb +0 -2
  75. data/lib/fontist/indexes.rb +18 -0
  76. data/lib/fontist/install_location.rb +0 -4
  77. data/lib/fontist/install_locations/fontist_location.rb +0 -2
  78. data/lib/fontist/install_locations/system_location.rb +0 -2
  79. data/lib/fontist/install_locations/user_location.rb +0 -2
  80. data/lib/fontist/install_locations.rb +8 -0
  81. data/lib/fontist/macos/catalog/asset.rb +0 -2
  82. data/lib/fontist/macos/catalog/base_parser.rb +0 -1
  83. data/lib/fontist/macos/catalog/catalog_manager.rb +0 -6
  84. data/lib/fontist/macos/catalog/font3_parser.rb +0 -2
  85. data/lib/fontist/macos/catalog/font4_parser.rb +0 -2
  86. data/lib/fontist/macos/catalog/font5_parser.rb +0 -2
  87. data/lib/fontist/macos/catalog/font6_parser.rb +0 -2
  88. data/lib/fontist/macos/catalog/font7_parser.rb +0 -2
  89. data/lib/fontist/macos/catalog/font8_parser.rb +0 -2
  90. data/lib/fontist/macos/catalog.rb +15 -0
  91. data/lib/fontist/macos.rb +5 -0
  92. data/lib/fontist/macos_import_source.rb +0 -2
  93. data/lib/fontist/manifest_request.rb +0 -1
  94. data/lib/fontist/manifest_response.rb +0 -1
  95. data/lib/fontist/resources.rb +7 -0
  96. data/lib/fontist/sil_import_source.rb +0 -2
  97. data/lib/fontist/system_font.rb +0 -2
  98. data/lib/fontist/system_index.rb +0 -4
  99. data/lib/fontist/utils/cache.rb +0 -2
  100. data/lib/fontist/utils/downloader.rb +0 -4
  101. data/lib/fontist/utils.rb +10 -8
  102. data/lib/fontist/validate_cli.rb +0 -4
  103. data/lib/fontist/validator.rb +0 -2
  104. data/lib/fontist/version.rb +1 -1
  105. data/lib/fontist.rb +83 -36
  106. metadata +19 -16
@@ -0,0 +1,220 @@
1
+ ---
2
+ title: Windows Platform Guide
3
+ ---
4
+
5
+ # Windows Platform Guide
6
+
7
+ Fontist provides comprehensive Windows platform support, allowing installation and management of fonts on Windows 7 and later.
8
+
9
+ ## Windows Font Management
10
+
11
+ Windows font management differs from Unix systems in several key ways:
12
+
13
+ | Difference | Description |
14
+ |------------|-------------|
15
+ | Path separator | Uses backslash (`\`) instead of forward slash (`/`) |
16
+ | Font locations | Registry-based and directory-based locations |
17
+ | File locking | Stricter file locking during operations |
18
+ | Permissions | Case-insensitive but case-preserving filesystem |
19
+
20
+ ---
21
+
22
+ ## Windows Font Locations
23
+
24
+ Fontist supports three installation locations on Windows:
25
+
26
+ ### System Fonts
27
+
28
+ | Property | Value |
29
+ |----------|-------|
30
+ | Location | `C:\Windows\Fonts` |
31
+ | Requires Admin | Yes |
32
+ | Available To | All users |
33
+
34
+ ### User Fonts
35
+
36
+ | Property | Value |
37
+ |----------|-------|
38
+ | Location | `%LOCALAPPDATA%\Microsoft\Windows\Fonts` |
39
+ | Requires Admin | No |
40
+ | Available To | Current user only |
41
+ | Windows Version | Windows 10+ |
42
+
43
+ ### Fontist Library
44
+
45
+ | Property | Value |
46
+ |----------|-------|
47
+ | Location | `%USERPROFILE%\.fontist\fonts` |
48
+ | Requires Admin | No |
49
+ | Available To | Current user only |
50
+ | Default | Yes |
51
+
52
+ Fontist creates a `fontist` subdirectory within user and system font directories to avoid cluttering the main font directory.
53
+
54
+ ---
55
+
56
+ ## Installation Examples
57
+
58
+ ### Install to Fontist Library (Default)
59
+
60
+ ```powershell
61
+ # No administrator privileges required
62
+ fontist install "Roboto"
63
+ ```
64
+
65
+ ### Install to User Fonts Directory
66
+
67
+ ```powershell
68
+ # No administrator privileges required (Windows 10+)
69
+ fontist install "Roboto" --location=user
70
+ ```
71
+
72
+ ### Install to System Fonts Directory
73
+
74
+ ```powershell
75
+ # Run as Administrator
76
+ fontist install "Roboto" --location=system
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Windows-Specific Considerations
82
+
83
+ ### File Locking
84
+
85
+ Windows uses stricter file locking than Unix systems. Fontist handles this with automatic retry logic when encountering locked files during cleanup operations.
86
+
87
+ If you encounter file locking issues:
88
+ 1. Close applications that might be using the font
89
+ 2. Retry the operation
90
+ 3. Use Task Manager to identify processes locking the file
91
+
92
+ ### Path Handling
93
+
94
+ Fontist automatically handles Windows path separators and drive letters. Font paths are returned in Windows-native format:
95
+
96
+ ```
97
+ C:\Users\user\.fontist\fonts\font.ttf
98
+ ```
99
+
100
+ ### Registry Integration
101
+
102
+ While Windows historically used registry-based font registration, modern Windows (10+) supports directory-based fonts. Fontist uses directory-based installation for maximum compatibility and ease of management.
103
+
104
+ ### Administrator Privileges
105
+
106
+ | Operation | Admin Required |
107
+ |-----------|----------------|
108
+ | Install to `fontist` location | No |
109
+ | Install to `user` location | No |
110
+ | Install to `system` location | Yes |
111
+ | Uninstall from system fonts | Yes |
112
+
113
+ ---
114
+
115
+ ## Platform Compatibility
116
+
117
+ | Windows Version | Support Status | Notes |
118
+ |-----------------|----------------|-------|
119
+ | Windows 11 | ✅ Fully Supported | All features available |
120
+ | Windows 10 | ✅ Fully Supported | User font directory available |
121
+ | Windows 8/8.1 | ✅ Supported | System and fontist locations only |
122
+ | Windows 7 | ⚠️ Limited Support | System and fontist locations only |
123
+
124
+ ::: warning Windows 7 Support
125
+ Extended support for Windows 7 ended January 14, 2020. Fontist is tested on Windows 10 and later. Earlier versions may work but are not actively tested.
126
+ :::
127
+
128
+ ---
129
+
130
+ ## Ruby Installation on Windows
131
+
132
+ ### Prerequisites
133
+
134
+ 1. **RubyInstaller with DevKit** - Required for native gem extensions
135
+ 2. **MSYS2** - Required for building native extensions
136
+ 3. **Git for Windows** - Required for `fontist update` and `fontist repo` commands
137
+
138
+ ### Installation Steps
139
+
140
+ 1. Download [RubyInstaller](https://rubyinstaller.org/downloads/) (select "Ruby+Devkit" version)
141
+
142
+ 2. Run the installer and check "Add Ruby executables to your PATH"
143
+
144
+ 3. After installation, run MSYS2 setup:
145
+ ```powershell
146
+ ridk install
147
+ ```
148
+ Select option 3 (MSYS2 and MINGW development toolchain) when prompted.
149
+
150
+ 4. Install [Git for Windows](https://git-scm.com/download/win)
151
+
152
+ 5. Install Fontist:
153
+ ```powershell
154
+ gem install fontist
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Troubleshooting
160
+
161
+ ### Native Extension Errors
162
+
163
+ If you see errors about failed compilations:
164
+
165
+ ```powershell
166
+ # Ensure MSYS2 is properly installed
167
+ ridk install
168
+
169
+ # Reinstall the gem with verbose output
170
+ gem install fontist --verbose
171
+ ```
172
+
173
+ ### Permission Errors
174
+
175
+ If you get permission errors:
176
+
177
+ ```powershell
178
+ # Option 1: Install to user directory
179
+ fontist install "Roboto" --location=user
180
+
181
+ # Option 2: Run as Administrator for system fonts
182
+ # Right-click PowerShell → "Run as administrator"
183
+ fontist install "Roboto" --location=system
184
+ ```
185
+
186
+ ### Path Too Long Errors
187
+
188
+ Windows has a 260 character path limit by default. If you encounter path issues:
189
+
190
+ 1. Enable long paths in Windows (requires admin):
191
+ ```powershell
192
+ # Run as Administrator
193
+ New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
194
+ -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
195
+ ```
196
+
197
+ 2. Or use a shorter installation path via environment variable:
198
+ ```powershell
199
+ $env:FONTIST_PATH = "C:\f"
200
+ fontist install "Roboto"
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Environment Variables
206
+
207
+ | Variable | Description | Example |
208
+ |----------|-------------|---------|
209
+ | `FONTIST_PATH` | Base directory for Fontist data | `C:\fontist` |
210
+ | `FONTIST_INSTALL_LOCATION` | Default install location | `user` |
211
+ | `FONTIST_USER_FONTS_PATH` | Custom user fonts path | `C:\Users\me\Fonts` |
212
+ | `FONTIST_SYSTEM_FONTS_PATH` | Custom system fonts path | `C:\Windows\Fonts` |
213
+
214
+ ---
215
+
216
+ ## See Also
217
+
218
+ - [Installation Guide](/guide/installation) - General installation instructions
219
+ - [Install Command](/cli/install) - CLI reference for install
220
+ - [How Fontist Works](/guide/how-it-works) - Architecture overview
data/fontist.gemspec CHANGED
@@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency "git", "> 1.0"
37
37
  spec.add_dependency "json", "~> 2.0"
38
38
  spec.add_dependency "lutaml-model", "~> 0.7"
39
- spec.add_dependency "lutaml-xsd", "~> 1.0"
40
39
  spec.add_dependency "marcel", "~> 1.0"
41
40
  spec.add_dependency "nokogiri", "~> 1.0"
42
41
  spec.add_dependency "octokit", "~> 4.0"
@@ -1,5 +1,3 @@
1
- require_relative "store"
2
-
3
1
  module Fontist
4
2
  module Cache
5
3
  # Central cache manager for font index caching operations
@@ -0,0 +1,6 @@
1
+ module Fontist
2
+ module Cache
3
+ autoload :Store, "#{__dir__}/cache/store"
4
+ autoload :Manager, "#{__dir__}/cache/manager"
5
+ end
6
+ end
@@ -1,5 +1,3 @@
1
- require "fontist/utils/ui"
2
-
3
1
  module Fontist
4
2
  module ThorExt
5
3
  # Sources:
data/lib/fontist/cli.rb CHANGED
@@ -1,13 +1,6 @@
1
1
  require "thor"
2
2
  require_relative "cli/class_options"
3
3
  require_relative "cli/thor_ext"
4
- require_relative "repo_cli"
5
- require_relative "cache_cli"
6
- require_relative "import_cli"
7
- require_relative "fontconfig_cli"
8
- require_relative "config_cli"
9
- require_relative "index_cli"
10
- require_relative "manifest_cli"
11
4
 
12
5
  module Fontist
13
6
  class CLI < Thor
@@ -248,7 +241,6 @@ module Fontist
248
241
  "e.g. 'Wine ' for compatibility fonts"
249
242
  def create_formula(url)
250
243
  handle_class_options(options)
251
- require "fontist/import/create_formula"
252
244
  name = Fontist::Import::CreateFormula.new(url, options).call
253
245
  Fontist.ui.say("#{name} formula has been successfully created")
254
246
  success
@@ -271,7 +263,6 @@ module Fontist
271
263
  desc "macos-catalogs", "List available macOS font catalogs"
272
264
  def macos_catalogs
273
265
  handle_class_options(options)
274
- require_relative "macos/catalog/catalog_manager"
275
266
 
276
267
  catalogs = Fontist::Macos::Catalog::CatalogManager.available_catalogs
277
268
 
@@ -1,5 +1,4 @@
1
1
  require "fontisan"
2
- require_relative "errors"
3
2
 
4
3
  module Fontist
5
4
  class CollectionFile
@@ -18,8 +17,6 @@ module Fontist
18
17
  def build_collection(path)
19
18
  # Validate collection by checking it can be loaded
20
19
  # This uses fontisan's collection validation infrastructure
21
- require "fontisan"
22
-
23
20
  # First check if it's a valid collection file
24
21
  unless Fontisan::FontLoader.collection?(path)
25
22
  raise Errors::FontFileError,
data/lib/fontist/font.rb CHANGED
@@ -1,9 +1,3 @@
1
- require "fontist/font_installer"
2
- require "fontist/font_path"
3
- require "fontist/formula_picker"
4
- require "fontist/fontconfig"
5
- require "fontist/formula_suggestion"
6
-
7
1
  module Fontist
8
2
  class Font
9
3
  def initialize(options = {})
@@ -1,5 +1,4 @@
1
1
  require "lutaml/model"
2
- require_relative "font_model"
3
2
 
4
3
  module Fontist
5
4
  class FontCollection < Lutaml::Model::Serializable
@@ -1,6 +1,5 @@
1
1
  require "fontisan"
2
2
  require "tempfile"
3
- require_relative "errors"
4
3
 
5
4
  module Fontist
6
5
  class FontFile
@@ -1,9 +1,4 @@
1
- require "fontist/utils"
2
1
  require "excavate"
3
- require_relative "resources/archive_resource"
4
- require_relative "resources/google_resource"
5
- require_relative "resources/apple_cdn_resource"
6
- require_relative "install_location"
7
2
 
8
3
  module Fontist
9
4
  class FontInstaller
@@ -1,5 +1,4 @@
1
1
  require "lutaml/model"
2
- require_relative "font_style"
3
2
 
4
3
  module Fontist
5
4
  class FontModel < Lutaml::Model::Serializable
@@ -1,5 +1,3 @@
1
- require "fontist/indexes/filename_index"
2
-
3
1
  module Fontist
4
2
  class FontPath
5
3
  def initialize(path)
@@ -1,19 +1,7 @@
1
1
  require "lutaml/model"
2
- require_relative "font_model"
3
- require_relative "font_collection"
4
- require_relative "extract"
5
- require_relative "index"
6
- require_relative "helpers"
7
- require_relative "update"
8
- require_relative "import_source"
9
- require_relative "macos_import_source"
10
- require_relative "google_import_source"
11
- require_relative "sil_import_source"
12
2
  require "git"
13
3
 
14
4
  module Fontist
15
- require "lutaml/model"
16
-
17
5
  class Resource < Lutaml::Model::Serializable
18
6
  attribute :name, :string
19
7
  attribute :source, :string
@@ -280,7 +268,6 @@ module Fontist
280
268
  # Check if framework exists for this macOS version
281
269
  framework = Utils::System.catalog_version_for_macos
282
270
  if framework.nil?
283
- require_relative "macos_framework_metadata"
284
271
  raise Errors::UnsupportedMacOSVersionError.new(
285
272
  current_macos,
286
273
  MacosFrameworkMetadata.metadata,
@@ -1,5 +1,3 @@
1
- require "fontist/style_version"
2
-
3
1
  module Fontist
4
2
  class FormulaPicker
5
3
  def initialize(font_name, size_limit:, version:, smallest:, newest:)
@@ -1,5 +1,3 @@
1
- require_relative "import_source"
2
-
3
1
  module Fontist
4
2
  # Import source for Google Fonts
5
3
  #
@@ -1,5 +1,3 @@
1
- require_relative "formula_serializer"
2
-
3
1
  module Fontist
4
2
  module Import
5
3
  class ConvertFormulas
@@ -1,7 +1,3 @@
1
- require "fontist/import"
2
- require_relative "recursive_extraction"
3
- require_relative "formula_builder"
4
-
5
1
  module Fontist
6
2
  module Import
7
3
  class CreateFormula
@@ -1,5 +1,4 @@
1
1
  require "fontisan"
2
- require_relative "../otf/font_file"
3
2
 
4
3
  module Fontist
5
4
  module Import
@@ -0,0 +1,8 @@
1
+ module Fontist
2
+ module Import
3
+ module Files
4
+ autoload :CollectionFile, "#{__dir__}/files/collection_file"
5
+ autoload :FontDetector, "#{__dir__}/files/font_detector"
6
+ end
7
+ end
8
+ end
@@ -1,5 +1,4 @@
1
1
  require "fontisan"
2
- require_relative "models/font_metadata"
3
2
 
4
3
  module Fontist
5
4
  module Import
@@ -1,10 +1,4 @@
1
1
  require "shellwords"
2
- require_relative "text_helper"
3
- require_relative "helpers/hash_helper"
4
- require_relative "recursive_extraction"
5
- require_relative "../macos_import_source"
6
- require_relative "../google_import_source"
7
- require_relative "../sil_import_source"
8
2
 
9
3
  module Fontist
10
4
  module Import
@@ -1,12 +1,3 @@
1
- require_relative "models/axis"
2
- require_relative "models/font_variant"
3
- require_relative "models/font_family"
4
- require_relative "data_sources/base"
5
- require_relative "data_sources/ttf"
6
- require_relative "data_sources/vf"
7
- require_relative "data_sources/woff2"
8
- require_relative "font_database"
9
-
10
1
  module Fontist
11
2
  module Import
12
3
  module Google
@@ -1,7 +1,6 @@
1
1
  require "net/http"
2
2
  require "json"
3
3
  require "uri"
4
- require_relative "../models/font_family"
5
4
 
6
5
  module Fontist
7
6
  module Import
@@ -1,7 +1,4 @@
1
1
  require "unibuf"
2
- require_relative "../metadata_adapter"
3
- require_relative "../../otf/font_file"
4
- require_relative "../models/font_family"
5
2
  require "pathname"
6
3
 
7
4
  module Fontist
@@ -1,5 +1,3 @@
1
- require_relative "base"
2
-
3
1
  module Fontist
4
2
  module Import
5
3
  module Google
@@ -1,5 +1,3 @@
1
- require_relative "base"
2
-
3
1
  module Fontist
4
2
  module Import
5
3
  module Google
@@ -1,5 +1,3 @@
1
- require_relative "base"
2
-
3
1
  module Fontist
4
2
  module Import
5
3
  module Google
@@ -0,0 +1,13 @@
1
+ module Fontist
2
+ module Import
3
+ module Google
4
+ module DataSources
5
+ autoload :Base, "#{__dir__}/data_sources/base"
6
+ autoload :Github, "#{__dir__}/data_sources/github"
7
+ autoload :Ttf, "#{__dir__}/data_sources/ttf"
8
+ autoload :Vf, "#{__dir__}/data_sources/vf"
9
+ autoload :Woff2, "#{__dir__}/data_sources/woff2"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,12 +1,3 @@
1
- require_relative "models/font_family"
2
- require_relative "models/axis"
3
- require_relative "data_sources/ttf"
4
- require_relative "data_sources/vf"
5
- require_relative "data_sources/woff2"
6
- require_relative "data_sources/github"
7
- require_relative "../font_metadata_extractor"
8
- require_relative "../../utils/downloader"
9
- require_relative "../../google_import_source"
10
1
  require "yaml"
11
2
  require "fileutils"
12
3
 
@@ -404,7 +395,6 @@ github_data: nil, version: 4, source_path: nil)
404
395
  path = File.join(output_dir, filename)
405
396
 
406
397
  # Use HashHelper to convert keys to strings (preserves import_source object)
407
- require_relative "../helpers/hash_helper"
408
398
  formula_with_string_keys = Helpers::HashHelper.stringify_keys(formula_hash)
409
399
 
410
400
  File.write(path, YAML.dump(formula_with_string_keys))
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "unibuf"
4
- require_relative "models/metadata"
5
4
 
6
5
  module Fontist
7
6
  module Import
@@ -1,5 +1,4 @@
1
1
  require "lutaml/model"
2
- require_relative "axis"
3
2
 
4
3
  module Fontist
5
4
  module Import
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "lutaml/model"
4
- require_relative "font_file_metadata"
5
- require_relative "axis_metadata"
6
- require_relative "source_metadata"
4
+ require "unibuf"
7
5
 
8
6
  module Fontist
9
7
  module Import
@@ -74,9 +72,6 @@ module Fontist
74
72
  # @return [Metadata] parsed metadata object
75
73
  # @raise [ParseError] if file cannot be parsed
76
74
  def self.from_file(file_path)
77
- require "unibuf"
78
- require_relative "../metadata_adapter"
79
-
80
75
  unibuf_message = Unibuf.parse_textproto_file(file_path)
81
76
  MetadataAdapter.adapt(unibuf_message)
82
77
  end
@@ -87,9 +82,6 @@ module Fontist
87
82
  # @return [Metadata] parsed metadata object
88
83
  # @raise [ParseError] if content cannot be parsed
89
84
  def self.from_content(content)
90
- require "unibuf"
91
- require_relative "../metadata_adapter"
92
-
93
85
  unibuf_message = Unibuf.parse_textproto(content)
94
86
  MetadataAdapter.adapt(unibuf_message)
95
87
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "lutaml/model"
4
- require_relative "file_metadata"
5
4
 
6
5
  module Fontist
7
6
  module Import
@@ -0,0 +1,16 @@
1
+ module Fontist
2
+ module Import
3
+ module Google
4
+ module Models
5
+ autoload :Axis, "#{__dir__}/models/axis"
6
+ autoload :AxisMetadata, "#{__dir__}/models/axis_metadata"
7
+ autoload :FileMetadata, "#{__dir__}/models/file_metadata"
8
+ autoload :FontFamily, "#{__dir__}/models/font_family"
9
+ autoload :FontFileMetadata, "#{__dir__}/models/font_file_metadata"
10
+ autoload :FontVariant, "#{__dir__}/models/font_variant"
11
+ autoload :Metadata, "#{__dir__}/models/metadata"
12
+ autoload :SourceMetadata, "#{__dir__}/models/source_metadata"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,6 +1,13 @@
1
1
  module Fontist
2
2
  module Import
3
3
  module Google
4
+ autoload :Api, "#{__dir__}/google/api"
5
+ autoload :DataSources, "#{__dir__}/google/data_sources"
6
+ autoload :FontDatabase, "#{__dir__}/google/font_database"
7
+ autoload :MetadataAdapter, "#{__dir__}/google/metadata_adapter"
8
+ autoload :MetadataParser, "#{__dir__}/google/metadata_parser"
9
+ autoload :Models, "#{__dir__}/google/models"
10
+
4
11
  DEFAULT_MAX_COUNT = 100
5
12
 
6
13
  def self.metadata_name(path)
@@ -35,5 +42,3 @@ module Fontist
35
42
  end
36
43
  end
37
44
  end
38
-
39
- require_relative "google/api"
@@ -1,11 +1,6 @@
1
1
  require "fileutils"
2
2
  require "yaml"
3
3
  require "paint"
4
- require_relative "../import"
5
- require_relative "../formula"
6
- require_relative "google/font_database"
7
- require_relative "google/api"
8
- require_relative "import_display"
9
4
 
10
5
  module Fontist
11
6
  module Import
@@ -5,10 +5,6 @@
5
5
  # @deprecated Use {Fontist::Import::GoogleImporter} instead
6
6
  # @see Fontist::Import::GoogleImporter
7
7
 
8
- require_relative "google"
9
- require_relative "google/api"
10
- require_relative "google/create_google_formula"
11
-
12
8
  module Fontist
13
9
  module Import
14
10
  # Legacy Google Fonts import class
@@ -57,10 +53,7 @@ module Fontist
57
53
  # @return [Boolean] true if new importer is available and should be used
58
54
  def use_new_importer?
59
55
  # Check if new importer is available
60
- require_relative "google_importer"
61
- true
62
- rescue LoadError
63
- false
56
+ defined?(Fontist::Import::GoogleImporter)
64
57
  end
65
58
 
66
59
  # Delegates to new GoogleImporter
@@ -0,0 +1,8 @@
1
+ module Fontist
2
+ module Import
3
+ module Helpers
4
+ autoload :HashHelper, "#{__dir__}/helpers/hash_helper"
5
+ autoload :SystemHelper, "#{__dir__}/helpers/system_helper"
6
+ end
7
+ end
8
+ end