sevgi-showcase 0.95.0 → 1.0.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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +221 -2
  3. data/README.md +10 -17
  4. data/lib/sevgi/showcase/dark.rb +4 -0
  5. data/lib/sevgi/showcase/minitest/script.rb +59 -57
  6. data/lib/sevgi/showcase/minitest/suite.rb +48 -46
  7. data/lib/sevgi/showcase/minitest.rb +8 -1
  8. data/lib/sevgi/showcase/version.rb +1 -1
  9. data/lib/sevgi/showcase.rb +0 -3
  10. data/srv/arc.sevgi +29 -0
  11. data/srv/arc.svg +32 -0
  12. data/srv/arc.yml +4 -0
  13. data/srv/checkers.sevgi +78 -0
  14. data/srv/checkers.svg +118 -0
  15. data/srv/clover.sevgi +19 -0
  16. data/srv/clover.svg +12 -0
  17. data/srv/clover.yml +3 -0
  18. data/srv/copperplate.sevgi +50 -0
  19. data/srv/copperplate.svg +99 -0
  20. data/srv/copperplate.yml +5 -0
  21. data/srv/gear.sevgi +25 -0
  22. data/srv/gear.svg +12 -0
  23. data/srv/gear.yml +2 -0
  24. data/srv/grid.sevgi +23 -0
  25. data/srv/{grid-cells.svg → grid.svg} +14 -1
  26. data/srv/hatch.sevgi +9 -0
  27. data/srv/hatch.svg +30 -0
  28. data/srv/hatch.yml +4 -0
  29. data/srv/heart.sevgi +17 -0
  30. data/srv/heart.svg +9 -0
  31. data/srv/heart.yml +3 -0
  32. data/srv/logo.sevgi +39 -0
  33. data/srv/logo.svg +30 -0
  34. data/srv/logo.yml +4 -0
  35. data/srv/logos.sevgi +34 -0
  36. data/srv/logos.svg +39 -0
  37. data/srv/logos.yml +4 -0
  38. data/srv/meter.sevgi +20 -0
  39. data/srv/meter.svg +19 -0
  40. data/srv/orb.sevgi +14 -0
  41. data/srv/orb.svg +11 -0
  42. data/srv/orb.yml +4 -0
  43. data/srv/pacman.sevgi +18 -0
  44. data/srv/pacman.svg +16 -0
  45. data/srv/pokey.sevgi +14 -0
  46. data/srv/{pacman-pokey.svg → pokey.svg} +1 -3
  47. data/srv/protractor.sevgi +40 -0
  48. data/srv/protractor.svg +605 -0
  49. data/srv/ruler.sevgi +61 -0
  50. data/srv/ruler.svg +445 -0
  51. data/srv/{snow-flake.sevgi → snowflake.sevgi} +3 -3
  52. data/srv/{snow-flake.svg → snowflake.svg} +3 -2
  53. data/srv/snowflake.yml +2 -0
  54. data/srv/squared.sevgi +42 -0
  55. data/srv/squared.svg +71 -0
  56. data/srv/squared.yml +4 -0
  57. data/srv/stars.sevgi +19 -0
  58. data/srv/stars.svg +31 -0
  59. data/srv/stars.yml +3 -0
  60. data/srv/tulips.sevgi +27 -0
  61. data/srv/tulips.svg +20 -0
  62. data/srv/tulips.yml +3 -0
  63. metadata +66 -37
  64. data/lib/sevgi/showcase/minitest/shell.rb +0 -166
  65. data/srv/checker-board.sevgi +0 -96
  66. data/srv/checker-board.svg +0 -117
  67. data/srv/gear-wheel.sevgi +0 -27
  68. data/srv/gear-wheel.svg +0 -12
  69. data/srv/gear-wheel.yml +0 -3
  70. data/srv/grid-cells.sevgi +0 -24
  71. data/srv/heart-mask.sevgi +0 -17
  72. data/srv/heart-mask.svg +0 -8
  73. data/srv/heart-mask.yml +0 -3
  74. data/srv/meter-face.sevgi +0 -20
  75. data/srv/meter-face.svg +0 -13
  76. data/srv/pacman-pokey.sevgi +0 -17
  77. data/srv/pacman-single.sevgi +0 -17
  78. data/srv/pacman-single.svg +0 -14
  79. data/srv/ruler-hline.sevgi +0 -55
  80. data/srv/ruler-hline.svg +0 -443
  81. data/srv/ruler-line.sevgi +0 -52
  82. data/srv/ruler-line.svg +0 -443
  83. data/srv/snow-flake.yml +0 -1
  84. /data/srv/{checker-board.yml → checkers.yml} +0 -0
  85. /data/srv/{grid-cells.yml → grid.yml} +0 -0
  86. /data/srv/{meter-face.yml → meter.yml} +0 -0
  87. /data/srv/{pacman-pokey.yml → pacman.yml} +0 -0
  88. /data/srv/{pacman-single.yml → pokey.yml} +0 -0
  89. /data/srv/{ruler-hline.yml → protractor.yml} +0 -0
  90. /data/srv/{ruler-line.yml → ruler.yml} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3b056b346721f8c0dc42b08402803516bb6890e5999a399acf083842c5ad1f4
4
- data.tar.gz: 475358290666f23737aaef97a31efbb31fa96548843eeecf03cd9c2fba55c2a6
3
+ metadata.gz: eecc3014d3bbf6524c0c30eed7632c3414de707442fa4c89a38b151cea344696
4
+ data.tar.gz: 7d8bf35039daedc891b88f55a32e622eee708c9af0350f7940d83826207e6634
5
5
  SHA512:
6
- metadata.gz: 0fb1f3bc3a07900c83d3c3e32b916ac9ad87d38eb4c9b28e564ceafabae362353adf3b62c3ad93185e4b7846a0c1ef797b949dc3487c6d21025742255c755c69
7
- data.tar.gz: f0a0169c177354f9ffcc3982f54c7873e0ab1d78577989dee603bcb40ca6ecc0fa2eb36ea60c91a8fab906a21a8b7f0991dbe012942237e80236e283dd640b5d
6
+ metadata.gz: 808da584d85c10cf7cb4587afdd1451b3d83accfc1b76c06b961680085d9ccbcdc5a0b2800bbc5ac2d16b92218b23e45076a15b9e2af0c8e979ddb11fe11ffd6
7
+ data.tar.gz: bbff818a26174051d81fdba11f7b4ba031a9dead679b7d31d0daf030b975a818e08bd36165e54c9636b467614dfbb33964684a45157556aa080b03bbf387e9a7
data/CHANGELOG.md CHANGED
@@ -3,7 +3,226 @@
3
3
  This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
- ## Unreleased
6
+ ## 1.0.0 - 2026-09-16
7
+
8
+ ### Added
9
+
10
+ - Added Hatch and Orb Showcase examples and displayed both arc lengths in the Arc example.
11
+
12
+ ### Changed
13
+
14
+ - Matched documentation page widths to the homepage Showcase.
15
+ - Aligned Derender user guidance with UTF-8 normalization and safe subtree selection rules.
16
+ - Clarified the packaged skill's script invocation, subtree copying, and Derender selection and encoding rules.
17
+ - Allowed Canvas and Paper values as the first `SVG` argument when using the default document profile.
18
+ - Made element `dup` and `clone` own independent subtrees while retaining IDs and Ruby copy semantics.
19
+ - Made Segment equality compare length and direction; ordering still compares length only.
20
+ - Limited Tile cell, row, and column queries to the requested geometry and accelerated XML character validation.
21
+ - Simplified the first-run guide and aligned library constructor examples.
22
+ - Updated the packaged skill for canvas origins, alignment, Paper lookup, curved geometry, and export constraints.
23
+ - Revised DSL catalog examples and packaged Sevgi skill guidance to use statement-style calls and show inspection results.
24
+ - Refined Showcase example tabs, made Ruby and XML views fill their panels, and hid executable preambles from Ruby views.
25
+ - Documented non-rendering element data and clarified the related DSL catalog examples.
26
+ - Refined Showcase heading spacing, page-title colors, and DSL catalog cards across light and dark themes.
27
+ - Removed an obsolete ruler example and unused site code.
28
+ - Kept the Squared and Copperplate guidesheet examples together at the end of the Showcase.
29
+ - Updated the packaged skill to avoid duplicate semantic shapes and unnecessary paint passes.
30
+
31
+ ### Fixed
32
+
33
+ - Kept horizontal scrollbars visible in Showcase example code panels.
34
+ - Read Derender input in its declared XML encoding and normalized generated source, XML declarations, and markup to UTF-8.
35
+ - Preserved open-path endpoints and derived edges independently of display precision.
36
+ - Kept near-axis and near-parallel line equations and intersections independent of angle and slope rounding.
37
+ - Corrected the Showcase social image dimensions.
38
+ - Added SVG namespaces to standalone drawing examples and regenerated their outputs.
39
+ - Made failed Sevgi Rake tasks stop dependent tasks and captured required-library failures in executor results.
40
+ - Removed executor signal-handler replacement so the host and shell retain SIGINT ownership.
41
+ - Escaped late export CSS as XML text and inserted it only at a supported final root closing tag.
42
+ - Preserved Derender processing instructions and rejected custom entity references and unsupported trailing document nodes before inclusion.
43
+ - Included both box origins in `Align`, unified Tile index validation, and isolated custom numeric attribute snapshots.
44
+ - Prevented avoidable overflow and underflow in point distances.
45
+ - Corrected browser source-panel expectations and added executable documentation, YARD, and packaged-skill checks.
46
+ - Rendered inline code in DSL catalog summaries and kept linked task themes visible below the sticky header.
47
+ - Restored Showcase tab icons with embedded Font Awesome SVGs.
48
+
49
+ ## 0.100.0 - 2026-09-09
50
+
51
+ ### Added
52
+
53
+ - Added `ArcTo` and `ArcBy` for SVG-native elliptical arc paths.
54
+ - Added Geometry `Arc`, `Ellipse`, and `Circle` with bounds, length, predicates, affine transformations, and
55
+ linear/quadratic intersections. Closed ellipses and circles support sweeps and hatching.
56
+ - Added Geometry `Point.midpoint`, `Element#closed?`, lined `vertices`, open-path traversal, and `Rect#center`.
57
+ - Added Geometry aggregate bounding boxes through `Operation.box`, point collinearity through `Point.collinear?`, and
58
+ polygon `simple?`, `convex?`, and `concave?` predicates.
59
+ - Added Protractor and Arc examples and documented the drawing and calculation APIs.
60
+
61
+ ### Changed
62
+
63
+ - Removed redundant parent scans while duplicating element subtrees.
64
+ - Reused source bounds across Tile cells to reduce repeated calculations and object allocations.
65
+
66
+ ### Fixed
67
+
68
+ - Preserved Showcase card HTML through Markdown rendering so all examples and their tabs remain visible.
69
+ - Preserved XML declarations, pre-root comments, CDATA sections, inline comments, and namespace-only leaves in
70
+ Derender output and evaluation.
71
+ - Limited PDF stamp recoloring to replaced text and carried graphics state across a page's content streams.
72
+ - Corrected decimal interval fitting and made Grid point queries honor the active numeric precision.
73
+ - Prevented implicit shell interpretation of single executable arguments in `F.sh` and `F.sh!`, including paths with spaces or shell metacharacters.
74
+ - Preserved inherited namespaces on detached Derender nodes in generated source and direct evaluation, including imports through `EvaluateChildren` and `IncludeChildren`.
75
+ - Prevented sweep and Hatch lines from crossing the exterior between two tangent vertices of a concave polygon.
76
+ - Aligned Tile cells with their declared bounds for circles, rotated shapes, and polygons whose first vertex differs from their bounding-box origin.
77
+ - Limited `Load` chains to 128 active sources with `Executor::LoadDepthError`, preserving cycle detection and nested load diagnostics.
78
+ - Rejected nil and false aggregate-box inputs with the documented geometry error.
79
+ - Restored precision-aware rejection of zero-length Triangle sides.
80
+ - Made point-set collinearity independent of input order and removed eager polygon edge-pair storage.
81
+ - Applied the collinearity tolerance to every three-point subset, removing coordinate-axis-dependent baseline selection.
82
+
83
+ ## 0.99.0 - 2026-08-09
84
+
85
+ ### Added
86
+
87
+ - Added `SVG.Module` for building anonymous callable drawing modules with their contract installed before definition.
88
+ - Added responsive Mermaid diagrams for the Derender round trip and SVG validation lifecycle.
89
+
90
+ ### Changed
91
+
92
+ - Reorganized the documentation around getting started, usage, composition, documents, layout, output, and examples.
93
+ - Documented how the `igves` and `igsev` command names reflect their conversion directions.
94
+ - Normalized DSL catalog provider labels to lowercase and simplified polyfill-backed editor entries to `inkscape`.
95
+
96
+ ### Fixed
97
+
98
+ - Allowed A5-on-A4 pdfcpu conversion to replace an existing output file.
99
+ - Pre-rendered Mermaid diagrams as inline SVG instead of parsing them in site visitors' browsers.
100
+ - Removed duplicate provider and context labels from DSL catalog entries.
101
+
102
+ ## 0.98.2 - 2026-07-25
103
+
104
+ ### Fixed
105
+
106
+ - Restored the `sevgi` CLI's main-object scope so bare toolkit calls remain available inside script helper classes.
107
+
108
+ ## 0.98.1 - 2026-07-20
109
+
110
+ ### Changed
111
+
112
+ - Changed the `sevgi` CLI to use the executor's isolated scope by default.
113
+
114
+ ### Removed
115
+
116
+ - Removed the redundant `-n` and `--nomain` CLI options; library consumers can still select `main: true` through
117
+ `Sevgi.execute` and `Sevgi.execute_file` when needed.
118
+
119
+ ## 0.98.0 - 2026-07-20
120
+
121
+ ### Added
122
+
123
+ - Added standard-input support to `sevgi`, `igves`, and `igsev`; `sevgi --as NAME` and
124
+ `Sevgi.execute_file(..., as: NAME)` supply the logical source basename used by implicit SVG, PDF, and PNG
125
+ destinations without changing physical load identity.
126
+
127
+ ## 0.97.0 - 2026-07-19
128
+
129
+ ### Added
130
+
131
+ - Added `sevgi-appendix`, containing the Sevgi agent skill and a RuboCop plugin for preserving readable `.sevgi` DSL
132
+ source alongside rubyfmt-formatted Ruby; the umbrella `sevgi` gem installs the matching Appendix version.
133
+ - Added `sevgi --skill` to report the validated path of the matching packaged agent skill for product-neutral setup.
134
+ - Added `igsev` to the umbrella gem for normalizing an SVG file through a complete SVG-to-Sevgi-to-SVG round trip.
135
+
136
+ ### Changed
137
+
138
+ - Made Homebrew the recommended complete CLI installation while retaining Bundler and focused component gems for Ruby
139
+ application dependencies.
140
+
141
+ ## 0.96.0 - 2026-07-18
142
+
143
+ ### Added
144
+
145
+ - Added exact, subtree-wide attribute omission to Derender content/file conversion, evaluation, and inclusion APIs;
146
+ `igves --omit` exposes the same behavior from the command line.
147
+ - Added `Sevgi.SVG` as the explicit namespaced form of the top-level SVG document entrypoint.
148
+ - Added the opt-in recursive `SVG::Modules` contract for callable drawing namespaces.
149
+ - Added callable drawing-module `base` blocks, document and paper registry introspection, Canvas structural equality,
150
+ renderer options on `RenderChildren`, axis translation helpers, and a CC BY RDF helper.
151
+ - Formalized non-rendering `-` metadata and `+` attribute updates as `Attributes::META_PREFIX` and
152
+ `Attributes::UPDATE_SUFFIX`; repeated Array updates now concatenate into a stable flat value.
153
+
154
+ ### Changed
155
+
156
+ - Breaking: replaced the `SVG = Sevgi::Graphics` alias with an independent SVG facade. Facade operations now use
157
+ capitalized names such as `SVG.Canvas` and `SVG.Document`; lowercase component helpers remain on
158
+ `Sevgi::Graphics`, and the stuttering `SVG.SVG` form was removed.
159
+ - Breaking: made low-level `Executor.execute` and `execute_file` runners private; consumers use
160
+ `Sevgi.execute` and `Sevgi.execute_file` while retaining the public result and error types.
161
+ - Breaking: removed the abstract `Document::Base` layer from the selectable document-profile registry; `Minimal` and
162
+ `Default` are now sibling concrete profiles, and custom profile hierarchies should derive from `Base`.
163
+ - Breaking: renamed Parallelogram segment and constraint arguments by geometric role: `base`, `side`, and
164
+ `constraint` replace axis-implying constructor names.
165
+ - Made degree-based sine and cosine exact at integer quarter turns, eliminating cardinal Geometry residue.
166
+ - Documented complete file-system failure families for file comparison, output, touch, and upward location helpers.
167
+ - Formalized generated Tile ids, positional CSS classes, template placement, and per-use callback signatures.
168
+ - Formalized String and Symbol ids across Derender selection APIs and documented file-read failures consistently.
169
+ - Breaking: made top-level `Decompile`, `Derender`, `Evaluate`, and `EvaluateChildren` consume inline SVG/XML;
170
+ file inputs now use the corresponding `File`-suffixed entrypoints.
171
+ - Breaking: replaced callable drawing module `call` block registration with argument-independent `base` blocks;
172
+ inherited bases run parent-first, and modules with one drawing method conventionally name it `call`.
173
+ - Breaking: made bracket and call notation the canonical Geometry constructors. Among Data value types, bracket notation
174
+ is public only for Point, Segment, LengthAngle, Margin, and Paper; use `.new` for Location and result carriers, and
175
+ `Stay` for traversal stop tokens.
176
+ - Breaking: aligned Point and Segment comparison with Ruby `Comparable`; malformed or unrelated comparison operands now
177
+ return nil from `<=>`.
178
+ - Breaking: executor entrypoints now return immutable `Executor::Result` values and expose only `execute` and
179
+ `execute_file`; inspect `result.error`, `result.stack`, and `result.value` instead of executor scopes or lifecycle state.
180
+ - Breaking: wrapper attributes and callable arguments use distinct channels, `With` rejects parentless receivers, and
181
+ unsupported direct constructors are private; use the documented factories for Content, concrete Geometry lined
182
+ elements, and Grid query values.
183
+ - Breaking: Canvas uses `.new` for explicit fields, `.from_paper(paper, **overrides)` for paper conversion, and
184
+ `.call`/`Graphics.canvas` for dispatch; the misleading keyword-only `.from_paper(width:, height:)` form was removed.
185
+ - Breaking: `Save`, `Write`, `PNG`, `PDF`, and Sundries native export normalize successful destinations to expanded
186
+ String paths and create missing parent directories; change-aware SVG writes still return nil when unchanged.
187
+ - Breaking: renamed `Derender.evaluate_file_children` to `evaluate_children_file`; decompiled nodes now own immutable
188
+ public state while parser, strategy, and construction plumbing remain private.
189
+ - Expanded runtime/YARD parity checks and exact contracts for inherited, extended, generated, and dynamic API surfaces,
190
+ forwarded options, error channels, path ownership, whitespace, namespaces, nil behavior, and return values.
191
+
192
+ ### Fixed
193
+
194
+ - Rejected directories from default file discovery while preserving custom locator matchers.
195
+ - Kept `Ancestral` context in non-rendering `-context` metadata instead of leaking it into SVG attributes.
196
+ - Preserved source Canvas units and names when deriving fitted Grid canvases.
197
+ - Prevented stale documentation assets from mixing old layouts with new HTML, and moved sidebar navigation into the
198
+ tablet menu at 1024px and below.
199
+ - Normalized numeric slots owned by path, shape, transform, tile, and Inkscape page helpers to finite SVG number spelling;
200
+ arbitrary user-supplied attributes remain untouched.
201
+ - Made named callable wrapper and symbol ids stable while omitting defaults for anonymous modules, and indexed every
202
+ rendered id value, including false and numeric values, through its serialized string.
203
+ - Preserved signed Geometry constraint directions, rejected invalid sweep/export channels through Sevgi error families,
204
+ and validated raw output paths before expansion or rendering.
205
+ - Made callable module configuration copy-owned and freeze-aware, document subclasses inherit their nearest profile, and
206
+ false executor boot receivers remain explicit rather than defaulting to an internal scope.
207
+ - Made element trees, attributes, identifiers, locator results, document profiles, Derender nodes, shell results, and
208
+ executor results retain owned immutable snapshots where their public contracts promise value semantics.
209
+ - Corrected Shell combined-output separators, nil export density errors, document render-option routing, executor source
210
+ snapshots, selected-node namespace/whitespace documentation, and Standard character-data validation.
211
+
212
+ ### Removed
213
+
214
+ - Removed public access to pluralization tables and the internal SVG save extension; pluralization rules are now deeply
215
+ immutable.
216
+ - Removed public documentation and constant access for command-line implementation modules; the `sevgi` and `igves`
217
+ executables remain unchanged.
218
+ - Removed eager loading and public documentation of private Showcase build/test support; explicit support entrypoints
219
+ now keep the harness under the Showcase namespace.
220
+ - Removed public access to document profile name normalizers; registry operations retain them as private plumbing.
221
+ - Removed the redundant `Margin.margin` constructor; use canonical bracket notation.
222
+ - Removed public executor orchestration, obsolete callable-module hooks, the old public attribute syntax constants, and
223
+ direct construction of abstract or internally wired Content, Element, and Grid query types.
224
+ - Removed accidental public access to abstract Lined factories, internal element-name/export maps, result/location
225
+ bracket constructors, and direct Stop construction.
7
226
 
8
227
  ## 0.95.0 - 2026-07-11
9
228
 
@@ -87,7 +306,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
87
306
 
88
307
  ### Changed
89
308
 
90
- - Added the checker board example to the documentation showcase flow.
309
+ - Added the checkerboard example to the documentation showcase flow.
91
310
  - Consolidated Victor Book attribution for adapted showcase examples into a single documentation note.
92
311
 
93
312
  ### Fixed
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Sevgi Showcase
2
2
 
3
- Executable examples, rendered outputs, and documentation-site support.
3
+ Sevgi Showcase packages the executable examples, their SVG output, and support code for the documentation site.
4
4
 
5
5
  ## Install
6
6
 
@@ -8,22 +8,15 @@ Executable examples, rendered outputs, and documentation-site support.
8
8
  gem install sevgi-showcase
9
9
  ```
10
10
 
11
- ## Require
11
+ ## Contents
12
12
 
13
- ```ruby
14
- require "sevgi/showcase"
15
- ```
16
-
17
- ## Example
18
-
19
- ```ruby
20
- suite = Sevgi::Test::Suite.new("srv")
21
- suite.valids.map(&:name)
22
- ```
13
+ The gem is an asset package rather than a runtime API. It contains executable `.sevgi` examples and their expected SVG
14
+ output. It also contains private build support for the documentation site. The test suite runs each example and
15
+ compares its output.
23
16
 
24
17
  ## Ruby compatibility
25
18
 
26
- Requires Ruby 3.4.0 or newer. CI verifies Ruby 3.4.0 and the current development Ruby from `.ruby-version`.
19
+ Requires Ruby 3.4.0 or newer. CI verifies the current Ruby 3.4 release and the development Ruby from `.ruby-version`.
27
20
 
28
21
  ## Native prerequisites
29
22
 
@@ -47,7 +40,7 @@ gem install cairo rsvg2 hexapdf
47
40
 
48
41
  ## Links
49
42
 
50
- - Documentation: https://sevgi.roktas.dev
51
- - API documentation: https://www.rubydoc.info/gems/sevgi-showcase
52
- - Source: https://github.com/roktas/sevgi/tree/main/showcase
53
- - Changelog: https://github.com/roktas/sevgi/blob/main/CHANGELOG.md
43
+ - Documentation: <https://sevgi.roktas.dev>
44
+ - API documentation: <https://www.rubydoc.info/gems/sevgi-showcase>
45
+ - Source: <https://github.com/roktas/sevgi/tree/main/showcase>
46
+ - Changelog: <https://github.com/roktas/sevgi/blob/main/CHANGELOG.md>
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../showcase"
4
+
3
5
  module Sevgi
4
6
  module Showcase
5
7
  # Applies dark-theme color mappings to showcase source files.
@@ -60,5 +62,7 @@ module Sevgi
60
62
  end
61
63
  end
62
64
  end
65
+
66
+ private_constant :Dark
63
67
  end
64
68
  end
@@ -1,78 +1,80 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sevgi
4
- # Minitest helpers used by the showcase component.
5
- # @api private
6
- module Test
7
- # Executable showcase script descriptor.
4
+ module Showcase
5
+ # Minitest helpers used by the showcase component.
8
6
  # @api private
9
- class Script
10
- # @return [String] absolute script path
11
- attr_reader :file
7
+ module Test
8
+ # Executable showcase script descriptor.
9
+ # @api private
10
+ class Script
11
+ # @return [String] absolute script path
12
+ attr_reader :file
12
13
 
13
- # Creates a script descriptor.
14
- # @param file [String] executable .sevgi file
15
- # @return [void]
16
- # @raise [Sevgi::ArgumentError] when the file is missing or not executable
17
- def initialize(file) = @file = ::File.expand_path(sanitize(file))
14
+ # Creates a script descriptor.
15
+ # @param file [String] executable .sevgi file
16
+ # @return [void]
17
+ # @raise [Sevgi::ArgumentError] when the file is missing or not executable
18
+ def initialize(file) = @file = ::File.expand_path(sanitize(file))
18
19
 
19
- # Returns the script directory.
20
- # @return [String]
21
- def dir = @dir ||= ::File.dirname(file)
20
+ # Returns the script directory.
21
+ # @return [String]
22
+ def dir = @dir ||= ::File.dirname(file)
22
23
 
23
- # Returns the script basename.
24
- # @return [String]
25
- def file! = ::File.basename(file)
24
+ # Returns the script basename.
25
+ # @return [String]
26
+ def file! = ::File.basename(file)
26
27
 
27
- # Returns the script name without extension.
28
- # @return [String]
29
- def name = @name ||= ::File.basename(file, ".*")
28
+ # Returns the script name without extension.
29
+ # @return [String]
30
+ def name = @name ||= ::File.basename(file, ".*")
30
31
 
31
- # @overload run(*args)
32
- # Runs the script directly.
33
- # @param args [Array<String>] extra command arguments
34
- # @return [Sevgi::Test::Shell::Result]
35
- def run(*) = Shell.run(file, *)
32
+ # @overload run(*args)
33
+ # Runs the script directly.
34
+ # @param args [Array<String>] extra command arguments
35
+ # @return [Sevgi::Function::Shell::Result]
36
+ def run(*) = F.sh(file, *)
36
37
 
37
- # Returns the script suite name.
38
- # @return [String]
39
- def suite = @suite ||= ::File.basename(dir)
38
+ # Returns the script suite name.
39
+ # @return [String]
40
+ def suite = @suite ||= ::File.basename(dir)
40
41
 
41
- # Reports whether the expected SVG output exists.
42
- # @return [Boolean]
43
- def svg? = ::File.exist?(svg)
42
+ # Reports whether the expected SVG output exists.
43
+ # @return [Boolean]
44
+ def svg? = ::File.exist?(svg)
44
45
 
45
- # Returns the expected SVG output path.
46
- # @return [String]
47
- def svg = @svg ||= ::File.expand_path("#{dir}/#{name}.svg")
46
+ # Returns the expected SVG output path.
47
+ # @return [String]
48
+ def svg = @svg ||= ::File.expand_path("#{dir}/#{name}.svg")
48
49
 
49
- # Returns the expected SVG output basename.
50
- # @return [String]
51
- def svg! = ::File.basename(svg)
50
+ # Returns the expected SVG output basename.
51
+ # @return [String]
52
+ def svg! = ::File.basename(svg)
52
53
 
53
- # Returns the optional YAML metadata path.
54
- # @return [String]
55
- def yml = @yml ||= ::File.expand_path("#{dir}/#{name}.yml")
54
+ # Returns the optional YAML metadata path.
55
+ # @return [String]
56
+ def yml = @yml ||= ::File.expand_path("#{dir}/#{name}.yml")
56
57
 
57
- # Returns the optional YAML metadata basename.
58
- # @return [String]
59
- def yml! = ::File.basename(yml)
58
+ # Returns the optional YAML metadata basename.
59
+ # @return [String]
60
+ def yml! = ::File.basename(yml)
60
61
 
61
- # @overload run_passive(*args)
62
- # Runs the script without writing Save output to files.
63
- # @param args [Array<String>] extra command arguments
64
- # @return [Sevgi::Test::Shell::Result]
65
- def run_passive(*)
66
- warn("...#{name}")
67
- Shell.run("sevgi", "-r", "sevgi/showcase/passive", file, *)
68
- end
62
+ # @overload run_passive(*args)
63
+ # Runs the script without writing Save output to files.
64
+ # @param args [Array<String>] extra command arguments
65
+ # @return [Sevgi::Function::Shell::Result]
66
+ def run_passive(*)
67
+ warn("...#{name}")
68
+ F.sh("sevgi", "-r", "sevgi/showcase/passive", file, *)
69
+ end
69
70
 
70
- private
71
+ private
71
72
 
72
- def sanitize(file)
73
- file.tap do
74
- ArgumentError.("No such file: #{file}") unless ::File.exist?(file)
75
- ArgumentError.("Not an executable: #{file}") unless ::File.executable?(file)
73
+ def sanitize(file)
74
+ file.tap do
75
+ ArgumentError.("No such file: #{file}") unless ::File.exist?(file)
76
+ ArgumentError.("Not an executable: #{file}") unless ::File.executable?(file)
77
+ end
76
78
  end
77
79
  end
78
80
  end
@@ -1,53 +1,55 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sevgi
4
- # Minitest helpers used by the showcase component.
5
- # @api private
6
- module Test
7
- # Showcase script suite collection.
4
+ module Showcase
5
+ # Minitest helpers used by the showcase component.
8
6
  # @api private
9
- class Suite
10
- # Creates a suite from a showcase root directory.
11
- # @param rootdir [String] showcase root directory
12
- # @return [void]
13
- def initialize(rootdir)
14
- @scripts = load(rootdir)
15
- end
16
-
17
- # Returns scripts belonging to a suite.
18
- # @param suite [String, Symbol] suite name
19
- # @return [Array<Sevgi::Test::Script>]
20
- def [](suite)
21
- (@cache ||= {})[suite] ||= @scripts.select { |script| script.suite == suite.to_s }
22
- end
23
-
24
- # Returns all suite names.
25
- # @return [Array<String>]
26
- def suites
27
- @suites ||= @scripts.map(&:suite).uniq
28
- end
29
-
30
- # Suite names that are expected to be invalid examples.
31
- NON_VALIDS = ["gotcha"].freeze
32
-
33
- # Returns scripts expected to be invalid.
34
- # @return [Array<Sevgi::Test::Script>]
35
- def non_valids
36
- NON_VALIDS.map { self[it] }.flatten
37
- end
38
-
39
- # Returns scripts expected to render successfully.
40
- # @return [Array<Sevgi::Test::Script>]
41
- def valids
42
- suites.reject { NON_VALIDS.include?(it) }.map { self[it] }.flatten
43
- end
44
-
45
- alias to_a valids
46
-
47
- private
48
-
49
- def load(rootdir)
50
- ::Dir["#{rootdir}/**/*.sevgi"].grep_v(%r{(/_|/lib/|/library/)}).map { Script.new(it) }
7
+ module Test
8
+ # Showcase script suite collection.
9
+ # @api private
10
+ class Suite
11
+ # Creates a suite from a showcase root directory.
12
+ # @param rootdir [String] showcase root directory
13
+ # @return [void]
14
+ def initialize(rootdir)
15
+ @scripts = load(rootdir)
16
+ end
17
+
18
+ # Returns scripts belonging to a suite.
19
+ # @param suite [String, Symbol] suite name
20
+ # @return [Array<Sevgi::Showcase::Test::Script>]
21
+ def [](suite)
22
+ (@cache ||= {})[suite] ||= @scripts.select { |script| script.suite == suite.to_s }
23
+ end
24
+
25
+ # Returns all suite names.
26
+ # @return [Array<String>]
27
+ def suites
28
+ @suites ||= @scripts.map(&:suite).uniq
29
+ end
30
+
31
+ # Suite names that are expected to be invalid examples.
32
+ NON_VALIDS = ["gotcha"].freeze
33
+
34
+ # Returns scripts expected to be invalid.
35
+ # @return [Array<Sevgi::Showcase::Test::Script>]
36
+ def non_valids
37
+ NON_VALIDS.map { self[it] }.flatten
38
+ end
39
+
40
+ # Returns scripts expected to render successfully.
41
+ # @return [Array<Sevgi::Showcase::Test::Script>]
42
+ def valids
43
+ suites.reject { NON_VALIDS.include?(it) }.map { self[it] }.flatten
44
+ end
45
+
46
+ alias to_a valids
47
+
48
+ private
49
+
50
+ def load(rootdir)
51
+ ::Dir["#{rootdir}/**/*.sevgi"].grep_v(%r{(/_|/lib/|/library/)}).map { Script.new(it) }
52
+ end
51
53
  end
52
54
  end
53
55
  end
@@ -1,5 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "sevgi/function"
4
+
3
5
  require_relative "minitest/script"
4
- require_relative "minitest/shell"
5
6
  require_relative "minitest/suite"
7
+
8
+ module Sevgi
9
+ module Showcase
10
+ private_constant :Test
11
+ end
12
+ end
@@ -4,6 +4,6 @@ module Sevgi
4
4
  # Showcase component namespace.
5
5
  module Showcase
6
6
  # Current showcase component version.
7
- VERSION = "0.95.0"
7
+ VERSION = "1.0.0"
8
8
  end
9
9
  end
@@ -2,7 +2,4 @@
2
2
 
3
3
  require "sevgi"
4
4
 
5
- require_relative "showcase/dark"
6
- require_relative "showcase/minitest"
7
-
8
5
  require_relative "showcase/version"
data/srv/arc.sevgi ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ SVG :inkscape, width: "150mm", height: "100mm", viewBox: "0 0 150 100" do
5
+ ellipse = Geometry::Ellipse[70, 40, position: [75, 50], rotation: -15]
6
+ arc = ellipse.arc starting_angle: 180, extent: 210
7
+ remainder = ellipse.arc starting_angle: arc.starting_angle, extent: arc.extent - 360
8
+
9
+ g fill: "none", stroke: "slategray", "stroke-width": 0.3, "stroke-dasharray": "2 2" do
10
+ Draw remainder, id: "arc-remainder"
11
+ Draw arc.box
12
+ end
13
+
14
+ Draw arc, id: "arc-route", fill: "none", stroke: "purple", "stroke-width": 1
15
+
16
+ text dy: 7, fill: "black", "font-family": "monospace", "font-size": 5 do
17
+ textPath arc.length.round(1).to_s, href: "#arc-route", startOffset: "50%", "text-anchor": "middle"
18
+ end
19
+
20
+ text dy: -4, fill: "slategray", "font-family": "monospace", "font-size": 5 do
21
+ textPath remainder.length.round(1).to_s, href: "#arc-remainder", startOffset: "50%", "text-anchor": "middle"
22
+ end
23
+
24
+ [arc.starting, arc.reverse.starting].each do |point|
25
+ circle cx: point.x, cy: point.y, r: 1.5, fill: "purple"
26
+ end
27
+
28
+ circle cx: arc.center.x, cy: arc.center.y, r: 1, fill: "black"
29
+ end.Save
data/srv/arc.svg ADDED
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ xmlns:_="http://sevgi.roktas.dev"
5
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
6
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
7
+ shape-rendering="crispEdges"
8
+ width="150mm"
9
+ height="100mm"
10
+ viewBox="0 0 150 100"
11
+ >
12
+ <g fill="none" stroke="slategray" stroke-width="0.3" stroke-dasharray="2 2">
13
+ <path id="arc-remainder" d="M 7.385192159765225 68.11733315717646 A 70 40 -15 0 0 138.73252216369696 53.62844576284043"/>
14
+ <rect x="6.597208" y="7.326143" width="136.805584" height="60.79119"/>
15
+ </g>
16
+ <path
17
+ id="arc-route"
18
+ d="M 7.385192159765225 68.11733315717646 A 70 40 -15 1 1 138.73252216369696 53.62844576284043"
19
+ fill="none"
20
+ stroke="purple"
21
+ stroke-width="1"
22
+ />
23
+ <text dy="7" fill="black" font-family="monospace" font-size="5">
24
+ <textPath href="#arc-route" startOffset="50%" text-anchor="middle">198.7</textPath>
25
+ </text>
26
+ <text dy="-4" fill="slategray" font-family="monospace" font-size="5">
27
+ <textPath href="#arc-remainder" startOffset="50%" text-anchor="middle">153.3</textPath>
28
+ </text>
29
+ <circle cx="7.385192159765225" cy="68.11733315717646" r="1.5" fill="purple"/>
30
+ <circle cx="138.73252216369696" cy="53.62844576284043" r="1.5" fill="purple"/>
31
+ <circle cx="75.0" cy="50.0" r="1" fill="black"/>
32
+ </svg>