glyphs 0.1.0 → 0.2.0

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: 1a379bf83aad5e7a6adfc47f2f8cced12baa7ce0e970b0b675747445f8ab9f99
4
- data.tar.gz: d134dcee770ac2629575ef80b020b9e61982e55bd8affd0e944ce5316ad22e4d
3
+ metadata.gz: 977c4ff81bc073f486991e32e6f27418419d440ddf15fc0cd8cb4357091abe8a
4
+ data.tar.gz: e2f6a73fa1545cae2d0714c9b2528b8b8d65b6474af45e1c73ae0999b5851cde
5
5
  SHA512:
6
- metadata.gz: 8d0a4346f8b888f8be02ec3403b46262dfa5593276d767cc37215e5eb03d2c2a7261d7f9709ddb2fad1d1715220dfcecfd6c5dbb928818810cf5442c62320c2e
7
- data.tar.gz: 444366fd42ba9ba2a8b422a0b2ad8ec8674bc737e477fc10e91cc7f7890b9cdc52bb76eb8b5056fd87c80123a959f2fe919e25f1e95be2f09abfcb2746494961
6
+ metadata.gz: 3f9570e3186cf64e294a7ca0f4de342d5ef16ba7bd6ac86017737617566bef92caff25ea9f665a2d3044abe76990ec9ed81d020e0cd943bfc3983c4228f86360
7
+ data.tar.gz: 49bd88b05cc3dfe3370348ade5a9498a26b6b7db12fb25fff63fb1ef0c8be94091cc71ef30728273a10a90be740d3fc0e867e751d5a505add4c1a1e0a0f741ce
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0] - 2026-07-07
4
+
5
+ ### Changed
6
+
7
+ - **Breaking:** `config.raise_on_missing_icon` (a callable) is now `config.raise_on_missing`,
8
+ an honest boolean. The default is evaluated once: `Rails.env.local?` under Rails, `true` outside.
9
+ - **Breaking:** `config.on_missing_icon` now defaults to `nil` — set it only if you want a handler.
10
+
11
+ ### Added
12
+
13
+ - Release workflow with RubyGems trusted publishing (OIDC) and Sigstore attestation.
14
+
3
15
  ## [0.1.0] - 2026-07-07
4
16
 
5
17
  ### Added
data/README.md CHANGED
@@ -80,10 +80,11 @@ BrandIcon(:logo)
80
80
  ```ruby
81
81
  # config/initializers/glyphs.rb
82
82
  Glyphs.configure do |config|
83
- # Re-raise Icons::IconNotFound? Default: true locally (dev/test), never blind in production.
84
- config.raise_on_missing_icon = -> { Rails.env.local? }
83
+ # Re-raise Icons::IconNotFound? Defaults to true in local Rails
84
+ # environments (and outside Rails), false otherwise.
85
+ config.raise_on_missing = Rails.env.local?
85
86
 
86
- # Instrumentation hook, called before the fallback renders.
87
+ # Optional handler, called before the fallback renders (when not raising).
87
88
  config.on_missing_icon = lambda do |error, name:, library:, variant:|
88
89
  Rails.logger.error("Icon missing: #{library}/#{variant}/#{name} (#{error.message})")
89
90
  end
@@ -8,15 +8,17 @@ module Glyphs
8
8
  heroicons: "question-mark-circle"
9
9
  }.freeze
10
10
 
11
- # raise_on_missing_icon: callable -> bool; when true, Icons::IconNotFound is re-raised.
12
- # on_missing_icon: callable(error, name:, library:, variant:) instrumentation hook.
11
+ # raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised.
12
+ # Defaults to true in local Rails environments (and outside Rails).
13
+ # on_missing_icon: optional callable(error, name:, library:, variant:),
14
+ # invoked before the fallback renders when not raising.
13
15
  # fallback_icons: { library => icon_name } rendered instead of a missing icon.
14
16
  # cache_svgs: memoize rendered SVG strings per [library, variant, name, attributes].
15
- attr_accessor :raise_on_missing_icon, :on_missing_icon, :fallback_icons, :cache_svgs
17
+ attr_accessor :raise_on_missing, :on_missing_icon, :fallback_icons, :cache_svgs
16
18
 
17
19
  def initialize
18
- @raise_on_missing_icon = -> { defined?(Rails) ? Rails.env.local? : true }
19
- @on_missing_icon = ->(error, name:, library:, variant:) {}
20
+ @raise_on_missing = defined?(Rails) ? Rails.env.local? : true
21
+ @on_missing_icon = nil
20
22
  @fallback_icons = DEFAULT_FALLBACK_ICONS.dup
21
23
  @cache_svgs = true
22
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Glyphs
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/glyphs.rb CHANGED
@@ -92,9 +92,9 @@ module Glyphs
92
92
  end
93
93
 
94
94
  def handle_missing_icon(error, name:, library:, variant:, attributes:)
95
- raise error if configuration.raise_on_missing_icon.call
95
+ raise error if configuration.raise_on_missing
96
96
 
97
- configuration.on_missing_icon.call(error, name:, library:, variant:)
97
+ configuration.on_missing_icon&.call(error, name:, library:, variant:)
98
98
 
99
99
  fallback = configuration.fallback_icons[library.to_sym]
100
100
  raise error if fallback.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glyphs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -27,14 +27,14 @@ dependencies:
27
27
  name: rails_icons
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '1.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '1.2'
40
40
  - !ruby/object:Gem::Dependency
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubygems_version: 4.0.9
112
+ rubygems_version: 3.6.9
113
113
  specification_version: 4
114
114
  summary: Phlex icon components for every rails_icons library
115
115
  test_files: []