jekyll-icon-flow 0.1.2 → 0.2.1
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/CHANGELOG.md +75 -6
- data/README.md +65 -3
- data/assets/icons/lucide/PACK.yml +43 -0
- data/assets/icons/lucide/arrow-down.svg +0 -2
- data/assets/icons/lucide/arrow-left.svg +0 -2
- data/assets/icons/lucide/arrow-right.svg +0 -2
- data/assets/icons/lucide/arrow-up.svg +0 -2
- data/assets/icons/lucide/calendar.svg +0 -2
- data/assets/icons/lucide/check.svg +0 -2
- data/assets/icons/lucide/chevron-down.svg +0 -2
- data/assets/icons/lucide/chevron-left.svg +0 -2
- data/assets/icons/lucide/chevron-right.svg +0 -2
- data/assets/icons/lucide/chevron-up.svg +0 -2
- data/assets/icons/lucide/copy.svg +0 -2
- data/assets/icons/lucide/download.svg +0 -2
- data/assets/icons/lucide/external-link.svg +0 -2
- data/assets/icons/lucide/file-text.svg +0 -2
- data/assets/icons/lucide/folder.svg +0 -2
- data/assets/icons/lucide/home.svg +0 -2
- data/assets/icons/lucide/info.svg +0 -2
- data/assets/icons/lucide/link.svg +0 -2
- data/assets/icons/lucide/mail.svg +0 -2
- data/assets/icons/lucide/map-pin.svg +0 -2
- data/assets/icons/lucide/map.svg +0 -2
- data/assets/icons/lucide/menu.svg +0 -2
- data/assets/icons/lucide/moon.svg +0 -2
- data/assets/icons/lucide/printer.svg +0 -2
- data/assets/icons/lucide/rss.svg +0 -2
- data/assets/icons/lucide/search.svg +0 -2
- data/assets/icons/lucide/sun.svg +0 -2
- data/assets/icons/lucide/tag.svg +0 -2
- data/assets/icons/lucide/triangle-alert.svg +0 -2
- data/assets/icons/lucide/x.svg +0 -2
- data/assets/icons/simple/PACK.yml +23 -0
- data/interface.yml +1 -1
- data/lib/jekyll/icon_flow/adapters/lucide.rb +4 -0
- data/lib/jekyll/icon_flow/pack_manifest.rb +237 -0
- data/lib/jekyll/icon_flow/pack_sync.rb +313 -0
- data/lib/jekyll/icon_flow/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ef4ee6041c21410a4a0718fb1f30443f4854690f59d10d51f94a0be9fbd8f371
|
|
4
|
+
data.tar.gz: a59401a057975090d93600ce76b4b4dfc56dfb163341fdc11e7a445d7d948fcf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd1918f7c351cad7cb256575079b565b4b90d12f968998037f83694f42fe1aafc04f25a70ec8476be783b5be3890b117b459ddc0c59b9c7cf31bef248b353243
|
|
7
|
+
data.tar.gz: 750c3cb10a9cd003dc48aeae28505eb2ac98fa020980b789e229220e878502b48626737b710f711f74107dbdbd83d17f4bf27707f00c4c7a0594afff6cad886e
|
data/CHANGELOG.md
CHANGED
|
@@ -2,14 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.2.1] - 2026-11-10
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Gemspec `description` now renders as RDoc on rubygems.org — the heredoc
|
|
10
|
+
opens with an `==`-level heading at column 0 so the gem page shows
|
|
11
|
+
headings and bullet lists instead of one plain paragraph — and mentions
|
|
12
|
+
the jekyll-imgflow-vscode VS Code companion extension for tag
|
|
13
|
+
autocomplete.
|
|
14
|
+
- Vendored lucide `PACK.yml` bumped to upstream 1.71.0 — no icon byte
|
|
15
|
+
changes, provenance-only update required by the strict pre-release
|
|
16
|
+
freshness gate.
|
|
17
|
+
- RuboCop `Metrics/BlockLength` now excludes `*.gemspec` — the longer
|
|
18
|
+
RDoc description heredoc pushed the spec block over the 25-line max
|
|
19
|
+
(matches the sibling repos' config).
|
|
20
|
+
|
|
21
|
+
## [0.2.0] - 2026-11-08
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Icon-pack freshness tooling: each vendored pack now carries a
|
|
26
|
+
`PACK.yml` provenance manifest (upstream repo, license, release tag,
|
|
27
|
+
vendored date, per-icon SHA-256 digests, `aliases` for upstream
|
|
28
|
+
renames, and persistent `missing_upstream` entries). `rake icons:check`
|
|
29
|
+
reports stale releases, local drift, and unresolved icons
|
|
30
|
+
(`STRICT=1` fails); `rake icons:sync[pack]` re-downloads the manifest's
|
|
31
|
+
curated icon list without blessing unrelated local files.
|
|
32
|
+
- `version:pre_release` runs `icons:check` in strict mode so stale,
|
|
33
|
+
drifted, or unresolved packs block a release.
|
|
34
|
+
- `.github/workflows/icons-sync.yml` — weekly scheduled sync that opens
|
|
35
|
+
a PR when upstream icon packs released new versions.
|
|
36
|
+
- `rake docs:demo` — generates `docs/assets/` showcase page from real
|
|
37
|
+
adapter output and captures it as animated AVIF + WebP + static PNG
|
|
38
|
+
(headless Chrome + ffmpeg libsvtav1 + img2webp; build-host tools),
|
|
39
|
+
embedded in README via `<picture>`.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Restored Lucide's legacy `lucide lucide-<name>` CSS classes in rendered
|
|
44
|
+
SVG while keeping vendored files byte-identical to upstream.
|
|
45
|
+
- Dependency updates: `addressable` 2.9.1 → 2.9.2, `minitest`
|
|
46
|
+
6.0.6 → 6.1.0, `sass-embedded` 1.107.0 → 1.108.1; pinned-leg
|
|
47
|
+
lockfiles refreshed (`minitest` 6.1.0, `prism` 1.9.0 → 2.1.0).
|
|
48
|
+
- CI: `ruby/setup-ruby` pin bumped v1.335.0 → v1.338.0;
|
|
49
|
+
`BUNDLED WITH` bumped 4.0.21 → 4.0.24.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- CI: pinned-Jekyll matrix legs failed at `bundle install` — the
|
|
54
|
+
`JEKYLL_VERSION`-gated Gemfile never matched the committed lockfile under
|
|
55
|
+
frozen install. Legs now use `BUNDLE_GEMFILE` with committed
|
|
56
|
+
`gemfiles/*.gemfile.lock`, so every leg installs frozen and cacheable;
|
|
57
|
+
dependabot covers `/gemfiles`.
|
|
58
|
+
|
|
5
59
|
## [0.1.2] - 2026-10-30
|
|
6
60
|
|
|
7
61
|
### Changed
|
|
8
62
|
|
|
9
|
-
- CI: Semgrep bumped 1.176.0 → 1.182.0 — the standalone job runs the
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
63
|
+
- CI: Semgrep bumped 1.176.0 → 1.182.0 — the standalone job runs the
|
|
64
|
+
digest-pinned `semgrep/semgrep:1.182.0` container image; matrix/release
|
|
65
|
+
jobs install it via `pipx install semgrep==1.182.0`. Added
|
|
66
|
+
`.github/dependabot.yml` covering github-actions and bundler updates.
|
|
67
|
+
- Tests migrated from RSpec to Minitest (`spec/` → `test/`; `minitest` +
|
|
68
|
+
`minitest-mock` for `Object#stub`, `jekyll-test-harness` via
|
|
69
|
+
`install!(framework: :minitest)`). The vendored-icon smoke test is now
|
|
70
|
+
generated per icon so a corrupt SVG names the icon in the failure;
|
|
71
|
+
SimpleCov tracks branch coverage.
|
|
72
|
+
- CI matrixes Jekyll minors (`~> 4.0.0`, `~> 4.2.0`, latest) × Ruby
|
|
73
|
+
3.3/3.4 via a `JEKYLL_VERSION`-gated Gemfile pin; pinned legs run
|
|
74
|
+
`rake test` only because RuboCop's `unicode-display_width` can't
|
|
75
|
+
resolve with pre-4.3 `terminal-table`. `csv`/`base64`/`bigdecimal` are
|
|
76
|
+
declared for old Jekyll on Ruby 3.4.
|
|
77
|
+
- Added `test/system/gem_artifact_test.rb` — builds the packaged `.gem`
|
|
78
|
+
and runs a real `jekyll build` against it (`rake test:system`, part of
|
|
79
|
+
`rake ci`).
|
|
13
80
|
|
|
14
81
|
## [0.1.1] - 2026-10-06
|
|
15
82
|
|
|
@@ -46,5 +113,7 @@
|
|
|
46
113
|
files (fontawesome, tabler, …), usable via `pack:`, the search chain,
|
|
47
114
|
and `icon_ref` registry targets
|
|
48
115
|
- `icon_flow.on_missing: warn|strict` — warn + empty render by default
|
|
49
|
-
- Escape Liquid-supplied SVG attributes, validate icon sizes, and
|
|
50
|
-
|
|
116
|
+
- Escape Liquid-supplied SVG attributes, validate icon sizes, and
|
|
117
|
+
normalize child SVG colors.
|
|
118
|
+
- RSpec integration/adapter contracts, coverage reporting, Semgrep and
|
|
119
|
+
gem-artifact checks.
|
data/README.md
CHANGED
|
@@ -16,6 +16,19 @@ Pack-agnostic inline SVG icons for Jekyll via Liquid tags. Each icon pack
|
|
|
16
16
|
is an adapter that resolves names to SVG sources and normalizes the output —
|
|
17
17
|
so switching packs changes the icon, not your styling.
|
|
18
18
|
|
|
19
|
+
<!-- markdownlint-disable MD033 -->
|
|
20
|
+
<picture>
|
|
21
|
+
<source
|
|
22
|
+
srcset="docs/assets/icon-flow-demo.avif"
|
|
23
|
+
type="image/avif">
|
|
24
|
+
<source
|
|
25
|
+
srcset="docs/assets/icon-flow-demo.webp"
|
|
26
|
+
type="image/webp">
|
|
27
|
+
<img src="docs/assets/icon-flow-demo.png"
|
|
28
|
+
alt="Icon tags rendered to inline SVG: packs, sizes, colors, icon_ref">
|
|
29
|
+
</picture>
|
|
30
|
+
<!-- markdownlint-enable MD033 -->
|
|
31
|
+
|
|
19
32
|
## Install
|
|
20
33
|
|
|
21
34
|
```ruby
|
|
@@ -52,12 +65,17 @@ coexist. Swap `icon_lucide` for `icon_simple` and the icon changes while
|
|
|
52
65
|
### Parameters
|
|
53
66
|
|
|
54
67
|
| Param | Default | Effect |
|
|
55
|
-
| --- | --- | --- |
|
|
56
|
-
| `size:` | `m` (`1em`) | Named
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| `size:` | `m` (`1em`) | Named or CSS size applied to width and height. |
|
|
57
70
|
| `class:` | — | merged onto the `<svg>` alongside `icon icon-<name>` |
|
|
58
71
|
| `title:` | — | accessible label, rendered as `<title>` in the SVG |
|
|
59
72
|
| `pack:` | config | only on `{% icon %}` — pick a pack explicitly |
|
|
60
73
|
|
|
74
|
+
Named sizes map to `em` values: `xxs` 0.5, `xs` 0.75, `s` 0.875, `m` 1,
|
|
75
|
+
`l` 1.25, `xl` 1.5, and `xxl` 2. They scale with surrounding text.
|
|
76
|
+
CSS lengths accept `px`, `em`, `rem`, `%`, `vw`, `vh`, `vmin`, `vmax`,
|
|
77
|
+
`ch`, `ex`, or `0`.
|
|
78
|
+
|
|
61
79
|
## Semantic icon names — `{% icon_ref %}`
|
|
62
80
|
|
|
63
81
|
The central-registry pattern: call sites name *intent*, one map picks the
|
|
@@ -143,7 +161,8 @@ Every icon renders normalized SVG:
|
|
|
143
161
|
are recolored except `none` and `url(...)` references. Inline CSS styles
|
|
144
162
|
and embedded stylesheets in custom SVGs are site-owned and are not rewritten
|
|
145
163
|
- `icon icon-<name>` classes + `data-icon-pack` give stable CSS hooks
|
|
146
|
-
that survive a pack switch
|
|
164
|
+
that survive a pack switch; Lucide also retains its legacy
|
|
165
|
+
`lucide lucide-<name>` classes
|
|
147
166
|
- missing/invalid icons warn via `Jekyll.logger` and render `""`
|
|
148
167
|
(`on_missing: strict` fails the build instead)
|
|
149
168
|
|
|
@@ -154,6 +173,49 @@ Every icon renders normalized SVG:
|
|
|
154
173
|
2. Register it in `IconFlow::ADAPTERS` in `lib/jekyll/icon_flow.rb`.
|
|
155
174
|
3. `{% icon_<pack> %}` and `{% <pack>_icon %}` are registered automatically.
|
|
156
175
|
|
|
176
|
+
## Icon freshness
|
|
177
|
+
|
|
178
|
+
Vendored packs carry a `PACK.yml` provenance manifest (upstream repo,
|
|
179
|
+
license, release tag, vendored date, per-icon SHA-256, and any unresolved
|
|
180
|
+
upstream names) maintained by rake — builds read local files only, never a CDN.
|
|
181
|
+
|
|
182
|
+
- `bundle exec rake icons:check` — report each pack's vendored tag vs the
|
|
183
|
+
latest upstream release, local drift, and unresolved upstream names
|
|
184
|
+
(`STRICT=1` exits non-zero if any pack needs attention).
|
|
185
|
+
- `bundle exec rake icons:sync[pack]` — re-download the manifest's icon
|
|
186
|
+
list at the latest release and rewrite `PACK.yml`. Upstream renames are
|
|
187
|
+
handled by the manifest's `aliases` map (local name → upstream name), so
|
|
188
|
+
old tag names keep working with fresh bytes. Missing upstream names stay
|
|
189
|
+
recorded until a maintainer updates an alias or removes the icon.
|
|
190
|
+
- `.github/workflows/icons-sync.yml` runs the sync weekly and opens a PR
|
|
191
|
+
when packs changed.
|
|
192
|
+
|
|
193
|
+
`version:pre_release` runs the strict freshness check. Normal Jekyll builds
|
|
194
|
+
continue to use the vendored files only; they do not access the network.
|
|
195
|
+
Regenerate demo captures with `bundle exec rake docs:demo`; maintainers
|
|
196
|
+
need Chrome, ffmpeg with `libsvtav1`, and `img2webp`. These host tools are
|
|
197
|
+
not required by the gem or by normal Jekyll builds.
|
|
198
|
+
|
|
199
|
+
## VS Code extension
|
|
200
|
+
|
|
201
|
+
[jekyll-imgflow-vscode](https://github.com/gundestrup/jekyll-imgflow-vscode)
|
|
202
|
+
autocompletes `{% icon %}`, `{% icon_<pack> %}`, `{% <pack>_icon %}` and
|
|
203
|
+
`{% icon_ref %}` in VS Code / VSCodium — tag names, icon names per pack,
|
|
204
|
+
named `size:`/`class:`/`title:` parameters, and registry keys:
|
|
205
|
+
|
|
206
|
+
<!-- markdownlint-disable MD033 -->
|
|
207
|
+
<picture>
|
|
208
|
+
<source
|
|
209
|
+
srcset="https://raw.githubusercontent.com/gundestrup/jekyll-imgflow-vscode/main/docs/assets/icon-flow.avif"
|
|
210
|
+
type="image/avif">
|
|
211
|
+
<source
|
|
212
|
+
srcset="https://raw.githubusercontent.com/gundestrup/jekyll-imgflow-vscode/main/docs/assets/icon-flow.webp"
|
|
213
|
+
type="image/webp">
|
|
214
|
+
<img src="https://raw.githubusercontent.com/gundestrup/jekyll-imgflow-vscode/main/docs/assets/icon-flow.png"
|
|
215
|
+
alt="jekyll-imgflow-vscode: icon tag, icon name and parameter autocomplete">
|
|
216
|
+
</picture>
|
|
217
|
+
<!-- markdownlint-enable MD033 -->
|
|
218
|
+
|
|
157
219
|
## Development and release checks
|
|
158
220
|
|
|
159
221
|
Run `bundle exec rake ci` for RuboCop, dependency audit, local Semgrep rules,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Vendored pack provenance — maintained by `rake icons:sync`.
|
|
2
|
+
# Edit icons only via that task so this file stays truthful.
|
|
3
|
+
---
|
|
4
|
+
pack: lucide
|
|
5
|
+
upstream_repo: lucide-icons/lucide
|
|
6
|
+
upstream_url: https://lucide.dev
|
|
7
|
+
license: ISC
|
|
8
|
+
version: 1.71.0
|
|
9
|
+
vendored: '2026-11-10'
|
|
10
|
+
aliases:
|
|
11
|
+
home: house
|
|
12
|
+
triangle-alert: triangle-exclamation-point
|
|
13
|
+
icons:
|
|
14
|
+
arrow-down: 2b641c7a59d39450edfed72067fcc9940a1a316a737346af23b4b9103c0689f2
|
|
15
|
+
arrow-left: c5f4b88076108eb1a0d95336e1aa7e7bb1419a3a92af96f6247d88cd3456f933
|
|
16
|
+
arrow-right: 288397fdb73bb4f783cf9eabb726ff47357df1d4e3f1201dd748090579f108b9
|
|
17
|
+
arrow-up: 8c22c25874c80bb062bef985d207d8f1d4a4d7847237d0a8cf720a3235968518
|
|
18
|
+
calendar: 312ac8e715ac2b71bcc942dec2e8de9c1929085474f08885af35b563f6aa7a0b
|
|
19
|
+
check: 7f33acc9a77a61659531044525fc008edebe215bf4dcf1c789c8674ad3277db0
|
|
20
|
+
chevron-down: 66ea878e72ed3488bb3b464c39dfdccee8d1f78e560dccea40e5e12da0e87e87
|
|
21
|
+
chevron-left: 83b0681aa38bf55e9d52a1e4b4cced624abe1fe7678ecafda133a574f1161d93
|
|
22
|
+
chevron-right: 2758143d7b2434e4aa7307dfd34405c87909ff4052f21b5f3f40d45224b4f19b
|
|
23
|
+
chevron-up: d09f13fcbef3c493ead7e4663b5ee91804fec38d5edb5e7cc3acfbd547641cf4
|
|
24
|
+
copy: ea80e566c7a12628a447cb53179b19aea4f60b9143e2becd0d0f20bf260e5718
|
|
25
|
+
download: 3daeee13ded5a3afa2198b1bb4e2262d163922f97d96ac6ff9953e8ed4fe039d
|
|
26
|
+
external-link: 3891241b8c3bfc3a8a930078f26ffc5a7e9763da6d0162ace2050b28d4c1d1fe
|
|
27
|
+
file-text: 52ca55846c202335fb870c8aa23e9345630ec10489303756d62e750f7109605c
|
|
28
|
+
folder: f0d92b94b797a8ab7d4c4ae33c3236c47f64068351b4e14bdb5014ee42898a39
|
|
29
|
+
home: 28216c479005731ef5e382e7d8627eda2b129b019eb1f3d9de9f5915576d448e
|
|
30
|
+
info: bc977a64eb96f3e9c1041ffd09a3fceb70e3e65c02b571f76064062ed31f3cb9
|
|
31
|
+
link: 4f3237183dcaabfac92f4e94c776a9a9e45c3c5e77a921061a6b34b61eb5413f
|
|
32
|
+
mail: 3236a51d5b8ce9b0528cf2e6ad07e527bd636dded6f5a9d656072052b99caea8
|
|
33
|
+
map-pin: 16f1042a62f1bda20ebab8bfc1cb79c0be285c980dea6c2c733a17902631405b
|
|
34
|
+
map: 41300a8ef2c2a4cf36ec3f8a730bcb4754543889eb23b98e7435de7a0757752d
|
|
35
|
+
menu: af6491988ac1ba30dc5414f485bc48713e957e1edb0fbef4a0dd8691c3c21598
|
|
36
|
+
moon: 205b959e940d5841f0ce1d09c933153da9d9c94130a54d5cc0c68c2af1d403da
|
|
37
|
+
printer: fa9a6381687bc519a62eb9eac2492d5d51e8e659182822296b6e14bf2f00ecfb
|
|
38
|
+
rss: 68297d9ec163f3d07bb4efac82c54bc62679a5e3ba37cf2dabb27d4c8de8bfe4
|
|
39
|
+
search: 283d371c2e433817bb9c0c8310caa6c77fa4177c0f4f1168d9c83b97af7389dc
|
|
40
|
+
sun: a3955c8b0425fcc5c9ba12d2bdd77fe53b2cd5dd05e7742a56f342e996fb2ef8
|
|
41
|
+
tag: 85e11c07b29f5b67410e0f14c84799d9406320cd4575b7c8322f31910e0582cc
|
|
42
|
+
triangle-alert: 4866f38b8560d410f21e3226413e0b77997b6dfbb6931fadfe0a0d5aef9ffeb4
|
|
43
|
+
x: 4a9cdab38fbb96162e7dace28e33f4ca0e49d8963a6162abc3d4691b7d675117
|
data/assets/icons/lucide/map.svg
CHANGED
data/assets/icons/lucide/rss.svg
CHANGED
data/assets/icons/lucide/sun.svg
CHANGED
data/assets/icons/lucide/tag.svg
CHANGED
data/assets/icons/lucide/x.svg
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Vendored pack provenance — maintained by `rake icons:sync`.
|
|
2
|
+
# Edit icons only via that task so this file stays truthful.
|
|
3
|
+
---
|
|
4
|
+
pack: simple
|
|
5
|
+
upstream_repo: simple-icons/simple-icons
|
|
6
|
+
upstream_url: https://simpleicons.org
|
|
7
|
+
license: CC0-1.0
|
|
8
|
+
version: 16.37.0
|
|
9
|
+
vendored: '2026-11-08'
|
|
10
|
+
icons:
|
|
11
|
+
bluesky: 49752973164fbbf4464fbb4776f011c1eff207e5d7ad9254e031af025814eb75
|
|
12
|
+
discord: 1d364b72c9eaf1fe37d17ca88cd8fb541308dc0f3b09e2ab3b824f380b3493d5
|
|
13
|
+
facebook: b06d18d844ed621b89faffb1a33440cc0ec4f1ffea9f36191f50db19a47c59a6
|
|
14
|
+
github: 3bf8cceead820aec50d4ee825a3fd02c5a1cd6665cc9cf4cbf3d9c8861a204bb
|
|
15
|
+
instagram: f53af2d1fc5292ba1433b5c1faf50005ce6a997fa302d1816989929f379a59dc
|
|
16
|
+
mastodon: b27197d1e47e19f31a80bf5d08b3dc9a8d073083436215f672e8e1016178cbe4
|
|
17
|
+
medium: 411fbe8f2b7d631db8ac0a18b0e248639413fb8c263a71ed8bc9934049b6a7d1
|
|
18
|
+
rss: b31e1d6c3147795d2aa186e7515b624bb2b8046b30fce1063f111b36c99b9ef8
|
|
19
|
+
spotify: b9ec9bec7769c35643981586d6ea0d675aaf3871b32f8a291bcac7a87fff0bc1
|
|
20
|
+
telegram: 147fd8f8923e7e5f463fe98c0eb9913bead6b2ae59935728cda141002ec8a7c9
|
|
21
|
+
tiktok: 6f54ac8d325faacea8935bdc44cbed60206a6b408641799e5fea1cba7c1a0af7
|
|
22
|
+
x: 693e68863eceb8dc9f72e2acd386ab9c20a10858dab2c076212f7084cb7a32fe
|
|
23
|
+
youtube: 5038808acbbc4e6edda16cbeb1cc6dec80e4e4ee4e227e039c41229fa222aa8c
|
data/interface.yml
CHANGED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "yaml"
|
|
4
|
+
require "digest"
|
|
5
|
+
|
|
6
|
+
module Jekyll
|
|
7
|
+
module IconFlow
|
|
8
|
+
# Provenance manifest for a vendored icon pack, stored as PACK.yml
|
|
9
|
+
# inside the pack directory (assets/icons/<pack>/PACK.yml). Records
|
|
10
|
+
# which upstream release the SVGs were vendored from plus a per-icon
|
|
11
|
+
# digest, so `rake icons:check` can report staleness and detect local
|
|
12
|
+
# drift without touching the network.
|
|
13
|
+
#
|
|
14
|
+
# pack: lucide
|
|
15
|
+
# upstream_repo: lucide-icons/lucide
|
|
16
|
+
# upstream_url: https://lucide.dev
|
|
17
|
+
# license: ISC
|
|
18
|
+
# version: "1.70.0" # upstream release tag
|
|
19
|
+
# vendored: "2026-11-08" # date the files were synced
|
|
20
|
+
# icons:
|
|
21
|
+
# search: <sha256 of file bytes>
|
|
22
|
+
module PackManifestSchema
|
|
23
|
+
REQUIRED_KEYS = %w[pack upstream_repo upstream_url license version vendored].freeze
|
|
24
|
+
ICON_NAME = /\A[a-z0-9_-]+\z/
|
|
25
|
+
SHA256 = /\A[0-9a-f]{64}\z/
|
|
26
|
+
GITHUB_REPOSITORY = %r{\A[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+\z}
|
|
27
|
+
RELEASE_TAG = /\A[A-Za-z0-9][A-Za-z0-9._+-]*\z/
|
|
28
|
+
|
|
29
|
+
module_function
|
|
30
|
+
|
|
31
|
+
def valid_icon_name?(name)
|
|
32
|
+
name.is_a?(String) && name.match?(ICON_NAME)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def valid_repository?(repo)
|
|
36
|
+
return false unless repo.is_a?(String) && repo.match?(GITHUB_REPOSITORY)
|
|
37
|
+
|
|
38
|
+
!repo.split("/").intersect?(%w[. ..])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def valid_release_tag?(tag)
|
|
42
|
+
tag.is_a?(String) && tag.match?(RELEASE_TAG)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def validate!(manifest)
|
|
46
|
+
validate_required_keys!(manifest)
|
|
47
|
+
validate_required_values!(manifest)
|
|
48
|
+
validate_icon_digests!(manifest)
|
|
49
|
+
validate_aliases!(manifest)
|
|
50
|
+
validate_missing_upstream!(manifest)
|
|
51
|
+
validate_icon_references!(manifest)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def validate_required_keys!(manifest)
|
|
55
|
+
missing = REQUIRED_KEYS.select { |key| manifest.public_send(key).nil? }
|
|
56
|
+
return if missing.empty?
|
|
57
|
+
|
|
58
|
+
raise Error, "PACK.yml missing keys: #{missing.join(', ')}"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def validate_required_values!(manifest)
|
|
62
|
+
validate_required_strings!(manifest)
|
|
63
|
+
validate_repository_values!(manifest)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def validate_required_strings!(manifest)
|
|
67
|
+
invalid = REQUIRED_KEYS.reject do |key|
|
|
68
|
+
value = manifest.public_send(key)
|
|
69
|
+
value.is_a?(String) && !value.empty?
|
|
70
|
+
end
|
|
71
|
+
raise Error, "PACK.yml required values must be non-empty strings" unless invalid.empty?
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def validate_repository_values!(manifest)
|
|
75
|
+
raise Error, "PACK.yml has an invalid pack name" unless valid_icon_name?(manifest.pack)
|
|
76
|
+
unless valid_repository?(manifest.upstream_repo)
|
|
77
|
+
raise Error, "PACK.yml has an invalid upstream repository"
|
|
78
|
+
end
|
|
79
|
+
return if valid_release_tag?(manifest.version)
|
|
80
|
+
|
|
81
|
+
raise Error, "PACK.yml has an invalid release tag"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def validate_icon_digests!(manifest)
|
|
85
|
+
raise Error, "PACK.yml icons must be a name => sha256 map" unless manifest.icons.is_a?(Hash)
|
|
86
|
+
|
|
87
|
+
invalid = manifest.icons.find do |name, digest|
|
|
88
|
+
!valid_icon_name?(name) || !digest.is_a?(String) || !digest.match?(SHA256)
|
|
89
|
+
end
|
|
90
|
+
raise Error, "PACK.yml icons contain an invalid name or SHA-256 digest" if invalid
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def validate_aliases!(manifest)
|
|
94
|
+
unless manifest.aliases.is_a?(Hash)
|
|
95
|
+
raise Error, "PACK.yml aliases must be a name => upstream_name map"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
invalid = manifest.aliases.find do |name, upstream_name|
|
|
99
|
+
!valid_icon_name?(name) || !valid_icon_name?(upstream_name)
|
|
100
|
+
end
|
|
101
|
+
raise Error, "PACK.yml aliases contain an invalid icon name" if invalid
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def validate_missing_upstream!(manifest)
|
|
105
|
+
unless manifest.missing_upstream.is_a?(Array)
|
|
106
|
+
raise Error, "PACK.yml missing_upstream must be an array of icon names"
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
invalid = manifest.missing_upstream.find { |name| !valid_icon_name?(name) }
|
|
110
|
+
raise Error, "PACK.yml missing_upstream contains an invalid icon name" if invalid
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def validate_icon_references!(manifest)
|
|
114
|
+
unless (manifest.aliases.keys - manifest.icons.keys).empty?
|
|
115
|
+
raise Error, "PACK.yml aliases must reference names in icons"
|
|
116
|
+
end
|
|
117
|
+
return if (manifest.missing_upstream - manifest.icons.keys).empty?
|
|
118
|
+
|
|
119
|
+
raise Error, "PACK.yml missing_upstream must reference names in icons"
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
class PackManifest
|
|
124
|
+
FILENAME = "PACK.yml"
|
|
125
|
+
KEYS = %w[
|
|
126
|
+
pack upstream_repo upstream_url license version vendored aliases icons missing_upstream
|
|
127
|
+
].freeze
|
|
128
|
+
|
|
129
|
+
attr_reader :pack, :upstream_repo, :upstream_url, :license, :icons
|
|
130
|
+
attr_accessor :version, :vendored, :aliases, :missing_upstream
|
|
131
|
+
|
|
132
|
+
def self.path_for(dir)
|
|
133
|
+
File.join(dir, FILENAME)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Manifest for the pack in dir, or nil when the pack has none
|
|
137
|
+
# (unmanaged packs — e.g. site-provided custom dirs — are skipped).
|
|
138
|
+
def self.read(dir)
|
|
139
|
+
path = path_for(dir)
|
|
140
|
+
return nil unless File.file?(path)
|
|
141
|
+
|
|
142
|
+
data = YAML.safe_load_file(path)
|
|
143
|
+
raise Error, "invalid #{path}: expected a mapping" unless data.is_a?(Hash)
|
|
144
|
+
|
|
145
|
+
manifest = new(data.transform_keys(&:to_s))
|
|
146
|
+
manifest.validate!
|
|
147
|
+
manifest
|
|
148
|
+
rescue Psych::Exception => e
|
|
149
|
+
raise Error, "invalid #{path}: #{e.message}"
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def initialize(fields = {})
|
|
153
|
+
fields.each { |key, value| instance_variable_set("@#{key}", value) }
|
|
154
|
+
@icons ||= {}
|
|
155
|
+
@aliases ||= {}
|
|
156
|
+
@missing_upstream ||= []
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def validate!
|
|
160
|
+
PackManifestSchema.validate!(self)
|
|
161
|
+
self
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def self.valid_icon_name?(name)
|
|
165
|
+
PackManifestSchema.valid_icon_name?(name)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def self.valid_repository?(repo)
|
|
169
|
+
PackManifestSchema.valid_repository?(repo)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def self.valid_release_tag?(tag)
|
|
173
|
+
PackManifestSchema.valid_release_tag?(tag)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Upstream filename base for a vendored icon — follows the rename
|
|
177
|
+
# chain recorded in aliases (local name => upstream name).
|
|
178
|
+
def upstream_name(icon_name)
|
|
179
|
+
aliases.fetch(icon_name, icon_name)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def to_h
|
|
183
|
+
KEYS.to_h { |key| [key, public_send(key)] }
|
|
184
|
+
.reject { |key, value| %w[aliases missing_upstream].include?(key) && value.empty? }
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def write(dir)
|
|
188
|
+
File.write(self.class.path_for(dir),
|
|
189
|
+
"# Vendored pack provenance — maintained by `rake icons:sync`.\n" \
|
|
190
|
+
"# Edit icons only via that task so this file stays truthful.\n" +
|
|
191
|
+
to_h.to_yaml)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def self.file_sha256(path)
|
|
195
|
+
Digest::SHA256.file(path).hexdigest
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# name => sha256 for every .svg in dir — the manifest's icons map.
|
|
199
|
+
def self.icon_digests(dir)
|
|
200
|
+
Dir.children(dir).grep(/\.svg\z/).sort.to_h do |file|
|
|
201
|
+
[file.delete_suffix(".svg"), file_sha256(File.join(dir, file))]
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Refresh only the manifest's curated names; never bless local additions.
|
|
206
|
+
# Missing upstream icons retain their last digest until a maintainer acts.
|
|
207
|
+
def capture_icons!(dir, preserve_missing: [])
|
|
208
|
+
actual = self.class.icon_digests(dir)
|
|
209
|
+
@icons = icons.each_with_object({}) do |(name, old_digest), digests|
|
|
210
|
+
if preserve_missing.include?(name)
|
|
211
|
+
digests[name] = old_digest
|
|
212
|
+
elsif actual.key?(name)
|
|
213
|
+
digests[name] = actual[name]
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
self
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Local edits vs the manifest: icons added/removed by hand, or SVG
|
|
220
|
+
# bytes changed since the last sync. Empty hash means clean.
|
|
221
|
+
def drift(dir)
|
|
222
|
+
actual = self.class.icon_digests(dir)
|
|
223
|
+
{
|
|
224
|
+
"added" => (actual.keys - icons.keys).sort,
|
|
225
|
+
"removed" => (icons.keys - actual.keys).sort,
|
|
226
|
+
"modified" => modified_icons(actual)
|
|
227
|
+
}.reject { |_key, names| names.empty? }
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
private
|
|
231
|
+
|
|
232
|
+
def modified_icons(actual)
|
|
233
|
+
(icons.keys & actual.keys).reject { |name| icons[name] == actual[name] }.sort
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require "net/http"
|
|
5
|
+
require "uri"
|
|
6
|
+
require_relative "error"
|
|
7
|
+
require_relative "pack_manifest"
|
|
8
|
+
|
|
9
|
+
module Jekyll
|
|
10
|
+
module IconFlow
|
|
11
|
+
# Minimal HTTPS fetch for the icon-sync tooling: GET => body,
|
|
12
|
+
# following redirects. GITHUB_TOKEN is sent to the GitHub API only
|
|
13
|
+
# (rate-limit headroom in CI), never to raw hosts.
|
|
14
|
+
module HttpFetch
|
|
15
|
+
API_HOST = "api.github.com"
|
|
16
|
+
MAX_REDIRECTS = 3
|
|
17
|
+
|
|
18
|
+
module_function
|
|
19
|
+
|
|
20
|
+
def get(url, redirects: 0)
|
|
21
|
+
uri = URI(url)
|
|
22
|
+
raise Error, "only HTTPS URLs are allowed: #{url}" unless uri.is_a?(URI::HTTPS)
|
|
23
|
+
|
|
24
|
+
response = request(uri)
|
|
25
|
+
case response
|
|
26
|
+
when Net::HTTPSuccess then response.body
|
|
27
|
+
when Net::HTTPRedirection then follow(response, url, redirects)
|
|
28
|
+
else
|
|
29
|
+
raise Error, "HTTP #{response.code} fetching #{url}"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def follow(response, url, redirects)
|
|
34
|
+
raise Error, "too many redirects fetching #{url}" if redirects >= MAX_REDIRECTS
|
|
35
|
+
raise Error, "redirect without location fetching #{url}" unless response["location"]
|
|
36
|
+
|
|
37
|
+
get(URI.join(url, response["location"]).to_s, redirects: redirects + 1)
|
|
38
|
+
rescue URI::InvalidURIError => e
|
|
39
|
+
raise Error, "invalid redirect fetching #{url}: #{e.message}"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def request(uri)
|
|
43
|
+
request = Net::HTTP::Get.new(uri)
|
|
44
|
+
if uri.host == API_HOST && uri.port == 443 && ENV["GITHUB_TOKEN"]
|
|
45
|
+
request["Authorization"] = "Bearer #{ENV['GITHUB_TOKEN']}"
|
|
46
|
+
end
|
|
47
|
+
Net::HTTP.start(uri.host, uri.port,
|
|
48
|
+
use_ssl: true, open_timeout: 10, read_timeout: 15) do |http|
|
|
49
|
+
http.request(request)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# URL construction and release metadata validation are shared by the
|
|
55
|
+
# check and sync operations.
|
|
56
|
+
module PackUpstream
|
|
57
|
+
API = "https://api.github.com"
|
|
58
|
+
RAW = "https://raw.githubusercontent.com"
|
|
59
|
+
ICONS_SUBDIR = "icons"
|
|
60
|
+
|
|
61
|
+
module_function
|
|
62
|
+
|
|
63
|
+
def latest_version(repo, fetcher:)
|
|
64
|
+
raise Error, "invalid upstream repository name: #{repo.inspect}" unless
|
|
65
|
+
PackManifest.valid_repository?(repo)
|
|
66
|
+
|
|
67
|
+
data = JSON.parse(fetcher.call("#{API}/repos/#{repo}/releases/latest"))
|
|
68
|
+
release_tag(repo, data)
|
|
69
|
+
rescue JSON::ParserError => e
|
|
70
|
+
raise Error, "unparseable release response for #{repo}: #{e.message}"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def release_tag(repo, data)
|
|
74
|
+
unless data.is_a?(Hash)
|
|
75
|
+
raise Error, "invalid release response for #{repo}: expected an object"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
tag = data["tag_name"]
|
|
79
|
+
raise Error, "no tag_name in latest release for #{repo}" if tag.to_s.empty?
|
|
80
|
+
raise Error, "invalid release tag for #{repo}: #{tag.inspect}" unless
|
|
81
|
+
PackManifest.valid_release_tag?(tag)
|
|
82
|
+
|
|
83
|
+
tag
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def raw_icon_url(repo, tag, icon_name)
|
|
87
|
+
unless PackManifest.valid_repository?(repo) &&
|
|
88
|
+
PackManifest.valid_release_tag?(tag) &&
|
|
89
|
+
PackManifest.valid_icon_name?(icon_name)
|
|
90
|
+
raise Error, "invalid upstream icon URL components"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
"#{RAW}/#{repo}/#{tag}/#{ICONS_SUBDIR}/#{icon_name}.svg"
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Freshness tooling for vendored icon packs (PACK.yml manifests).
|
|
98
|
+
# `check` reports each pack's vendored upstream tag vs the latest
|
|
99
|
+
# GitHub release; `sync` re-downloads the manifest's icon list from
|
|
100
|
+
# the upstream repo at a release tag and rewrites PACK.yml.
|
|
101
|
+
#
|
|
102
|
+
# Network access is injected via `fetcher` (url => body) so the logic
|
|
103
|
+
# is unit-testable; production tasks use HttpFetch.get.
|
|
104
|
+
class PackSync
|
|
105
|
+
API = PackUpstream::API
|
|
106
|
+
RAW = PackUpstream::RAW
|
|
107
|
+
ICONS_SUBDIR = PackUpstream::ICONS_SUBDIR
|
|
108
|
+
|
|
109
|
+
attr_reader :dir, :manifest
|
|
110
|
+
|
|
111
|
+
# Every managed pack dir under root (one containing PACK.yml).
|
|
112
|
+
def self.each(root, fetcher: nil)
|
|
113
|
+
Dir.children(root).sort.filter_map do |name|
|
|
114
|
+
dir = File.join(root, name)
|
|
115
|
+
next unless File.directory?(dir)
|
|
116
|
+
|
|
117
|
+
manifest = PackManifest.read(dir)
|
|
118
|
+
manifest ? new(dir, manifest: manifest, fetcher: fetcher) : nil
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def initialize(dir, manifest: nil, fetcher: nil)
|
|
123
|
+
@dir = dir
|
|
124
|
+
@fetcher = fetcher || ->(url) { HttpFetch.get(url) }
|
|
125
|
+
@manifest = manifest || PackManifest.read(dir)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Latest release tag for the manifest's upstream repo.
|
|
129
|
+
def latest_version
|
|
130
|
+
self.class.latest_version(manifest.upstream_repo, fetcher: @fetcher)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def self.latest_version(repo, fetcher:)
|
|
134
|
+
PackUpstream.latest_version(repo, fetcher: fetcher)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def self.raw_icon_url(repo, tag, icon_name)
|
|
138
|
+
PackUpstream.raw_icon_url(repo, tag, icon_name)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Behind upstream when the latest release tag sorts higher than the
|
|
142
|
+
# vendored one. For non-semver tags, a different tag is treated as newer.
|
|
143
|
+
def behind?(latest = latest_version)
|
|
144
|
+
return false if latest == manifest.version
|
|
145
|
+
|
|
146
|
+
Gem::Version.new(latest) > Gem::Version.new(manifest.version)
|
|
147
|
+
rescue ArgumentError
|
|
148
|
+
latest != manifest.version
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Freshness report — pure data, the rake task owns presentation.
|
|
152
|
+
def check
|
|
153
|
+
latest = latest_version
|
|
154
|
+
{
|
|
155
|
+
"pack" => manifest.pack, "current" => manifest.version,
|
|
156
|
+
"latest" => latest, "behind" => behind?(latest),
|
|
157
|
+
"drift" => manifest.drift(dir), "missing_upstream" => manifest.missing_upstream
|
|
158
|
+
}
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Re-vendor every icon in the manifest from upstream at `tag`
|
|
162
|
+
# (default: latest release). Only fetches files whose bytes differ;
|
|
163
|
+
# icons missing upstream are kept locally and reported so a rename
|
|
164
|
+
# remains visible in PACK.yml until a maintainer resolves it.
|
|
165
|
+
def sync(tag: nil)
|
|
166
|
+
tag ||= latest_version
|
|
167
|
+
previous = manifest_snapshot
|
|
168
|
+
changed, missing = refresh_icons(tag)
|
|
169
|
+
changed.sort!
|
|
170
|
+
missing.sort!
|
|
171
|
+
manifest.capture_icons!(dir, preserve_missing: missing)
|
|
172
|
+
manifest.missing_upstream = missing
|
|
173
|
+
record_sync!(tag) if sync_changed?(tag, previous, changed)
|
|
174
|
+
sync_result(tag, changed, missing)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
private
|
|
178
|
+
|
|
179
|
+
def manifest_snapshot
|
|
180
|
+
[manifest.version, manifest.icons.dup, manifest.missing_upstream.dup]
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def sync_changed?(tag, previous, changed)
|
|
184
|
+
tag != previous[0] || !changed.empty? ||
|
|
185
|
+
manifest.icons != previous[1] || manifest.missing_upstream != previous[2]
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def record_sync!(tag)
|
|
189
|
+
manifest.version = tag
|
|
190
|
+
manifest.vendored = Time.now.utc.strftime("%Y-%m-%d")
|
|
191
|
+
manifest.write(dir)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def sync_result(tag, changed, missing)
|
|
195
|
+
{ "pack" => manifest.pack, "version" => tag, "updated" => changed,
|
|
196
|
+
"missing_upstream" => missing, "icons" => manifest.icons.size }
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def refresh_icons(tag)
|
|
200
|
+
manifest.icons.each_key.with_object([[], []]) do |name, (changed, missing)|
|
|
201
|
+
svg = fetch_icon(manifest.upstream_repo, tag, manifest.upstream_name(name))
|
|
202
|
+
if svg.nil?
|
|
203
|
+
missing << name
|
|
204
|
+
elsif write_icon?(name, svg)
|
|
205
|
+
changed << name
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def fetch_icon(repo, tag, name)
|
|
211
|
+
@fetcher.call(self.class.raw_icon_url(repo, tag, name))
|
|
212
|
+
rescue Error => e
|
|
213
|
+
return nil if e.message.start_with?("HTTP 404")
|
|
214
|
+
|
|
215
|
+
raise
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def write_icon?(name, svg)
|
|
219
|
+
raise Error, "invalid icon name: #{name.inspect}" unless PackManifest.valid_icon_name?(name)
|
|
220
|
+
|
|
221
|
+
root = File.expand_path(dir)
|
|
222
|
+
path = File.expand_path("#{name}.svg", root)
|
|
223
|
+
raise Error, "icon path escapes pack directory: #{name.inspect}" unless
|
|
224
|
+
path.start_with?("#{root}#{File::SEPARATOR}")
|
|
225
|
+
raise Error, "refusing to write through icon symlink: #{path}" if File.symlink?(path)
|
|
226
|
+
|
|
227
|
+
return false if File.file?(path) && File.binread(path) == svg
|
|
228
|
+
|
|
229
|
+
File.write(path, svg, mode: "wb")
|
|
230
|
+
true
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Command runners behind `rake icons:check` / `rake icons:sync` —
|
|
235
|
+
# pack-level logic lives in PackSync; this module owns iteration and
|
|
236
|
+
# console output so the Rakefile tasks stay one-liners.
|
|
237
|
+
module PackTasks
|
|
238
|
+
module_function
|
|
239
|
+
|
|
240
|
+
# Prints the freshness table; returns true when all packs are current.
|
|
241
|
+
def report_all?(root, fetcher: nil)
|
|
242
|
+
reports = PackSync.each(root, fetcher: fetcher).map(&:check)
|
|
243
|
+
reports.each { |report| print_check(report) }
|
|
244
|
+
issues = reports.reject { |report| current?(report) }
|
|
245
|
+
print_check_summary(issues)
|
|
246
|
+
issues.empty?
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def print_check(report)
|
|
250
|
+
marker = status_marker(report)
|
|
251
|
+
puts format("%-10<pack>s %<current>s -> %<latest>s %<marker>s",
|
|
252
|
+
pack: report["pack"], current: report["current"],
|
|
253
|
+
latest: report["latest"], marker: marker)
|
|
254
|
+
print_drift(report)
|
|
255
|
+
print_missing_upstream(report)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def current?(report)
|
|
259
|
+
!report["behind"] && report["drift"].empty? && report["missing_upstream"].empty?
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def status_marker(report)
|
|
263
|
+
return "BEHIND" if report["behind"]
|
|
264
|
+
return "current" if current?(report)
|
|
265
|
+
|
|
266
|
+
"ISSUES"
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def print_drift(report)
|
|
270
|
+
report["drift"].each do |kind, names|
|
|
271
|
+
puts " drift: #{kind} #{names.join(', ')}"
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
def print_missing_upstream(report)
|
|
276
|
+
missing = report["missing_upstream"]
|
|
277
|
+
return if missing.empty?
|
|
278
|
+
|
|
279
|
+
puts " missing upstream: #{missing.join(', ')}"
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def print_check_summary(issues)
|
|
283
|
+
if issues.empty?
|
|
284
|
+
puts "All vendored icon packs are current with no local drift."
|
|
285
|
+
else
|
|
286
|
+
packs = issues.map { |report| report["pack"] }
|
|
287
|
+
summary = "#{issues.size} pack(s) need attention: #{packs.join(', ')}"
|
|
288
|
+
puts "#{summary} — run `rake icons:sync`"
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
def sync_all(root, pack: nil, fetcher: nil)
|
|
293
|
+
packs = PackSync.each(root, fetcher: fetcher)
|
|
294
|
+
packs = packs.select { |p| p.manifest.pack == pack } if pack
|
|
295
|
+
if packs.empty?
|
|
296
|
+
abort "Unknown pack '#{pack}' (managed packs have assets/icons/<pack>/PACK.yml)"
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
packs.each { |p| print_sync(p.sync) }
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
def print_sync(result)
|
|
303
|
+
puts format("%-10<pack>s -> %<version>s (%<icons>d icons, %<updated>d updated)",
|
|
304
|
+
pack: result["pack"], version: result["version"],
|
|
305
|
+
icons: result["icons"], updated: result["updated"].size)
|
|
306
|
+
missing = result["missing_upstream"]
|
|
307
|
+
return if missing.empty?
|
|
308
|
+
|
|
309
|
+
puts " kept locally, missing upstream: #{missing.join(', ')}"
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-icon-flow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Svend Gundestrup
|
|
@@ -29,9 +29,19 @@ dependencies:
|
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
31
|
version: '5.0'
|
|
32
|
-
description:
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
description: |
|
|
33
|
+
== Pack-agnostic inline SVG icons for Jekyll
|
|
34
|
+
|
|
35
|
+
Provides per-pack icon tags (icon_lucide, icon_simple, icon_custom) and
|
|
36
|
+
icon_ref registry lookups. Each pack adapter resolves names to SVG
|
|
37
|
+
sources with the same styling contract: size:, class:, title:.
|
|
38
|
+
|
|
39
|
+
* Bundled lucide + simple-icons packs, plus custom_dir packs
|
|
40
|
+
* Named em-relative sizes that scale with surrounding text
|
|
41
|
+
* icon_ref: name intent once in the registry, swap packs globally
|
|
42
|
+
|
|
43
|
+
A companion VS Code extension (jekyll-imgflow-vscode) provides tag
|
|
44
|
+
autocomplete: https://github.com/gundestrup/jekyll-imgflow-vscode
|
|
35
45
|
email:
|
|
36
46
|
- svend@gundestrup.dk
|
|
37
47
|
executables: []
|
|
@@ -41,6 +51,7 @@ files:
|
|
|
41
51
|
- CHANGELOG.md
|
|
42
52
|
- LICENSE.txt
|
|
43
53
|
- README.md
|
|
54
|
+
- assets/icons/lucide/PACK.yml
|
|
44
55
|
- assets/icons/lucide/arrow-down.svg
|
|
45
56
|
- assets/icons/lucide/arrow-left.svg
|
|
46
57
|
- assets/icons/lucide/arrow-right.svg
|
|
@@ -71,6 +82,7 @@ files:
|
|
|
71
82
|
- assets/icons/lucide/tag.svg
|
|
72
83
|
- assets/icons/lucide/triangle-alert.svg
|
|
73
84
|
- assets/icons/lucide/x.svg
|
|
85
|
+
- assets/icons/simple/PACK.yml
|
|
74
86
|
- assets/icons/simple/bluesky.svg
|
|
75
87
|
- assets/icons/simple/discord.svg
|
|
76
88
|
- assets/icons/simple/facebook.svg
|
|
@@ -95,6 +107,8 @@ files:
|
|
|
95
107
|
- lib/jekyll/icon_flow/icon_ref_tag.rb
|
|
96
108
|
- lib/jekyll/icon_flow/icon_tag.rb
|
|
97
109
|
- lib/jekyll/icon_flow/interface.rb
|
|
110
|
+
- lib/jekyll/icon_flow/pack_manifest.rb
|
|
111
|
+
- lib/jekyll/icon_flow/pack_sync.rb
|
|
98
112
|
- lib/jekyll/icon_flow/svg_reader.rb
|
|
99
113
|
- lib/jekyll/icon_flow/version.rb
|
|
100
114
|
homepage: https://github.com/gundestrup/jekyll-icon-flow
|