fontist 3.0.41 → 3.0.43
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.
- checksums.yaml +4 -4
- data/.github/workflows/discover-fonts.yml +2 -1
- data/.github/workflows/perf-gate.yml +275 -0
- data/README.adoc +0 -3
- data/lib/fontist/utils/curl_downloader.rb +80 -0
- data/lib/fontist/utils/downloader.rb +19 -6
- data/lib/fontist/utils.rb +1 -0
- data/lib/fontist/version.rb +1 -1
- data/lib/fontist.rb +1 -1
- metadata +4 -7
- data/TODO.audit-docs.md +0 -164
- data/TODO.fontist-v5.md +0 -196
- data/TODO.improve-docs.md +0 -114
- data/TODO.upgrade-excavate.md +0 -107
- data/google-fonts-multi-format-usage.md +0 -419
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65303ef28ac7968cf6e993382cd56ed455f40b181c8b945fef3b43d54b622c14
|
|
4
|
+
data.tar.gz: 1a721dbd1f32c8b0ec4c23eecf191605d4ef793041fe677f2a90e3d0c1ca19ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ca4056f32db8e78d403352bd3695ed86447b70a050d3291e1a6637cb90f7ca21a211968e6bf960cafec861c102167966e61885e64e6c15442b5dd569abdd5a1
|
|
7
|
+
data.tar.gz: 44858ffc6ddb5629b3b86cf47704cfe8f620928d9549f6c1f72077c9d79c1d505d8668b4cb215d826a57157c6a1397a5b2328c78f6c3a1851fd41ffd10d02c74
|
|
@@ -19,7 +19,8 @@ jobs:
|
|
|
19
19
|
runs-on: macos-${{ matrix.version }}
|
|
20
20
|
strategy:
|
|
21
21
|
matrix:
|
|
22
|
-
|
|
22
|
+
# macos-14 is not offered to this repo; restore it if a runner becomes available.
|
|
23
|
+
version: [15, 26]
|
|
23
24
|
fail-fast: false
|
|
24
25
|
steps:
|
|
25
26
|
- name: List ALL Core System Fonts
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
name: Scan path performance gate
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
report-engine-availability:
|
|
13
|
+
name: Report published engine availability
|
|
14
|
+
if: github.event_name == 'pull_request'
|
|
15
|
+
runs-on: ubuntu-24.04
|
|
16
|
+
concurrency:
|
|
17
|
+
group: scan-path-publication-${{ github.event.pull_request.number }}
|
|
18
|
+
cancel-in-progress: false
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
pull-requests: write
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- uses: ruby/setup-ruby@v1
|
|
26
|
+
with:
|
|
27
|
+
ruby-version: "3.3"
|
|
28
|
+
|
|
29
|
+
- name: Resolve bundle without installing gems
|
|
30
|
+
run: bundle lock
|
|
31
|
+
|
|
32
|
+
- name: Report published engines on the PR
|
|
33
|
+
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
34
|
+
env:
|
|
35
|
+
GH_TOKEN: ${{ github.token }}
|
|
36
|
+
FONTIST_PERF_COMMENT_AUTHOR: github-actions[bot]
|
|
37
|
+
FONTIST_PERF_HEAD: ${{ github.event.pull_request.head.sha }}
|
|
38
|
+
PERF_REPOSITORY: ${{ github.repository }}
|
|
39
|
+
PERF_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
40
|
+
run: ruby spec/support/performance.rb --report "$PERF_REPOSITORY" "$PERF_PR_NUMBER" --publish
|
|
41
|
+
|
|
42
|
+
- name: Report published engines in the log
|
|
43
|
+
if: github.event.pull_request.head.repo.full_name != github.repository
|
|
44
|
+
env:
|
|
45
|
+
GH_TOKEN: ${{ github.token }}
|
|
46
|
+
FONTIST_PERF_HEAD: ${{ github.event.pull_request.head.sha }}
|
|
47
|
+
PERF_REPOSITORY: ${{ github.repository }}
|
|
48
|
+
PERF_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
49
|
+
run: ruby spec/support/performance.rb --report "$PERF_REPOSITORY" "$PERF_PR_NUMBER"
|
|
50
|
+
|
|
51
|
+
scan-path-base:
|
|
52
|
+
name: Ruby scan path PR vs base
|
|
53
|
+
runs-on: ubuntu-24.04
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v4
|
|
56
|
+
|
|
57
|
+
- name: Check out pull request base
|
|
58
|
+
id: base_checkout
|
|
59
|
+
if: github.event_name == 'pull_request'
|
|
60
|
+
continue-on-error: true
|
|
61
|
+
uses: actions/checkout@v4
|
|
62
|
+
with:
|
|
63
|
+
ref: ${{ github.event.pull_request.base.sha }}
|
|
64
|
+
path: .perf-base
|
|
65
|
+
|
|
66
|
+
- name: Require pull request base checkout
|
|
67
|
+
if: github.event_name == 'pull_request'
|
|
68
|
+
env:
|
|
69
|
+
BASE_CHECKOUT_OUTCOME: ${{ steps.base_checkout.outcome }}
|
|
70
|
+
run: |
|
|
71
|
+
if [ "$BASE_CHECKOUT_OUTCOME" != "success" ]; then
|
|
72
|
+
echo "ERROR: pull request base checkout failed; PR-vs-base comparison cannot run."
|
|
73
|
+
exit 2
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
- uses: ruby/setup-ruby@v1
|
|
77
|
+
with:
|
|
78
|
+
ruby-version: "3.3"
|
|
79
|
+
|
|
80
|
+
- name: Exclude Rust toolchains from the job
|
|
81
|
+
run: |
|
|
82
|
+
ruby -e '
|
|
83
|
+
paths = ENV.fetch("PATH").split(File::PATH_SEPARATOR)
|
|
84
|
+
extensions = [""] + ENV.fetch("PATHEXT", "").split(";")
|
|
85
|
+
tools = %w[cargo rustc rustup].product(extensions).map(&:join)
|
|
86
|
+
paths.reject! do |directory|
|
|
87
|
+
tools.any? { |tool| File.executable?(File.join(directory, tool)) }
|
|
88
|
+
end
|
|
89
|
+
clean_path = paths.join(File::PATH_SEPARATOR)
|
|
90
|
+
|
|
91
|
+
%w[ruby bundle].each do |tool|
|
|
92
|
+
available = paths.any? do |directory|
|
|
93
|
+
extensions.any? do |extension|
|
|
94
|
+
File.executable?(File.join(directory, "#{tool}#{extension}"))
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
next if available
|
|
98
|
+
|
|
99
|
+
warn "ERROR: removing Rust from PATH also removed #{tool}."
|
|
100
|
+
exit 2
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
File.open(ENV.fetch("GITHUB_ENV"), "a") do |output|
|
|
104
|
+
output.puts "PATH=#{clean_path}"
|
|
105
|
+
end
|
|
106
|
+
puts "Rust excluded from PATH for bundle installation and performance checks."
|
|
107
|
+
'
|
|
108
|
+
|
|
109
|
+
- name: Install bundle from RubyGems
|
|
110
|
+
run: |
|
|
111
|
+
if ! bundle install --jobs 4 --retry 3; then
|
|
112
|
+
echo "ERROR: current branch bundle install failed."
|
|
113
|
+
exit 2
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
- name: Install pull request base bundle
|
|
117
|
+
if: github.event_name == 'pull_request'
|
|
118
|
+
env:
|
|
119
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/.perf-base/Gemfile
|
|
120
|
+
run: |
|
|
121
|
+
cd .perf-base || exit 2
|
|
122
|
+
if ! bundle install --jobs 4 --retry 3; then
|
|
123
|
+
echo "ERROR: pull request base bundle install failed."
|
|
124
|
+
exit 2
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
- name: Skip PR-vs-base check on push
|
|
128
|
+
if: github.event_name != 'pull_request'
|
|
129
|
+
run: echo "PR-vs-base comparison skipped for push event."
|
|
130
|
+
|
|
131
|
+
- name: Run Ruby scan path performance gate
|
|
132
|
+
env:
|
|
133
|
+
FONTIST_PERF_INTEGRATION: "1"
|
|
134
|
+
FONTISAN_ENGINE: ruby
|
|
135
|
+
FONTISAN_ENGINE_STRICT: "1"
|
|
136
|
+
FONTIST_PERF_BASE: ${{ github.event_name == 'pull_request' && format('{0}/.perf-base', github.workspace) || '' }}
|
|
137
|
+
run: bundle exec rspec spec/performance/scan_path_perf_spec.rb
|
|
138
|
+
|
|
139
|
+
scan-path-performance:
|
|
140
|
+
name: ${{ matrix.platform }} / ${{ matrix.tier }}
|
|
141
|
+
runs-on: ${{ matrix.runner }}
|
|
142
|
+
strategy:
|
|
143
|
+
fail-fast: false
|
|
144
|
+
matrix:
|
|
145
|
+
include:
|
|
146
|
+
- platform: Linux x86_64
|
|
147
|
+
runner: ubuntu-24.04
|
|
148
|
+
target_os: linux
|
|
149
|
+
target_cpu: x86_64
|
|
150
|
+
tier: native
|
|
151
|
+
- platform: Linux x86_64
|
|
152
|
+
runner: ubuntu-24.04
|
|
153
|
+
target_os: linux
|
|
154
|
+
target_cpu: x86_64
|
|
155
|
+
tier: ffi
|
|
156
|
+
- platform: macOS arm64
|
|
157
|
+
runner: macos-latest
|
|
158
|
+
target_os: darwin
|
|
159
|
+
target_cpu: arm64
|
|
160
|
+
tier: native
|
|
161
|
+
- platform: macOS arm64
|
|
162
|
+
runner: macos-latest
|
|
163
|
+
target_os: darwin
|
|
164
|
+
target_cpu: arm64
|
|
165
|
+
tier: ffi
|
|
166
|
+
- platform: macOS x86_64
|
|
167
|
+
runner: macos-15-intel
|
|
168
|
+
target_os: darwin
|
|
169
|
+
target_cpu: x86_64
|
|
170
|
+
tier: native
|
|
171
|
+
- platform: macOS x86_64
|
|
172
|
+
runner: macos-15-intel
|
|
173
|
+
target_os: darwin
|
|
174
|
+
target_cpu: x86_64
|
|
175
|
+
tier: ffi
|
|
176
|
+
|
|
177
|
+
steps:
|
|
178
|
+
- uses: actions/checkout@v4
|
|
179
|
+
|
|
180
|
+
- uses: ruby/setup-ruby@v1
|
|
181
|
+
with:
|
|
182
|
+
ruby-version: "3.3"
|
|
183
|
+
|
|
184
|
+
- name: Exclude Rust toolchains from the job
|
|
185
|
+
run: |
|
|
186
|
+
ruby -e '
|
|
187
|
+
paths = ENV.fetch("PATH").split(File::PATH_SEPARATOR)
|
|
188
|
+
extensions = [""] + ENV.fetch("PATHEXT", "").split(";")
|
|
189
|
+
tools = %w[cargo rustc rustup].product(extensions).map(&:join)
|
|
190
|
+
paths.reject! do |directory|
|
|
191
|
+
tools.any? { |tool| File.executable?(File.join(directory, tool)) }
|
|
192
|
+
end
|
|
193
|
+
clean_path = paths.join(File::PATH_SEPARATOR)
|
|
194
|
+
|
|
195
|
+
%w[ruby bundle].each do |tool|
|
|
196
|
+
available = paths.any? do |directory|
|
|
197
|
+
extensions.any? do |extension|
|
|
198
|
+
File.executable?(File.join(directory, "#{tool}#{extension}"))
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
next if available
|
|
202
|
+
|
|
203
|
+
warn "ERROR: removing Rust from PATH also removed #{tool}."
|
|
204
|
+
exit 2
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
File.open(ENV.fetch("GITHUB_ENV"), "a") do |output|
|
|
208
|
+
output.puts "PATH=#{clean_path}"
|
|
209
|
+
end
|
|
210
|
+
puts "Rust excluded from PATH for bundle installation and performance checks."
|
|
211
|
+
'
|
|
212
|
+
|
|
213
|
+
- name: Resolve bundle without installing gems
|
|
214
|
+
run: bundle lock
|
|
215
|
+
|
|
216
|
+
- name: Verify published Fontisan binary is available
|
|
217
|
+
id: fontisan_platform
|
|
218
|
+
env:
|
|
219
|
+
TARGET_OS: ${{ matrix.target_os }}
|
|
220
|
+
TARGET_CPU: ${{ matrix.target_cpu }}
|
|
221
|
+
run: |
|
|
222
|
+
ruby -rbundler -rjson -rnet/http -ruri -rrubygems/platform -e '
|
|
223
|
+
lock = File.read("Gemfile.lock")
|
|
224
|
+
fontisan = Bundler::LockfileParser.new(lock).specs.find { |spec| spec.name == "fontisan" }
|
|
225
|
+
abort "fontisan version missing from Gemfile.lock" unless fontisan
|
|
226
|
+
version = fontisan.version.to_s
|
|
227
|
+
|
|
228
|
+
uri = URI("https://rubygems.org/api/v1/versions/fontisan.json")
|
|
229
|
+
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.get(uri.request_uri) }
|
|
230
|
+
abort "RubyGems fontisan metadata request failed: HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
231
|
+
|
|
232
|
+
versions = JSON.parse(response.body)
|
|
233
|
+
published = versions.select { |entry| entry["number"] == version }
|
|
234
|
+
platforms = published.map { |entry| entry["platform"] }.uniq.sort
|
|
235
|
+
target_os = ENV.fetch("TARGET_OS")
|
|
236
|
+
target_cpu = ENV.fetch("TARGET_CPU")
|
|
237
|
+
usable = platforms.select do |platform|
|
|
238
|
+
next false if platform == "ruby"
|
|
239
|
+
|
|
240
|
+
candidate = Gem::Platform.new(platform)
|
|
241
|
+
next false unless candidate.os == target_os && candidate.cpu == target_cpu
|
|
242
|
+
|
|
243
|
+
target_os != "linux" || candidate.version.nil? || candidate.version.start_with?("gnu")
|
|
244
|
+
end
|
|
245
|
+
unless usable.any?
|
|
246
|
+
warn "ERROR: fontisan #{version} has no published #{target_cpu}-#{target_os} binary gem on RubyGems.org (published platforms: #{platforms.empty? ? "none" : platforms.join(", ")})"
|
|
247
|
+
exit 2
|
|
248
|
+
end
|
|
249
|
+
platform = usable.first
|
|
250
|
+
puts "RubyGems.org publishes fontisan #{version} for #{platform}."
|
|
251
|
+
File.open(ENV.fetch("GITHUB_OUTPUT"), "a") { |output| output.puts("platform=#{platform}") }
|
|
252
|
+
'
|
|
253
|
+
|
|
254
|
+
- name: Install bundle from RubyGems
|
|
255
|
+
run: bundle install --jobs 4 --retry 3
|
|
256
|
+
|
|
257
|
+
- name: Verify installed Fontisan is the published platform gem
|
|
258
|
+
env:
|
|
259
|
+
FONTISAN_PLATFORM: ${{ steps.fontisan_platform.outputs.platform }}
|
|
260
|
+
run: |
|
|
261
|
+
bundle exec ruby -e '
|
|
262
|
+
spec = Gem.loaded_specs.fetch("fontisan")
|
|
263
|
+
puts "Installed fontisan #{spec.version} (#{spec.platform}) for #{RUBY_PLATFORM}."
|
|
264
|
+
unless spec.platform.to_s == ENV.fetch("FONTISAN_PLATFORM")
|
|
265
|
+
warn "ERROR: installed fontisan #{spec.version} platform #{spec.platform} does not match required prebuilt #{ENV.fetch("FONTISAN_PLATFORM")}."
|
|
266
|
+
exit 2
|
|
267
|
+
end
|
|
268
|
+
'
|
|
269
|
+
|
|
270
|
+
- name: Run scan path performance gate
|
|
271
|
+
env:
|
|
272
|
+
FONTIST_PERF_INTEGRATION: "1"
|
|
273
|
+
FONTIST_PERF_TIER: ${{ matrix.tier }}
|
|
274
|
+
FONTISAN_ENGINE_STRICT: "1"
|
|
275
|
+
run: bundle exec rspec spec/performance/scan_path_perf_spec.rb
|
data/README.adoc
CHANGED
|
@@ -2155,9 +2155,6 @@ variable_fonts = Fontist::Import::Google::Api.variable_fonts_only
|
|
|
2155
2155
|
----
|
|
2156
2156
|
====
|
|
2157
2157
|
|
|
2158
|
-
For detailed usage examples, see
|
|
2159
|
-
link:docs/google-fonts-multi-format-usage.md[Google Fonts Multi-Format Usage Guide].
|
|
2160
|
-
|
|
2161
2158
|
==== Importing fonts from Google Fonts as Fontist Formulas
|
|
2162
2159
|
|
|
2163
2160
|
Prerequisites:
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
require "open3"
|
|
2
|
+
require "tempfile"
|
|
3
|
+
|
|
4
|
+
module Fontist
|
|
5
|
+
module Utils
|
|
6
|
+
class CurlDownloader
|
|
7
|
+
CURL = "curl.exe".freeze
|
|
8
|
+
|
|
9
|
+
def self.fallback?(error)
|
|
10
|
+
available? && enotsock?(error)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.available?
|
|
14
|
+
Gem.win_platform?
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.enotsock?(error)
|
|
18
|
+
node = error
|
|
19
|
+
while node
|
|
20
|
+
return true if node.is_a?(Errno::ENOTSOCK)
|
|
21
|
+
|
|
22
|
+
node = node.cause
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Down flattens the MinGW OpenSSL errno into a message-only
|
|
26
|
+
# Down::ConnectionError (no typed #cause), so match the text as a
|
|
27
|
+
# last resort.
|
|
28
|
+
msg = error.message.to_s
|
|
29
|
+
msg.include?("not a socket") || msg.include?("ENOTSOCK")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def initialize(url, headers: {})
|
|
33
|
+
@url = url
|
|
34
|
+
@headers = headers
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns a Tempfile that satisfies the cache duck type:
|
|
38
|
+
# #original_filename, #content_type, #path, #close.
|
|
39
|
+
def download
|
|
40
|
+
tempfile = Tempfile.new("fontist-curl", binmode: true)
|
|
41
|
+
content_type = run(argv(tempfile.path))
|
|
42
|
+
decorate(tempfile, content_type)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def argv(output_path)
|
|
46
|
+
# rubocop:disable-next Style/FormatStringToken
|
|
47
|
+
[CURL, "-fSL", "--retry", "3", *header_args,
|
|
48
|
+
"-w", "%{content_type}", "-o", output_path, "--", @url]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
# Forward every header Down would have sent (User-Agent plus any
|
|
54
|
+
# formula-specific Authorization/Referer/cookies), not just the UA.
|
|
55
|
+
def header_args
|
|
56
|
+
@headers.flat_map { |key, value| ["-H", "#{key}: #{value}"] }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# The body goes to -o; stdout carries only curl's -w content_type.
|
|
60
|
+
def run(argv)
|
|
61
|
+
out, err, status = Open3.capture3(*argv)
|
|
62
|
+
return out.strip if status.success?
|
|
63
|
+
|
|
64
|
+
raise Fontist::Errors::InvalidResourceError,
|
|
65
|
+
"curl failed for #{@url}: #{err.strip}"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def decorate(tempfile, content_type)
|
|
69
|
+
filename = File.basename(URI(@url).path)
|
|
70
|
+
tempfile.define_singleton_method(:original_filename) { filename }
|
|
71
|
+
# Cache derives an extension from content_type only when the URL has
|
|
72
|
+
# no extname; curl's -w reports it so extensionless URLs still resolve,
|
|
73
|
+
# matching the Down path.
|
|
74
|
+
type = content_type unless content_type.to_s.empty?
|
|
75
|
+
tempfile.define_singleton_method(:content_type) { type }
|
|
76
|
+
tempfile
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -106,15 +106,20 @@ module Fontist
|
|
|
106
106
|
options[:download_path] || Fontist.root_path.join("tmp")
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
+
# rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
|
|
109
110
|
def download_file
|
|
110
111
|
print_download_start if @verbose
|
|
111
112
|
do_download_file
|
|
112
|
-
rescue
|
|
113
|
+
rescue StandardError => e
|
|
114
|
+
return curl_download if CurlDownloader.fallback?(e)
|
|
115
|
+
raise unless e.is_a?(Down::Error)
|
|
116
|
+
|
|
113
117
|
retry if retry_download?(e)
|
|
114
118
|
|
|
115
119
|
raise Fontist::Errors::InvalidResourceError,
|
|
116
120
|
"Invalid URL: #{@file}. Error: #{e.inspect}."
|
|
117
121
|
end
|
|
122
|
+
# rubocop:enable Metrics/MethodLength, Metrics/CyclomaticComplexity
|
|
118
123
|
|
|
119
124
|
def retry_download?(error)
|
|
120
125
|
response = http_response(error)
|
|
@@ -256,11 +261,19 @@ module Fontist
|
|
|
256
261
|
|
|
257
262
|
def github_aware_url(raw_url)
|
|
258
263
|
parsed = GitHubUrl.parse(raw_url)
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
return raw_url unless parsed.matched?
|
|
265
|
+
|
|
266
|
+
GitHubClient.authenticated_download_url(parsed)
|
|
267
|
+
rescue StandardError => e
|
|
268
|
+
raise unless CurlDownloader.fallback?(e)
|
|
269
|
+
|
|
270
|
+
# raw_url is the releases/download/... form; curl's -L resolves the
|
|
271
|
+
# redirect itself, so we skip the API-based asset resolution.
|
|
272
|
+
raw_url
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
def curl_download
|
|
276
|
+
CurlDownloader.new(url, headers: headers).download
|
|
264
277
|
end
|
|
265
278
|
end
|
|
266
279
|
|
data/lib/fontist/utils.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module Fontist
|
|
2
2
|
module Utils
|
|
3
3
|
autoload :Cache, "#{__dir__}/utils/cache"
|
|
4
|
+
autoload :CurlDownloader, "#{__dir__}/utils/curl_downloader"
|
|
4
5
|
autoload :Downloader, "#{__dir__}/utils/downloader"
|
|
5
6
|
autoload :FileMagic, "#{__dir__}/utils/file_magic"
|
|
6
7
|
autoload :FileOps, "#{__dir__}/utils/file_ops"
|
data/lib/fontist/version.rb
CHANGED
data/lib/fontist.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fontist
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.43
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: down
|
|
@@ -258,6 +258,7 @@ files:
|
|
|
258
258
|
- ".github/workflows/docs.yml"
|
|
259
259
|
- ".github/workflows/formulas-auto-update-test.yml"
|
|
260
260
|
- ".github/workflows/links.yml"
|
|
261
|
+
- ".github/workflows/perf-gate.yml"
|
|
261
262
|
- ".github/workflows/post-rake.yml"
|
|
262
263
|
- ".github/workflows/rake-metanorma.yaml"
|
|
263
264
|
- ".github/workflows/rake.yml"
|
|
@@ -273,10 +274,6 @@ files:
|
|
|
273
274
|
- LICENSE.txt
|
|
274
275
|
- README.adoc
|
|
275
276
|
- Rakefile
|
|
276
|
-
- TODO.audit-docs.md
|
|
277
|
-
- TODO.fontist-v5.md
|
|
278
|
-
- TODO.improve-docs.md
|
|
279
|
-
- TODO.upgrade-excavate.md
|
|
280
277
|
- docs/.gitignore
|
|
281
278
|
- docs/.vitepress/config.ts
|
|
282
279
|
- docs/.vitepress/theme/components/HeroCodeBlock.vue
|
|
@@ -346,7 +343,6 @@ files:
|
|
|
346
343
|
- fontist.gemspec
|
|
347
344
|
- formula_filename_index.yml
|
|
348
345
|
- formula_index.yml
|
|
349
|
-
- google-fonts-multi-format-usage.md
|
|
350
346
|
- lib/fontist.rb
|
|
351
347
|
- lib/fontist/cache.rb
|
|
352
348
|
- lib/fontist/cache/manager.rb
|
|
@@ -513,6 +509,7 @@ files:
|
|
|
513
509
|
- lib/fontist/update.rb
|
|
514
510
|
- lib/fontist/utils.rb
|
|
515
511
|
- lib/fontist/utils/cache.rb
|
|
512
|
+
- lib/fontist/utils/curl_downloader.rb
|
|
516
513
|
- lib/fontist/utils/downloader.rb
|
|
517
514
|
- lib/fontist/utils/file_magic.rb
|
|
518
515
|
- lib/fontist/utils/file_ops.rb
|
data/TODO.audit-docs.md
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# TODO: Documentation Audit
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Audit all Fontist Ruby gem functionality to ensure complete documentation coverage.
|
|
5
|
-
|
|
6
|
-
## Reference Files
|
|
7
|
-
- docs/guide/how-it-works.md
|
|
8
|
-
- docs/api/
|
|
9
|
-
- docs/cli/
|
|
10
|
-
- docs/guide/concepts/
|
|
11
|
-
|
|
12
|
-
**Last Updated:** 2026-03-10
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## ✅ COMPLETED
|
|
17
|
-
|
|
18
|
-
### 1. Configuration Priority System
|
|
19
|
-
Documented in `/guide/how-it-works.md`
|
|
20
|
-
|
|
21
|
-
**Priority Order (Highest to Lowest):**
|
|
22
|
-
|
|
23
|
-
| Priority | Source | Example | Notes |
|
|
24
|
-
|----------|--------|---------|-------|
|
|
25
|
-
| 1 | ENV VAR | `FONTIST_PATH=/custom` | Always wins |
|
|
26
|
-
| 2 | Config file | `~/.fontist/config.yml` | Persistent settings |
|
|
27
|
-
| 3 | CLI option | `--location user` | Per-command override |
|
|
28
|
-
| 4 | Ruby API | `Fontist.preferred_family = true` | Programmatic |
|
|
29
|
-
| 5 | Default | Built-in defaults | Fallback |
|
|
30
|
-
|
|
31
|
-
### 2. Installation Locations
|
|
32
|
-
Documented in `/guide/how-it-works.md`
|
|
33
|
-
|
|
34
|
-
| Type | Path | Managed? | Use Case |
|
|
35
|
-
|------|------|----------|----------|
|
|
36
|
-
| fontist | `~/.fontist/fonts/{formula}/` | ✅ Yes | Default, isolated |
|
|
37
|
-
| user | `~/Library/Fonts/fontist/` (macOS) | ✅ Yes | User-wide access |
|
|
38
|
-
| system | `/Library/Fonts/fontist/` (macOS) | ✅ Yes | All users |
|
|
39
|
-
|
|
40
|
-
### 3. Font Indexes
|
|
41
|
-
Documented in `/guide/how-it-works.md`
|
|
42
|
-
|
|
43
|
-
- Formula Index: Maps font names → formula files
|
|
44
|
-
- System Index: OS-installed fonts
|
|
45
|
-
- Fontist Index: Fonts installed via Fontist
|
|
46
|
-
- User Index: User-installed fonts
|
|
47
|
-
|
|
48
|
-
### 4. Formula Repository
|
|
49
|
-
Documented in `/guide/formulas.md`
|
|
50
|
-
|
|
51
|
-
- Location: `~/.fontist/versions/v4/formulas/`
|
|
52
|
-
- Git clone from `https://github.com/fontist/formulas.git`
|
|
53
|
-
- Auto-updates via `fontist update`
|
|
54
|
-
- Private repos via `fontist repo`
|
|
55
|
-
|
|
56
|
-
### 5. CLI Commands
|
|
57
|
-
All documented in `/docs/cli/`
|
|
58
|
-
|
|
59
|
-
### 6. Ruby API Classes
|
|
60
|
-
All documented in `/docs/api/`
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## 🔄 IN PROGRESS
|
|
65
|
-
|
|
66
|
-
- [ ] Add configuration priority table to how-it-works.md
|
|
67
|
-
- [ ] Add managed vs non-managed location explanation
|
|
68
|
-
- [ ] Document all ENV variables in reference page
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Configuration Reference
|
|
73
|
-
|
|
74
|
-
### All Configuration Settings
|
|
75
|
-
|
|
76
|
-
| Setting | ENV VAR | Config Key | CLI Option | Default |
|
|
77
|
-
|---------|---------|------------|------------|---------|
|
|
78
|
-
| Base path | `FONTIST_PATH` | - | - | `~/.fontist` |
|
|
79
|
-
| Fonts path | - | `fonts_path` | - | `~/.fontist/fonts` |
|
|
80
|
-
| Formulas path | `FONTIST_FORMULAS_PATH` | - | `--formulas-path` | (auto) |
|
|
81
|
-
| Install location | `FONTIST_INSTALL_LOCATION` | `fonts_install_location` | `--location` | `fontist` |
|
|
82
|
-
| User fonts path | `FONTIST_USER_FONTS_PATH` | `user_fonts_path` | - | Platform default |
|
|
83
|
-
| System fonts path | `FONTIST_SYSTEM_FONTS_PATH` | `system_fonts_path` | - | Platform default |
|
|
84
|
-
| Preferred family | - | `preferred_family` | `--preferred-family` | `false` |
|
|
85
|
-
| No cache | - | - | `--no-cache` | `false` |
|
|
86
|
-
| Quiet mode | - | - | `--quiet` | `false` |
|
|
87
|
-
| Verbose | - | - | `--verbose` | `false` |
|
|
88
|
-
| Open timeout | - | `open_timeout` | - | `60` |
|
|
89
|
-
| Read timeout | - | `read_timeout` | - | `60` |
|
|
90
|
-
| Google Fonts key | `GOOGLE_FONTS_API_KEY` | `google_fonts_key` | - | `nil` |
|
|
91
|
-
| Import cache | `FONTIST_IMPORT_CACHE` | - | - | `~/.fontist/import_cache` |
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Environment Variables Reference
|
|
96
|
-
|
|
97
|
-
| Variable | Description | Default |
|
|
98
|
-
|----------|-------------|---------|
|
|
99
|
-
| `FONTIST_PATH` | Base directory for all Fontist data | `~/.fontist` |
|
|
100
|
-
| `FONTIST_FORMULAS_PATH` | Custom formulas directory | (auto) |
|
|
101
|
-
| `FONTIST_INSTALL_LOCATION` | Default install location (`fontist`, `user`, `system`) | `fontist` |
|
|
102
|
-
| `FONTIST_USER_FONTS_PATH` | Custom user fonts path | Platform default |
|
|
103
|
-
| `FONTIST_SYSTEM_FONTS_PATH` | Custom system fonts path | Platform default |
|
|
104
|
-
| `FONTIST_IMPORT_CACHE` | Import cache directory | `~/.fontist/import_cache` |
|
|
105
|
-
| `FONTIST_NO_MIRRORS` | Disable formula index mirrors | `false` |
|
|
106
|
-
| `GOOGLE_FONTS_API_KEY` | Google Fonts API key | (none) |
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Managed vs Non-Managed Locations
|
|
111
|
-
|
|
112
|
-
### Managed Locations (Fontist controls)
|
|
113
|
-
- `~/.fontist/fonts/` - Always managed
|
|
114
|
-
- `~/Library/Fonts/fontist/` - Managed subdirectory
|
|
115
|
-
- `/Library/Fonts/fontist/` - Managed subdirectory
|
|
116
|
-
|
|
117
|
-
**Behavior:** Safe to replace existing fonts
|
|
118
|
-
|
|
119
|
-
### Non-Managed Locations (custom paths via ENV)
|
|
120
|
-
- `FONTIST_USER_FONTS_PATH=~/Library/Fonts` → installs directly
|
|
121
|
-
- `FONTIST_SYSTEM_FONTS_PATH=/Library/Fonts` → installs directly
|
|
122
|
-
|
|
123
|
-
**Behavior:** Uses unique filenames (`-fontist` suffix) to avoid conflicts
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Directory Structure
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
~/.fontist/
|
|
131
|
-
├── fonts/ # Installed font files
|
|
132
|
-
│ └── {formula-key}/
|
|
133
|
-
│ └── *.ttf
|
|
134
|
-
├── versions/
|
|
135
|
-
│ └── v4/
|
|
136
|
-
│ ├── formulas/ # Git clone of formulas repo
|
|
137
|
-
│ │ └── Formulas/
|
|
138
|
-
│ │ ├── roboto.yml
|
|
139
|
-
│ │ └── private/ # Custom formula repos
|
|
140
|
-
│ ├── formula_index.default_family.yml
|
|
141
|
-
│ ├── formula_index.preferred_family.yml
|
|
142
|
-
│ └── filename_index.yml
|
|
143
|
-
├── config.yml # User configuration
|
|
144
|
-
├── downloads/ # Temporary downloads
|
|
145
|
-
├── import_cache/ # Imported font cache
|
|
146
|
-
├── system_index.default_family.yml # System fonts index
|
|
147
|
-
├── fontist_index.default_family.yml # Fontist fonts index
|
|
148
|
-
└── user_index.default_family.yml # User fonts index
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
## Remaining Minor Gaps
|
|
154
|
-
|
|
155
|
-
- [ ] Document import system (`fontist import`) internals
|
|
156
|
-
- [ ] Document cache system internals
|
|
157
|
-
- [ ] Document formula picker algorithm
|
|
158
|
-
- [ ] Document locking mechanism (for concurrent operations)
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## Status: Nearly Complete
|
|
163
|
-
**Priority:** High
|
|
164
|
-
**Notes:** Core functionality documented, minor gaps remain
|