lz4rip 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Cargo.lock +38 -74
- data/README.md +12 -34
- data/ext/lz4rip/Cargo.toml +3 -3
- data/ext/lz4rip/build.rs +23 -0
- data/ext/lz4rip/src/lib.rs +535 -205
- data/ext/lz4rip/src/rb.rs +628 -0
- data/lib/lz4rip/block_codec.rb +39 -0
- data/lib/lz4rip/dict_trainer.rb +32 -0
- data/lib/lz4rip/dictionary.rb +10 -0
- data/lib/lz4rip/frame_codec.rb +46 -0
- data/lib/lz4rip/version.rb +1 -1
- data/lib/lz4rip.rb +17 -0
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f66c12c967a06a207c9e8e742fac306280863bf655bd7b4318a2265d08c1cdf
|
|
4
|
+
data.tar.gz: be95ea7eb336509e7077737f0d4703dc500931f1608fdc2f52dc3b170904b16d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2fc02b8f797989ca99f23e97658dab9442c4fbb70ab03ff3436a73b5026b78d20c1bbf240e4febba0baed905863b225655f03c627d6db4ddee128224b419c82c
|
|
7
|
+
data.tar.gz: 92b2aa66f6282317c5b805f77cf47715288c8debc013520e5dffc78fb7d9c102f62f330906042b062b93aa2104ca21c5b1b0830edd87852b585f6451f4146efd
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.2.0] - 2026-08-07
|
|
6
|
+
|
|
7
|
+
- Release the Ruby GVL around large frame/block compression and frame
|
|
8
|
+
decompression calls.
|
|
9
|
+
- Update the `lz4rip` crate dependency to 0.11.3.
|
|
10
|
+
- Replace Magnus with direct `rb-sys` bindings, add TruffleRuby build support,
|
|
11
|
+
and lower the Ruby requirement to 3.4.
|
|
12
|
+
- Add `max_decompressed_size:` to `Lz4rip::FrameCodec#decompress`, with the
|
|
13
|
+
cap enforced across concatenated frame output.
|
|
14
|
+
- Add RubyDoc metadata and move API reference details from `README.md` into
|
|
15
|
+
YARD comments.
|
|
16
|
+
|
|
17
|
+
## [0.1.2] - 2026-08-05
|
|
18
|
+
|
|
19
|
+
- Update `lz4rip` crate dependency from 0.11.1 to 0.11.2.
|
|
20
|
+
|
|
5
21
|
## [0.1.1] - 2026-06-29
|
|
6
22
|
|
|
7
23
|
- Update `lz4rip` crate dependency from 0.8 to 0.9.
|
data/Cargo.lock
CHANGED
|
@@ -4,9 +4,9 @@ version = 4
|
|
|
4
4
|
|
|
5
5
|
[[package]]
|
|
6
6
|
name = "aho-corasick"
|
|
7
|
-
version = "1.1.
|
|
7
|
+
version = "1.1.5"
|
|
8
8
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
-
checksum = "
|
|
9
|
+
checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
|
|
10
10
|
dependencies = [
|
|
11
11
|
"memchr",
|
|
12
12
|
]
|
|
@@ -31,9 +31,9 @@ dependencies = [
|
|
|
31
31
|
|
|
32
32
|
[[package]]
|
|
33
33
|
name = "bitflags"
|
|
34
|
-
version = "2.13.
|
|
34
|
+
version = "2.13.1"
|
|
35
35
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
-
checksum = "
|
|
36
|
+
checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
|
|
37
37
|
|
|
38
38
|
[[package]]
|
|
39
39
|
name = "cexpr"
|
|
@@ -52,9 +52,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
|
52
52
|
|
|
53
53
|
[[package]]
|
|
54
54
|
name = "clang-sys"
|
|
55
|
-
version = "1.
|
|
55
|
+
version = "1.9.1"
|
|
56
56
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
-
checksum = "
|
|
57
|
+
checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
|
|
58
58
|
dependencies = [
|
|
59
59
|
"glob",
|
|
60
60
|
"libc",
|
|
@@ -63,15 +63,15 @@ dependencies = [
|
|
|
63
63
|
|
|
64
64
|
[[package]]
|
|
65
65
|
name = "either"
|
|
66
|
-
version = "1.
|
|
66
|
+
version = "1.17.0"
|
|
67
67
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
68
|
-
checksum = "
|
|
68
|
+
checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d"
|
|
69
69
|
|
|
70
70
|
[[package]]
|
|
71
71
|
name = "glob"
|
|
72
|
-
version = "0.3.
|
|
72
|
+
version = "0.3.4"
|
|
73
73
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
-
checksum = "
|
|
74
|
+
checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
|
|
75
75
|
|
|
76
76
|
[[package]]
|
|
77
77
|
name = "itertools"
|
|
@@ -90,9 +90,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
|
90
90
|
|
|
91
91
|
[[package]]
|
|
92
92
|
name = "libc"
|
|
93
|
-
version = "0.2.
|
|
93
|
+
version = "0.2.189"
|
|
94
94
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
95
|
-
checksum = "
|
|
95
|
+
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
96
96
|
|
|
97
97
|
[[package]]
|
|
98
98
|
name = "libloading"
|
|
@@ -106,18 +106,17 @@ dependencies = [
|
|
|
106
106
|
|
|
107
107
|
[[package]]
|
|
108
108
|
name = "lz4rip"
|
|
109
|
-
version = "0.1.
|
|
109
|
+
version = "0.1.2"
|
|
110
110
|
dependencies = [
|
|
111
|
-
"lz4rip 0.
|
|
112
|
-
"magnus",
|
|
111
|
+
"lz4rip 0.11.3",
|
|
113
112
|
"rb-sys",
|
|
114
113
|
]
|
|
115
114
|
|
|
116
115
|
[[package]]
|
|
117
116
|
name = "lz4rip"
|
|
118
|
-
version = "0.
|
|
117
|
+
version = "0.11.3"
|
|
119
118
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
120
|
-
checksum = "
|
|
119
|
+
checksum = "55bde261679fd1d14bcae126094d7afb98c63c1a5018d0718741b658b686e950"
|
|
121
120
|
dependencies = [
|
|
122
121
|
"lz4rip-core",
|
|
123
122
|
"lz4rip-decode",
|
|
@@ -127,56 +126,33 @@ dependencies = [
|
|
|
127
126
|
|
|
128
127
|
[[package]]
|
|
129
128
|
name = "lz4rip-core"
|
|
130
|
-
version = "0.5.
|
|
129
|
+
version = "0.5.5"
|
|
131
130
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
-
checksum = "
|
|
131
|
+
checksum = "22fc4edb61fcaf1cdad24ac2982eff7af4417ef463c33bcf5c42ba549abd8b96"
|
|
133
132
|
|
|
134
133
|
[[package]]
|
|
135
134
|
name = "lz4rip-decode"
|
|
136
|
-
version = "0.
|
|
135
|
+
version = "0.10.3"
|
|
137
136
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
138
|
-
checksum = "
|
|
137
|
+
checksum = "60d65bfd4c032fefcf8c18fb5f8d9958f4925146845db16dbc9d416f1566b9bf"
|
|
139
138
|
dependencies = [
|
|
140
139
|
"lz4rip-core",
|
|
141
140
|
]
|
|
142
141
|
|
|
143
142
|
[[package]]
|
|
144
143
|
name = "lz4rip-encode"
|
|
145
|
-
version = "0.
|
|
144
|
+
version = "0.10.5"
|
|
146
145
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
147
|
-
checksum = "
|
|
146
|
+
checksum = "09e92b7345788ec0d32b5e31051dc6a86730e17b01267e502e9ec2744b689d34"
|
|
148
147
|
dependencies = [
|
|
149
148
|
"lz4rip-core",
|
|
150
149
|
]
|
|
151
150
|
|
|
152
|
-
[[package]]
|
|
153
|
-
name = "magnus"
|
|
154
|
-
version = "0.8.2"
|
|
155
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
156
|
-
checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
|
|
157
|
-
dependencies = [
|
|
158
|
-
"magnus-macros",
|
|
159
|
-
"rb-sys",
|
|
160
|
-
"rb-sys-env",
|
|
161
|
-
"seq-macro",
|
|
162
|
-
]
|
|
163
|
-
|
|
164
|
-
[[package]]
|
|
165
|
-
name = "magnus-macros"
|
|
166
|
-
version = "0.8.0"
|
|
167
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
168
|
-
checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
|
|
169
|
-
dependencies = [
|
|
170
|
-
"proc-macro2",
|
|
171
|
-
"quote",
|
|
172
|
-
"syn",
|
|
173
|
-
]
|
|
174
|
-
|
|
175
151
|
[[package]]
|
|
176
152
|
name = "memchr"
|
|
177
|
-
version = "2.8.
|
|
153
|
+
version = "2.8.3"
|
|
178
154
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
179
|
-
checksum = "
|
|
155
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
180
156
|
|
|
181
157
|
[[package]]
|
|
182
158
|
name = "minimal-lexical"
|
|
@@ -196,18 +172,18 @@ dependencies = [
|
|
|
196
172
|
|
|
197
173
|
[[package]]
|
|
198
174
|
name = "proc-macro2"
|
|
199
|
-
version = "1.0.
|
|
175
|
+
version = "1.0.107"
|
|
200
176
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
201
|
-
checksum = "
|
|
177
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
202
178
|
dependencies = [
|
|
203
179
|
"unicode-ident",
|
|
204
180
|
]
|
|
205
181
|
|
|
206
182
|
[[package]]
|
|
207
183
|
name = "quote"
|
|
208
|
-
version = "1.0.
|
|
184
|
+
version = "1.0.47"
|
|
209
185
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
210
|
-
checksum = "
|
|
186
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
211
187
|
dependencies = [
|
|
212
188
|
"proc-macro2",
|
|
213
189
|
]
|
|
@@ -236,17 +212,11 @@ dependencies = [
|
|
|
236
212
|
"syn",
|
|
237
213
|
]
|
|
238
214
|
|
|
239
|
-
[[package]]
|
|
240
|
-
name = "rb-sys-env"
|
|
241
|
-
version = "0.2.3"
|
|
242
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
243
|
-
checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
|
|
244
|
-
|
|
245
215
|
[[package]]
|
|
246
216
|
name = "regex"
|
|
247
|
-
version = "1.
|
|
217
|
+
version = "1.13.1"
|
|
248
218
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
249
|
-
checksum = "
|
|
219
|
+
checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
|
|
250
220
|
dependencies = [
|
|
251
221
|
"aho-corasick",
|
|
252
222
|
"memchr",
|
|
@@ -256,9 +226,9 @@ dependencies = [
|
|
|
256
226
|
|
|
257
227
|
[[package]]
|
|
258
228
|
name = "regex-automata"
|
|
259
|
-
version = "0.4.
|
|
229
|
+
version = "0.4.18"
|
|
260
230
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
261
|
-
checksum = "
|
|
231
|
+
checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
|
|
262
232
|
dependencies = [
|
|
263
233
|
"aho-corasick",
|
|
264
234
|
"memchr",
|
|
@@ -273,15 +243,9 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
|
273
243
|
|
|
274
244
|
[[package]]
|
|
275
245
|
name = "rustc-hash"
|
|
276
|
-
version = "2.1.
|
|
277
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
278
|
-
checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
|
|
279
|
-
|
|
280
|
-
[[package]]
|
|
281
|
-
name = "seq-macro"
|
|
282
|
-
version = "0.3.6"
|
|
246
|
+
version = "2.1.3"
|
|
283
247
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
284
|
-
checksum = "
|
|
248
|
+
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
285
249
|
|
|
286
250
|
[[package]]
|
|
287
251
|
name = "shell-words"
|
|
@@ -297,9 +261,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
|
297
261
|
|
|
298
262
|
[[package]]
|
|
299
263
|
name = "syn"
|
|
300
|
-
version = "2.0.
|
|
264
|
+
version = "2.0.119"
|
|
301
265
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
302
|
-
checksum = "
|
|
266
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
303
267
|
dependencies = [
|
|
304
268
|
"proc-macro2",
|
|
305
269
|
"quote",
|
|
@@ -308,9 +272,9 @@ dependencies = [
|
|
|
308
272
|
|
|
309
273
|
[[package]]
|
|
310
274
|
name = "twox-hash"
|
|
311
|
-
version = "2.1.
|
|
275
|
+
version = "2.1.3"
|
|
312
276
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
313
|
-
checksum = "
|
|
277
|
+
checksum = "8464ec13c3691491391d9fce00f6416c9a48e46972f72d7865688be2080192c9"
|
|
314
278
|
|
|
315
279
|
[[package]]
|
|
316
280
|
name = "unicode-ident"
|
data/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# lz4rip
|
|
1
|
+
# lz4rip: Ractor-safe LZ4 for Ruby
|
|
2
2
|
|
|
3
3
|
[](https://github.com/paddor/lz4rip-rb/actions/workflows/ci.yml)
|
|
4
4
|
[](https://rubygems.org/gems/lz4rip)
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
[](https://www.ruby-lang.org)
|
|
7
7
|
|
|
8
8
|
Ruby bindings for [lz4rip](https://crates.io/crates/lz4rip), a pure-Rust LZ4
|
|
9
|
-
implementation. Built
|
|
10
|
-
|
|
9
|
+
implementation. Built as an `rb-sys` native extension and declared Ractor-safe
|
|
10
|
+
so you can compress from any Ractor without a global lock.
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ declared Ractor-safe so you can compress from any Ractor without a global lock.
|
|
|
20
20
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
23
|
-
Requires Ruby >= 4
|
|
23
|
+
Requires Ruby >= 3.4 and a Rust toolchain (for building the native extension):
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
26
|
gem install lz4rip
|
|
@@ -42,6 +42,7 @@ require "lz4rip"
|
|
|
42
42
|
codec = Lz4rip::FrameCodec.new
|
|
43
43
|
compressed = codec.compress("hello world " * 1000)
|
|
44
44
|
original = codec.decompress(compressed)
|
|
45
|
+
bounded = codec.decompress(compressed, max_decompressed_size: 12_000)
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
### Block codec (raw LZ4 blocks)
|
|
@@ -78,6 +79,9 @@ codec = Lz4rip::BlockCodec.new(dict: dict)
|
|
|
78
79
|
|
|
79
80
|
### Ractor safety
|
|
80
81
|
|
|
82
|
+
On Ruby VMs without Ractor support, the codecs still work normally; the
|
|
83
|
+
Ractor-specific guarantees and examples do not apply.
|
|
84
|
+
|
|
81
85
|
```ruby
|
|
82
86
|
codec = Lz4rip::FrameCodec.new
|
|
83
87
|
|
|
@@ -93,35 +97,9 @@ end
|
|
|
93
97
|
ractors.each { |r| p r.value } # => :ok, :ok, :ok, :ok
|
|
94
98
|
```
|
|
95
99
|
|
|
96
|
-
##
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|---|---|---|
|
|
100
|
-
| `Lz4rip::FrameCodec` | `.new(dict: nil)` | Create a frame codec, optionally with a `Dictionary` or raw `String` dict |
|
|
101
|
-
| | `#compress(string)` | Compress to LZ4 frame |
|
|
102
|
-
| | `#decompress(string)` | Decompress an LZ4 frame |
|
|
103
|
-
| | `#has_dict?` | Whether a dictionary is loaded |
|
|
104
|
-
| | `#id` | Dictionary ID (nil without dict) |
|
|
105
|
-
| | `#size` | Dictionary size in bytes (0 without dict) |
|
|
106
|
-
| `Lz4rip::BlockCodec` | `.new(dict: nil)` | Create a block codec, optionally with a dict `String` |
|
|
107
|
-
| | `#compress(string)` | Compress to raw LZ4 block |
|
|
108
|
-
| | `#decompress(string, decompressed_size:)` | Decompress a raw LZ4 block |
|
|
109
|
-
| | `#has_dict?` | Whether a dictionary is loaded |
|
|
110
|
-
| | `#size` | Internal state size in bytes |
|
|
111
|
-
| `Lz4rip::Dictionary` | `.new(bytes:, id: auto)` | Immutable dictionary value object |
|
|
112
|
-
| | `#bytes` | Frozen binary dict bytes |
|
|
113
|
-
| | `#id` | 32-bit dictionary ID |
|
|
114
|
-
| | `#size` | Dictionary size in bytes |
|
|
115
|
-
| `Lz4rip::DictTrainer` | `.new(max_dict_size)` | Create a trainer (capped at 65535) |
|
|
116
|
-
| | `#add_sample(string)` | Feed a training sample |
|
|
117
|
-
| | `#train` | Consume the trainer, return dict bytes |
|
|
118
|
-
| | `#sample_count` | Number of accepted samples |
|
|
119
|
-
| | `#total_bytes` | Total bytes of accepted samples |
|
|
120
|
-
| | `#trained?` | Whether `#train` has been called |
|
|
121
|
-
| | `#max_dict_size` | Configured max dict size |
|
|
122
|
-
| `Lz4rip` | `.compress_bound(size)` | Max compressed output size for a given input size |
|
|
123
|
-
| | `.block_stream_size` | Internal compressor heap size |
|
|
124
|
-
| `Lz4rip::DecompressError` | | Raised on decompression failure (subclass of `StandardError`) |
|
|
100
|
+
## Documentation
|
|
101
|
+
|
|
102
|
+
Reference: <https://rubydoc.info/gems/lz4rip>
|
|
125
103
|
|
|
126
104
|
## License
|
|
127
105
|
|
data/ext/lz4rip/Cargo.toml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "lz4rip"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
edition = "2021"
|
|
5
|
+
build = "build.rs"
|
|
5
6
|
|
|
6
7
|
[lib]
|
|
7
8
|
name = "lz4rip"
|
|
8
9
|
crate-type = ["cdylib", "rlib"]
|
|
9
10
|
|
|
10
11
|
[dependencies]
|
|
11
|
-
lz4 = { version = "0.
|
|
12
|
-
magnus = "0.8"
|
|
12
|
+
lz4 = { version = "0.11.3", package = "lz4rip" }
|
|
13
13
|
rb-sys = "0.9"
|
|
14
14
|
|
|
15
15
|
[build-dependencies]
|
data/ext/lz4rip/build.rs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
use std::process::Command;
|
|
2
|
+
|
|
3
|
+
fn main() {
|
|
4
|
+
println!("cargo:rerun-if-env-changed=RUBY");
|
|
5
|
+
println!("cargo:rustc-check-cfg=cfg(ruby_engine, values(\"mri\", \"truffleruby\"))");
|
|
6
|
+
|
|
7
|
+
let ruby = std::env::var("RUBY").unwrap_or_else(|_| "ruby".to_string());
|
|
8
|
+
let output = Command::new(&ruby)
|
|
9
|
+
.arg("-rrbconfig")
|
|
10
|
+
.arg("-e")
|
|
11
|
+
.arg("print RbConfig::CONFIG.fetch('ruby_install_name')")
|
|
12
|
+
.output()
|
|
13
|
+
.unwrap_or_else(|err| panic!("failed to run {ruby}: {err}"));
|
|
14
|
+
|
|
15
|
+
if !output.status.success() {
|
|
16
|
+
panic!("failed to query Ruby engine with {ruby}");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
match String::from_utf8_lossy(&output.stdout).trim() {
|
|
20
|
+
"truffleruby" => println!("cargo:rustc-cfg=ruby_engine=\"truffleruby\""),
|
|
21
|
+
_ => println!("cargo:rustc-cfg=ruby_engine=\"mri\""),
|
|
22
|
+
}
|
|
23
|
+
}
|