fontist 3.0.5 → 3.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0403ccfbfdac1ce2d3b3be90872600c857101d498017d0849903a0e0231b2af
4
- data.tar.gz: d16c6f71f7182a054f7600beb77e58c41bf726e813d6b893e3f605a33bb462d1
3
+ metadata.gz: 473f97386abfc5612b2386ef09c7166f57577346e1fa1576f10b89cde776a82a
4
+ data.tar.gz: 496fe338410ab4a2fca8d03f51de0030ed831e365e3dd310f9a26f92bb441d16
5
5
  SHA512:
6
- metadata.gz: 48d21df850f6e0f4f6fb1a89536ae78d392f9421e2e95593b73636448a67b106055ad9c5aefc0152659a8460f5a9a4be4fdecd12acdce869cc30e56211115246
7
- data.tar.gz: 667f24398403d0e295c188f4bc200dc42a6b6da419cc39c9e4e621a766dc230e450764b1b7836bae1eb13ce50cd25c298b3e89084f2ae3a83d4c9a9b5820078a
6
+ metadata.gz: 3df014b751d95d4e5c9b1ca536e51b8209a0edc85d35fa5e5f277016ef8b1a4a605b2592057afd74b466537446cd3594ea294f3c820530b393c078ce785e1e86
7
+ data.tar.gz: cedd3d33a01cd1ceba826848c09ffb40dda37080bd5a1a4aa4db68dfd95a25869b9080ea4b8b1ba82eb01ebfae45602e35439fe6861730cba4ce5f16a9b8913d
data/lib/fontist/font.rb CHANGED
@@ -4,7 +4,7 @@ module Fontist
4
4
  class Font
5
5
  def initialize(options = {})
6
6
  @name = options[:name]
7
- @confirmation = options[:confirmation] || "no"
7
+ @confirmation = options[:confirmation]
8
8
  @hide_licenses = options[:hide_licenses]
9
9
  @no_progress = options[:no_progress] || false
10
10
  @force = options[:force] || false
@@ -270,7 +270,14 @@ module Fontist
270
270
  return @confirmation if formula.licensed_for_current_platform?
271
271
 
272
272
  show_license(formula) unless @hide_licenses
273
- return @confirmation if @confirmation.casecmp?("yes")
273
+ return @confirmation if @confirmation&.casecmp?("yes")
274
+
275
+ # Explicit rejection: raise immediately without interactive prompt
276
+ if @confirmation&.casecmp?("no")
277
+ raise Fontist::Errors::LicensingError.new(
278
+ "Fontist will not download these fonts unless you accept the terms.",
279
+ )
280
+ end
274
281
 
275
282
  confirmation = ask_for_agreement
276
283
  if confirmation&.casecmp?("yes")
@@ -41,14 +41,21 @@ module Fontist
41
41
  # Get the collection, initializing it lazily if nil
42
42
  #
43
43
  # Uses lazy initialization so that the collection is created with fresh
44
- # font_paths each time it's accessed after reset_cache
44
+ # font_paths each time it's accessed after reset_cache.
45
+ #
46
+ # On cold start (no on-disk index file), eagerly build the index once
47
+ # so that `fonts` reflects an authoritative scan. This lets callers in
48
+ # read-only mode trust the cached `fonts` without re-running `build` on
49
+ # every lookup.
45
50
  #
46
51
  # @return [SystemIndexFontCollection] The collection object
47
52
  def collection
48
53
  @collection ||= SystemIndexFontCollection.from_file(
49
54
  path: index_path,
50
55
  paths_loader: -> { font_paths },
51
- )
56
+ ).tap do |coll|
57
+ coll.build unless File.exist?(index_path)
58
+ end
52
59
  end
53
60
 
54
61
  # Enable read-only mode for operations that don't need index rebuilding
@@ -229,11 +229,7 @@ module Fontist
229
229
  end
230
230
 
231
231
  def index
232
- # Fast path: if read_only mode is set, skip index_changed? check entirely.
233
- # But we still need to build on first access — treat an empty fonts list
234
- # the same as nil, since Lutaml initializes `instances :fonts` to `[]`
235
- # rather than nil when the on-disk index file is absent.
236
- if @read_only_mode && !fonts.nil? && !fonts.empty?
232
+ if @read_only_mode && !fonts.nil?
237
233
  return fonts
238
234
  end
239
235
 
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "3.0.5".freeze
2
+ VERSION = "3.0.7".freeze
3
3
  end
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.5
4
+ version: 3.0.7
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-05-15 00:00:00.000000000 Z
11
+ date: 2026-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down