beni 0.6.1 → 0.8.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: 6d001f425802e3d32f1925d39b91e25caa45f1f31ac10ec431d8346c9375225b
4
- data.tar.gz: 57c6d9b1ee5681cfd525ece65d7aeeec42c6357f2676e32f4e1c7e88bd7dbc44
3
+ metadata.gz: af4d22558f53ff721de45bd8015986b1e61d4ece2746d15881026eeefb21114a
4
+ data.tar.gz: f0d789174989baa91dfc4af2e3ecc04eaed2fc6e7ddcd71f2ee6e6b6ab6a8964
5
5
  SHA512:
6
- metadata.gz: c0ec83a8dd9f54de098411fccffe8c6c0d376508871b63e7af60fc67499fee987356ff57f1d302a50cde01617658cbe88ba8b037ad83ad9ef8e930f3dd1746c4
7
- data.tar.gz: 75e2f50847288286e67752e1a2535efb729f84a13a3528b61074d509cea511914fb1c81cf94c10f83d563d3fb28e779a39d3fdc592237f0bb6f92c1e161db361
6
+ metadata.gz: e0c75f6e38ac92ea98228eb6fb2baad43ae0b87aac9fc5b5d983fb081f46cdb040bdbaba9f54daca482ae7c7c9683750f0c0703873a009e7ed21d1365dfcbd1d
7
+ data.tar.gz: cf493a1aa4b9580d767580876d83a1befce9107101f7e90dfc1554367eca55c4780928f3a44f66091ac0c5e59b16151c8e88d49151ad145ce1434d8f99c282cf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,140 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.0](https://github.com/elct9620/beni/compare/v0.7.0...v0.8.0) (2026-06-21)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **beni:** the six symbol-name reads now return owned values — Mrb::sym_name / Symbol::name and Mrb::sym_dump / Symbol::dump return Option<String>, Mrb::sym_name_len / Symbol::name_bytes return Option<Vec<u8>>, where each previously returned a borrowed &'static str or &'static [u8].
9
+ * **beni:** `RClass::data_wrap` returns `Result<Value, Error>` instead of `Value`. Correct use against a marked class yields `Ok`; an unmarked class yields `Err` with the unwrapped value reclaimed.
10
+
11
+ ### Features
12
+
13
+ * **api:** rank ungraduated C API by mrbgems usage ([81b2125](https://github.com/elct9620/beni/commit/81b21255f7e14d3f25c17a1ec0e79a00c08b85cb))
14
+ * **beni:** accept a symbol-or-name key for value dispatch ([e70eacb](https://github.com/elct9620/beni/commit/e70eacba390bd712d89e2f5f271e35114e478529))
15
+ * **beni:** graduate anonymous class and module creation ([2b49324](https://github.com/elct9620/beni/commit/2b493240d1954ff37c5deb40b3c7e65c612dc4ad))
16
+ * **beni:** graduate building an exception from a string value ([7b0a969](https://github.com/elct9620/beni/commit/7b0a96965e4f7b2a6e777a6f7c56b722bb496225))
17
+ * **beni:** graduate interning a runtime byte slice ([2be55ed](https://github.com/elct9620/beni/commit/2be55ed7dc57b3f89d5795b7e2b5fab379520120))
18
+ * **beni:** graduate iterating a value's instance variables ([8349ace](https://github.com/elct9620/beni/commit/8349acef3e9610f935c25befd5e07ce886b0ea5f))
19
+ * **beni:** graduate method removal ([721ca6d](https://github.com/elct9620/beni/commit/721ca6db03b43c2cdab47ef27bfe8ae7482f3d97))
20
+ * **beni:** graduate method undefinition ([ab429a0](https://github.com/elct9620/beni/commit/ab429a0aeb10d048a55e7fee6f82c89caee1b050))
21
+ * **beni:** graduate MRB_ARGS_NONE to the typed surface ([d442072](https://github.com/elct9620/beni/commit/d442072855e9fc1da13773f12e23b1fc838c42ce))
22
+ * **beni:** graduate no-copy static-buffer string construction ([c377e82](https://github.com/elct9620/beni/commit/c377e826dc7a630fa8d4c3f8bfc5393c3b188a8c))
23
+ * **beni:** graduate numeric conversion to the typed surface ([c7de524](https://github.com/elct9620/beni/commit/c7de5244e3375e8b838672687890a6991bd65755))
24
+ * **beni:** graduate optional method arity ([e469534](https://github.com/elct9620/beni/commit/e4695343f7796734544f8acec3834da257b1d37d))
25
+ * **beni:** graduate prepending a module ([50710ce](https://github.com/elct9620/beni/commit/50710ced88fcdfddd13c3741fcd7d85172360c96))
26
+ * **beni:** graduate string capacity construction and string append ([eca35bc](https://github.com/elct9620/beni/commit/eca35bcf93f1db3246d74ef75a196233563c43bd))
27
+ * **beni:** graduate string resize, concat, and substr ([3181343](https://github.com/elct9620/beni/commit/318134344cf35c5977f74311b9e3b4378b03859d))
28
+ * **beni:** graduate the argument-array read ([d439238](https://github.com/elct9620/beni/commit/d4392387b9d0c03af48dadbab4fd7c00ff2c7356))
29
+ * **beni:** graduate the argument-count error constructor ([dbb3711](https://github.com/elct9620/beni/commit/dbb3711e4737e7f1388d738aace593dd8f83e505))
30
+ * **beni:** graduate the array join ([2214780](https://github.com/elct9620/beni/commit/22147807d0b297d44e1b3cb9789eff36df41cd84))
31
+ * **beni:** graduate the array replace ([1996cc6](https://github.com/elct9620/beni/commit/1996cc6f2e714c1ab252428f38c5b1ba62f7d12a))
32
+ * **beni:** graduate the array resize and pair constructor ([a222f94](https://github.com/elct9620/beni/commit/a222f949e2f8cd89751b5e5cacbed5594813c4ac))
33
+ * **beni:** graduate the block method argument ([a570af0](https://github.com/elct9620/beni/commit/a570af023663c1a523e17b1ac51fa5494735df3e))
34
+ * **beni:** graduate the block-given predicate ([fbf9c5d](https://github.com/elct9620/beni/commit/fbf9c5de483d87de93cb5811e3fb2d5b8a57898f))
35
+ * **beni:** graduate the block-passing dispatch ([2c465de](https://github.com/elct9620/beni/commit/2c465de1764cc0b817fd3a68a7e840e65b803f03))
36
+ * **beni:** graduate the built-in exception-class lookup ([5181b46](https://github.com/elct9620/beni/commit/5181b4649245c2dbf8ecce3be5f5d75bf524e33a))
37
+ * **beni:** graduate the byte-equality test ([3dd0f72](https://github.com/elct9620/beni/commit/3dd0f726dc0f696a034c03a57ddfcff8805c9467))
38
+ * **beni:** graduate the C-string append ([85e517b](https://github.com/elct9620/beni/commit/85e517bd815acb615590fc739ec7f96601b011dd))
39
+ * **beni:** graduate the call-frame argument reads ([e3e5c1f](https://github.com/elct9620/beni/commit/e3e5c1faa43d4a392ea2992a9b0c3c262f4392e8))
40
+ * **beni:** graduate the class-handle real-class resolution ([2e00c8c](https://github.com/elct9620/beni/commit/2e00c8c08ed1634631e73b1ef0dcb252ea12449e))
41
+ * **beni:** graduate the class-variable presence test ([f47edbd](https://github.com/elct9620/beni/commit/f47edbd20f196ec72ea5e084b442e356f4ca2b2b))
42
+ * **beni:** graduate the class-variable read and instance-variable presence ([3b6997d](https://github.com/elct9620/beni/commit/3b6997d9f5273d2c3fc7ae300023b430f696fcb2))
43
+ * **beni:** graduate the class/module defined predicate ([17e71fd](https://github.com/elct9620/beni/commit/17e71fd16b883f4bc3327cefa07b49ef7d1f34c6))
44
+ * **beni:** graduate the constant removal ([41cf65a](https://github.com/elct9620/beni/commit/41cf65a8c77d877bba06c6eaec65aec0dea919c2))
45
+ * **beni:** graduate the context-free Ruby-source eval ([62c0d25](https://github.com/elct9620/beni/commit/62c0d25b32999fd8f1fdd78f9ae10b22b65ba6ca))
46
+ * **beni:** graduate the default to_s render ([61e7d72](https://github.com/elct9620/beni/commit/61e7d72d93e5625a0e0e081df5a479a52afd0a57))
47
+ * **beni:** graduate the direct constant presence test ([617c48b](https://github.com/elct9620/beni/commit/617c48b21904a01fd27de379c03fac3d806f9dfa))
48
+ * **beni:** graduate the float-to-integer conversion ([7880249](https://github.com/elct9620/beni/commit/7880249ea89393daeb0ee96a7b48cbc13a041427))
49
+ * **beni:** graduate the frozen-state precondition guard ([4cf74c4](https://github.com/elct9620/beni/commit/4cf74c4d24e868d521a016e1b9cc7b3d69e80ae9))
50
+ * **beni:** graduate the hash key-value iteration ([85d7dc9](https://github.com/elct9620/beni/commit/85d7dc908359b2e9e5a3e04daf834f9f470e08da))
51
+ * **beni:** graduate the in-place subsequence splice ([fe281cc](https://github.com/elct9620/beni/commit/fe281ccf666c434949aa0c7d39cc68ecbbe7d835))
52
+ * **beni:** graduate the instance-variable removal ([e9db9b8](https://github.com/elct9620/beni/commit/e9db9b8fe2a4c9a07761fb7feb568e6cdcd13b5e))
53
+ * **beni:** graduate the integer-to-string render ([153acfb](https://github.com/elct9620/beni/commit/153acfb614c3e5de5f8f9b2a074ae327b4879d7d))
54
+ * **beni:** graduate the intern presence test ([a6b76f9](https://github.com/elct9620/beni/commit/a6b76f962cd53d33fd69eb0e3174d7725198cfcb))
55
+ * **beni:** graduate the lenient integer parse ([92d58a3](https://github.com/elct9620/beni/commit/92d58a36d55ff94c8fa34b42f18358e50e63f91f))
56
+ * **beni:** graduate the module, range, and exception tag predicates ([9d8a46f](https://github.com/elct9620/beni/commit/9d8a46fa26ce6421c6ca39a64efe991c9d0bbbd7))
57
+ * **beni:** graduate the Mrb::rescue combinator ([2b2daab](https://github.com/elct9620/beni/commit/2b2daab9dcd893d55a83dd3374ba31d4ae48dd32))
58
+ * **beni:** graduate the namespaced module lookup ([aaade85](https://github.com/elct9620/beni/commit/aaade857940bb372c12d6e2084871ffdb03c6400))
59
+ * **beni:** graduate the no-arg GC triggers ([1b5e4c9](https://github.com/elct9620/beni/commit/1b5e4c99b5b7c7c97895c519977f959a4c128d05))
60
+ * **beni:** graduate the no-copy symbol intern ([80fcc90](https://github.com/elct9620/beni/commit/80fcc900f4b470f2eb285f047e792872c9edd526))
61
+ * **beni:** graduate the non-mutating string concatenation ([08b16f0](https://github.com/elct9620/beni/commit/08b16f0bb71fc6f16f24a197abbcb7f0d2e308dc))
62
+ * **beni:** graduate the numeric arithmetic family ([e55f378](https://github.com/elct9620/beni/commit/e55f3781bde8982ba0ac4264883d7a92411c6c7d))
63
+ * **beni:** graduate the numeric ensure-type coercions ([0b8303f](https://github.com/elct9620/beni/commit/0b8303fa126b0b5963270aded5428df72c4395a9))
64
+ * **beni:** graduate the preallocated-capacity hash construction ([7ef0852](https://github.com/elct9620/beni/commit/7ef08525d5922e7d988da4db7ff56942a166d6c6))
65
+ * **beni:** graduate the qualified class path read ([d3d0fd0](https://github.com/elct9620/beni/commit/d3d0fd0e4bd811b28513ddd412760fb8325a571d))
66
+ * **beni:** graduate the raising string-type coercion ([bd05c99](https://github.com/elct9620/beni/commit/bd05c9942d8fbcfb91a079a8ca13add89367140d))
67
+ * **beni:** graduate the Range slice computation ([e9be245](https://github.com/elct9620/beni/commit/e9be245b07b50a2584900ba10be555f068ac5b78))
68
+ * **beni:** graduate the singleton class read ([437304a](https://github.com/elct9620/beni/commit/437304a259901c2ca32cf8850cbce0900f997228))
69
+ * **beni:** graduate the splat coercion ([7bb6ec6](https://github.com/elct9620/beni/commit/7bb6ec6bc1ff2e24facd52479c7b151c83e9e1e4))
70
+ * **beni:** graduate the string C-string read ([bc8ba88](https://github.com/elct9620/beni/commit/bc8ba8815fccff7f17cb5eae3bdcda6258c903b6))
71
+ * **beni:** graduate the string float parse ([0603cc6](https://github.com/elct9620/beni/commit/0603cc68f03ce820ae7fd8ee1e940716b4c92bab))
72
+ * **beni:** graduate the string-intern read ([c03dead](https://github.com/elct9620/beni/commit/c03dead49b20bf5ceaf840b040313bedea3f93e8))
73
+ * **beni:** graduate the string-to-integer parse ([8770cb2](https://github.com/elct9620/beni/commit/8770cb26c42938d8c964cffa8dfe1cfdf4bf68ad))
74
+ * **beni:** graduate the substring search read ([3d4e6f4](https://github.com/elct9620/beni/commit/3d4e6f42a472037a1cdd9dd62feb379e118ce6d4))
75
+ * **beni:** graduate the symbol name and dump reads ([74e839a](https://github.com/elct9620/beni/commit/74e839a9866fd148e8938a9c156e346bd6ce8731))
76
+ * **beni:** graduate the symbol-keyed method alias ([5c535e4](https://github.com/elct9620/beni/commit/5c535e4c03de1bf7c8f0d84d6ff267ad8a5a76a4))
77
+ * **beni:** graduate the symbol-name string read ([c6f8e69](https://github.com/elct9620/beni/commit/c6f8e69b9e899aef8114f9188413e67fee4b40e8))
78
+ * **beni:** graduate the symbol-or-name define/get key ([95e9c56](https://github.com/elct9620/beni/commit/95e9c568d7381889b7a3284956d18e4511092a57))
79
+ * **beni:** graduate the top-level module lookup ([e05b4de](https://github.com/elct9620/beni/commit/e05b4de0af19c6d8c22f874a98a8827eab638d2a))
80
+ * **beni:** graduate the typed array and hash coercion ([bf218e0](https://github.com/elct9620/beni/commit/bf218e0fa7161158d755753dce8e80d6a31df51f))
81
+ * **beni:** graduate the typed comparison ([88f08d5](https://github.com/elct9620/beni/commit/88f08d587129714b81a293745b8ae2ac7ca6fd60))
82
+ * **beni:** graduate the typed range ([3000c85](https://github.com/elct9620/beni/commit/3000c854440477e65407f0466ca306330f97a319))
83
+ * **beni:** graduate the value object identity id ([3dcc1bc](https://github.com/elct9620/beni/commit/3dcc1bc4ab8c005be3f1db5dca960a8ce726c5f4))
84
+ * **beni:** graduate the value-to-symbol coercion ([4339d23](https://github.com/elct9620/beni/commit/4339d23487f92d18a188024b87d05d852516dae2))
85
+ * **beni:** graduate the variable write companions ([b5898a9](https://github.com/elct9620/beni/commit/b5898a9d013495a0329479a967bff95ba506376a))
86
+ * **beni:** record mrb_str_cat_lit on the typed surface ([fe602a0](https://github.com/elct9620/beni/commit/fe602a0e7132e39e7464980426a7cbd62776d932))
87
+
88
+
89
+ ### Bug Fixes
90
+
91
+ * **beni:** contain a panicking payload drop in the GC release hook ([f9769dc](https://github.com/elct9620/beni/commit/f9769dccb9cdf42b0106ae889b3c3f6baf6ed21d))
92
+ * **beni:** copy class names out of mruby's GC-managed temporary ([0660194](https://github.com/elct9620/beni/commit/06601948059d9ae7774874b6ba459b254a1df03c))
93
+ * **beni:** copy symbol names out instead of borrowing the shared buffer ([91e5df9](https://github.com/elct9620/beni/commit/91e5df990ca64050168a67d81c38c837a2b344e1))
94
+ * **beni:** make data carrier wrapping fallible ([0b3ac32](https://github.com/elct9620/beni/commit/0b3ac32f8f0fcc2d3d4459d681d17f253afd2a1b))
95
+ * **beni:** protect Hash::each against the in-walk modify raise ([7b66c82](https://github.com/elct9620/beni/commit/7b66c82f791e6152d0e8338830e0f16b632ead90))
96
+ * **beni:** rank Value::cmp by the sign of &lt;=&gt;, not its magnitude ([a0deab4](https://github.com/elct9620/beni/commit/a0deab4936072b2f7bfe92535905e96f28ae9b04))
97
+ * **beni:** saturate out-of-width range length instead of wrapping ([4b58218](https://github.com/elct9620/beni/commit/4b582185eafdf0d09e6886d536231da4f8efe10b))
98
+ * **beni:** saturate out-of-width substr/index offsets instead of wrapping ([bdb1461](https://github.com/elct9620/beni/commit/bdb1461f40743e7b34420fa701a026a1393fbd61))
99
+
100
+ ## [0.7.0](https://github.com/elct9620/beni/compare/v0.6.1...v0.7.0) (2026-06-14)
101
+
102
+
103
+ ### Features
104
+
105
+ * **beni:** add Error::new for handler-authored exceptions ([4842496](https://github.com/elct9620/beni/commit/48424965e4c771c2b9097e63ce973c42799a79a7))
106
+ * **beni:** convert an mruby string to owned bytes ([ec5e175](https://github.com/elct9620/beni/commit/ec5e1756d1c6bb7620403c0cf38fe61ac13ad5e4))
107
+ * **beni:** graduate array index-write and capacity/slice construction ([68af55d](https://github.com/elct9620/beni/commit/68af55d3330020356aaaf3c202f7e85c251c1aa8))
108
+ * **beni:** graduate module functions; record class-method alignment ([c7c6c47](https://github.com/elct9620/beni/commit/c7c6c472c05a09830e7d022b4a1bc27c267e773b))
109
+ * **beni:** graduate module inclusion onto the Module trait ([c751c3f](https://github.com/elct9620/beni/commit/c751c3f152a9f8384788e6fb4467cb2bf44effab))
110
+ * **beni:** graduate string append and owned-String conversion ([6035360](https://github.com/elct9620/beni/commit/60353601fd04f5d94524b5bb73ce80a304107ad8))
111
+ * **beni:** graduate the typed array's remove/extend/clear/dup surface ([842d4f2](https://github.com/elct9620/beni/commit/842d4f227be6ea0f71c09691d5ef1b3e0e439165))
112
+ * **beni:** graduate the typed hash's clear onto the Hash surface ([a1ef297](https://github.com/elct9620/beni/commit/a1ef297dab8e0463462f78849b099a8dde78ba8c))
113
+ * **beni:** graduate the typed hash's read, fetch, delete, and merge surface ([4af31f1](https://github.com/elct9620/beni/commit/4af31f1d2589c334c3c7204f74907c44c86d0b85))
114
+ * **beni:** graduate the typed string's dup and byte compare ([05ea9ef](https://github.com/elct9620/beni/commit/05ea9ef4793411c4f7ace2352b3a17e38075bae1))
115
+ * **beni:** graduate the typed value's inspect render ([e6f7bb0](https://github.com/elct9620/beni/commit/e6f7bb042aee9869b94aa338ab7346bd61f13822))
116
+ * **beni:** graduate the value reflection surface (class, is_a?, freeze) ([66f4dfd](https://github.com/elct9620/beni/commit/66f4dfd24daeb4d060ddb492da6533f640ac1a6f))
117
+ * **beni:** graduate value comparison (==, eql?, identity) ([f12c645](https://github.com/elct9620/beni/commit/f12c6459929c053e80efc9333139f3688bed42ec))
118
+ * **beni:** introduce RString and graduate string ops onto it ([d71c093](https://github.com/elct9620/beni/commit/d71c0939e9e3d6bd9a7f7577765bc03095eef489))
119
+ * **beni:** report an RString's byte length on the typed surface ([47c4b48](https://github.com/elct9620/beni/commit/47c4b4830d2a6419cc9fa59fcab35606c9b7b2f8))
120
+ * **coverage:** drop non-embedder macros, credit tag predicates ([5c6b656](https://github.com/elct9620/beni/commit/5c6b65670412eb4d7bb3c8e67d9c46c4d39e604a))
121
+
122
+
123
+ ### Bug Fixes
124
+
125
+ * **beni:** make data_reinit a safe no-op on a non-carrier value ([e5339f2](https://github.com/elct9620/beni/commit/e5339f22a0b8d253ff361a5764a51375f9edae2f))
126
+ * **beni:** normalize a symbol toolchain name like a target ([ff1beb7](https://github.com/elct9620/beni/commit/ff1beb746c44cf298a6c88e22b600b6a7a5774d9))
127
+ * **beni:** protect str_cat against a frozen receiver ([9b78cc3](https://github.com/elct9620/beni/commit/9b78cc3f51ae0f78115fd6b9285931d6e083c044))
128
+ * **beni:** protect the dispatching and mutating typed ops against raises ([8b83ab9](https://github.com/elct9620/beni/commit/8b83ab936d5f696e0fb58b343af7dedffd3776e0))
129
+ * **beni:** read a String subclass to_s result by tag ([66589b9](https://github.com/elct9620/beni/commit/66589b9ff21f57982250f9de5ec18ce3b13b534a))
130
+ * **beni:** route class obj_new through protect ([124cd29](https://github.com/elct9620/beni/commit/124cd29288ed4f5c42a151888350e248df48e58e))
131
+ * **beni:** route Hash::get through protect ([e0a9c92](https://github.com/elct9620/beni/commit/e0a9c92e42f06e9d09b977de4975c4c81dc4327e))
132
+ * **beni:** route value dup, clone, and string coercion through protect ([3ac8cc2](https://github.com/elct9620/beni/commit/3ac8cc2cb3bf8a4bc6a44d7ecad8b4f7cdcf9385))
133
+ * **beni:** route value iv_set and const_get through protect ([d46f18c](https://github.com/elct9620/beni/commit/d46f18cdcab51e8907123a405cf7225ee21f505c))
134
+ * **beni:** saturate the exception message length like the string factory ([11eb7b9](https://github.com/elct9620/beni/commit/11eb7b91bb7f3b935fbdd1e4ca5863b0d4ba8a8c))
135
+ * **coverage:** credit is_integer to integer_p, not fixnum_p ([32f064f](https://github.com/elct9620/beni/commit/32f064fe810b2181b826251b447dbfc16208cf31))
136
+ * **coverage:** label trait graduations by their trait ([be598c6](https://github.com/elct9620/beni/commit/be598c6b4e59a885a6eaae08ee64c3900c9cb198))
137
+
3
138
  ## [0.6.1](https://github.com/elct9620/beni/compare/v0.6.0...v0.6.1) (2026-06-11)
4
139
 
5
140
 
@@ -8,5 +8,10 @@ module Beni
8
8
  # +targets+ as the declared set (or +["host"]+), and +toolchains+ as
9
9
  # the reference-driven selection.
10
10
  class Configuration < Data.define(:vendor_dir, :build_config, :targets, :toolchains)
11
+ # mruby's selected version. Resolution always selects +mruby+ and
12
+ # leads the toolchain set with it, so it is the head's version.
13
+ def mruby_version
14
+ toolchains.first.version
15
+ end
11
16
  end
12
17
  end
@@ -39,15 +39,16 @@ module Beni
39
39
  # A top-level +toolchain <name>+ — always a definition, so the
40
40
  # block is part of the grammar and +mruby+ is never definable.
41
41
  def toolchain(name, &block)
42
- raise Error, "top-level `toolchain #{name.inspect}` must carry a definition block" unless block
43
- if name == "mruby"
42
+ key = name.to_s
43
+ raise Error, "top-level `toolchain #{key.inspect}` must carry a definition block" unless block
44
+ if key == "mruby"
44
45
  raise Error, "a toolchain definition never names \"mruby\" — select it with the `version` setting"
45
46
  end
46
47
 
47
- DSL.assert_known_toolchain!(name)
48
- raise Error, "duplicate toolchain definition #{name.inspect}" if @definitions.key?(name)
48
+ DSL.assert_known_toolchain!(key)
49
+ raise Error, "duplicate toolchain definition #{key.inspect}" if @definitions.key?(key)
49
50
 
50
- @definitions[name] = DefinitionContext.collect(name, &block)
51
+ @definitions[key] = DefinitionContext.collect(key, &block)
51
52
  end
52
53
 
53
54
  # Resolve the collected declarations (SPEC.md Behaviors: selection
@@ -21,14 +21,15 @@ module Beni
21
21
  end
22
22
 
23
23
  def toolchain(name, &block)
24
+ key = name.to_s
24
25
  if block
25
26
  raise Error,
26
- "`toolchain #{name.inspect}` inside a target block must not carry a block — " \
27
+ "`toolchain #{key.inspect}` inside a target block must not carry a block — " \
27
28
  "definitions live at the top level"
28
29
  end
29
- DSL.assert_known_toolchain!(name)
30
+ DSL.assert_known_toolchain!(key)
30
31
 
31
- @references << name unless @references.include?(name)
32
+ @references << key unless @references.include?(key)
32
33
  end
33
34
  end
34
35
  end
data/lib/beni/tasks.rb CHANGED
@@ -145,15 +145,9 @@ module Beni
145
145
  dest = configuration.build_config
146
146
  raise Error, "[beni] beni:config requires a `build_config` declaration naming the file to generate" unless dest
147
147
 
148
- BuildConfig.generate(dest, mruby_dir: builder.mruby_dir, version: mruby_version)
148
+ BuildConfig.generate(dest, mruby_dir: builder.mruby_dir, version: configuration.mruby_version)
149
149
  puts "[beni] generated #{dest} — edit it to define further targets"
150
150
  end
151
151
  end
152
-
153
- # mruby's selected version — always present, `mruby` is selected in
154
- # every resolution.
155
- def mruby_version
156
- configuration.toolchains.to_h { |toolchain| [toolchain.name, toolchain.version] }.fetch("mruby")
157
- end
158
152
  end
159
153
  end
data/lib/beni/vendor.rb CHANGED
@@ -50,18 +50,21 @@ module Beni
50
50
  # task-definition time: referencing wasi-sdk implies mruby.
51
51
  DEPENDENCIES = { "wasi-sdk" => %w[mruby] }.freeze
52
52
 
53
- # ---- Platform detection (wasi-sdk only; mruby tarball is host-agnostic).
54
- # +x86_64-linux+ is both the most common host triple and the safest
55
- # fallback for unrecognised ones, so we collapse both cases into the
56
- # +else+ branch rather than carrying an explicit +when+ that would
57
- # duplicate the default.
58
- WASI_SDK_PLATFORM =
59
- case RUBY_PLATFORM
53
+ # Map a host triple to the platform token wasi-sdk keys its per-platform
54
+ # tarballs by (wasi-sdk only; mruby's tarball is host-agnostic).
55
+ # +x86_64-linux+ is both the most common host and the safest fallback
56
+ # for unrecognised triples, so it is the +else+ branch.
57
+ def self.wasi_sdk_platform(platform = RUBY_PLATFORM)
58
+ case platform
60
59
  when /arm64-darwin|aarch64-darwin/ then "arm64-macos"
61
60
  when /x86_64-darwin/ then "x86_64-macos"
62
61
  when /aarch64-linux|arm64-linux/ then "arm64-linux"
63
62
  else "x86_64-linux"
64
63
  end
64
+ end
65
+
66
+ # The build platform's wasi-sdk token, resolved once at load.
67
+ WASI_SDK_PLATFORM = wasi_sdk_platform
65
68
 
66
69
  # Known toolchain names mapped to their factory methods — the name
67
70
  # domain the DSL validates against and +Beni::Tasks+ dispatches on.
data/lib/beni/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Beni
4
- VERSION = "0.6.1"
4
+ VERSION = "0.8.0"
5
5
  end
@@ -6,5 +6,7 @@ module Beni
6
6
  attr_reader toolchains: Array[SelectedToolchain]
7
7
 
8
8
  def initialize: (vendor_dir: String, build_config: String?, targets: Array[String], toolchains: Array[SelectedToolchain]) -> void
9
+
10
+ def mruby_version: () -> String
9
11
  end
10
12
  end
@@ -15,7 +15,7 @@ module Beni
15
15
 
16
16
  def target: (Symbol | String name) ?{ () [self: TargetContext] -> void } -> void
17
17
 
18
- def toolchain: (String name) ?{ () [self: DefinitionContext] -> void } -> void
18
+ def toolchain: (Symbol | String name) ?{ () [self: DefinitionContext] -> void } -> void
19
19
 
20
20
  def configuration: () -> Configuration
21
21
 
@@ -9,7 +9,7 @@ module Beni
9
9
 
10
10
  def initialize: () -> void
11
11
 
12
- def toolchain: (String name) ?{ () -> void } -> void
12
+ def toolchain: (Symbol | String name) ?{ () -> void } -> void
13
13
  end
14
14
  end
15
15
  end
data/sig/beni/tasks.rbs CHANGED
@@ -30,7 +30,5 @@ module Beni
30
30
  def define_clean_task: () -> void
31
31
 
32
32
  def define_config_task: () -> void
33
-
34
- def mruby_version: () -> String
35
33
  end
36
34
  end
data/sig/beni/vendor.rbs CHANGED
@@ -7,6 +7,8 @@ module Beni
7
7
  WASI_SDK_PLATFORM: String
8
8
  TOOLCHAIN_FACTORIES: Hash[String, Symbol]
9
9
 
10
+ def self.wasi_sdk_platform: (?String platform) -> String
11
+
10
12
  def self?.wasi_sdk: (vendor_dir: String, ?version: String?, ?sha256: String?) -> Toolchain
11
13
 
12
14
  def self?.mruby: (vendor_dir: String, ?version: String?, ?sha256: String?) -> Toolchain
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beni
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aotokitsuruya