rubygems-update 3.3.10 → 3.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Manifest.txt +14 -0
- data/bundler/CHANGELOG.md +11 -0
- data/bundler/exe/bundler +1 -1
- data/bundler/lib/bundler/build_metadata.rb +3 -3
- data/bundler/lib/bundler/cli/info.rb +1 -1
- data/bundler/lib/bundler/cli/init.rb +1 -1
- data/bundler/lib/bundler/cli/show.rb +1 -1
- data/bundler/lib/bundler/cli.rb +1 -1
- data/bundler/lib/bundler/installer.rb +2 -2
- data/bundler/lib/bundler/man/bundle-config.1 +3 -3
- data/bundler/lib/bundler/man/bundle-config.1.ronn +8 -6
- data/bundler/lib/bundler/shared_helpers.rb +4 -4
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/templates/Executable +2 -4
- data/bundler/lib/bundler/templates/Executable.bundler +1 -1
- data/bundler/lib/bundler/templates/Executable.standalone +2 -4
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/ext/builder.rb +3 -0
- data/lib/rubygems/ext/cargo_builder.rb +305 -0
- data/lib/rubygems/ext/ext_conf_builder.rb +1 -1
- data/lib/rubygems/ext.rb +1 -0
- data/lib/rubygems/gemcutter_utilities.rb +34 -5
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/source/git.rb +1 -0
- data/lib/rubygems.rb +2 -2
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +1 -1
- data/test/rubygems/helper.rb +5 -5
- data/test/rubygems/test_gem.rb +1 -1
- data/test/rubygems/test_gem_command_manager.rb +1 -1
- data/test/rubygems/test_gem_commands_help_command.rb +1 -1
- data/test/rubygems/test_gem_commands_push_command.rb +5 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +1 -1
- data/test/rubygems/test_gem_commands_signin_command.rb +100 -11
- data/test/rubygems/test_gem_dependency_installer.rb +2 -2
- data/test/rubygems/test_gem_ext_builder.rb +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +374 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +21 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/src/lib.rs +30 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +374 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +21 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +42 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +148 -0
- data/test/rubygems/test_gem_ext_cmake_builder.rb +2 -0
- data/test/rubygems/test_gem_gemcutter_utilities.rb +4 -2
- data/test/rubygems/test_gem_source_git.rb +1 -0
- data/test/rubygems/test_gem_specification.rb +1 -1
- data/test/rubygems/test_project_sanity.rb +1 -1
- data/test/rubygems/test_require.rb +1 -1
- data/test/test_changelog_generator.rb +1 -0
- metadata +17 -3
@@ -0,0 +1,374 @@
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
2
|
+
# It is not intended for manual editing.
|
3
|
+
version = 3
|
4
|
+
|
5
|
+
[[package]]
|
6
|
+
name = "aho-corasick"
|
7
|
+
version = "0.7.18"
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
+
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
10
|
+
dependencies = [
|
11
|
+
"memchr",
|
12
|
+
]
|
13
|
+
|
14
|
+
[[package]]
|
15
|
+
name = "atty"
|
16
|
+
version = "0.2.14"
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
18
|
+
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
19
|
+
dependencies = [
|
20
|
+
"hermit-abi",
|
21
|
+
"libc",
|
22
|
+
"winapi",
|
23
|
+
]
|
24
|
+
|
25
|
+
[[package]]
|
26
|
+
name = "autocfg"
|
27
|
+
version = "1.1.0"
|
28
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
29
|
+
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
30
|
+
|
31
|
+
[[package]]
|
32
|
+
name = "bindgen"
|
33
|
+
version = "0.59.2"
|
34
|
+
source = "git+https://github.com/rust-lang/rust-bindgen?rev=f34e4103f304500c96d332f5cecc9067c980d0f9#f34e4103f304500c96d332f5cecc9067c980d0f9"
|
35
|
+
dependencies = [
|
36
|
+
"bitflags",
|
37
|
+
"cexpr",
|
38
|
+
"clang-sys",
|
39
|
+
"clap",
|
40
|
+
"env_logger",
|
41
|
+
"lazy_static",
|
42
|
+
"lazycell",
|
43
|
+
"log",
|
44
|
+
"peeking_take_while",
|
45
|
+
"proc-macro2",
|
46
|
+
"quote",
|
47
|
+
"regex",
|
48
|
+
"rustc-hash",
|
49
|
+
"shlex",
|
50
|
+
"which",
|
51
|
+
]
|
52
|
+
|
53
|
+
[[package]]
|
54
|
+
name = "bitflags"
|
55
|
+
version = "1.3.2"
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
57
|
+
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
58
|
+
|
59
|
+
[[package]]
|
60
|
+
name = "cexpr"
|
61
|
+
version = "0.6.0"
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
63
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
64
|
+
dependencies = [
|
65
|
+
"nom",
|
66
|
+
]
|
67
|
+
|
68
|
+
[[package]]
|
69
|
+
name = "cfg-if"
|
70
|
+
version = "1.0.0"
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
72
|
+
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
73
|
+
|
74
|
+
[[package]]
|
75
|
+
name = "clang-sys"
|
76
|
+
version = "1.3.1"
|
77
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
78
|
+
checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21"
|
79
|
+
dependencies = [
|
80
|
+
"glob",
|
81
|
+
"libc",
|
82
|
+
"libloading",
|
83
|
+
]
|
84
|
+
|
85
|
+
[[package]]
|
86
|
+
name = "clap"
|
87
|
+
version = "3.1.5"
|
88
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
89
|
+
checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312"
|
90
|
+
dependencies = [
|
91
|
+
"atty",
|
92
|
+
"bitflags",
|
93
|
+
"indexmap",
|
94
|
+
"os_str_bytes",
|
95
|
+
"strsim",
|
96
|
+
"termcolor",
|
97
|
+
"textwrap",
|
98
|
+
]
|
99
|
+
|
100
|
+
[[package]]
|
101
|
+
name = "either"
|
102
|
+
version = "1.6.1"
|
103
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
104
|
+
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
105
|
+
|
106
|
+
[[package]]
|
107
|
+
name = "env_logger"
|
108
|
+
version = "0.9.0"
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
110
|
+
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
|
111
|
+
dependencies = [
|
112
|
+
"atty",
|
113
|
+
"humantime",
|
114
|
+
"log",
|
115
|
+
"regex",
|
116
|
+
"termcolor",
|
117
|
+
]
|
118
|
+
|
119
|
+
[[package]]
|
120
|
+
name = "glob"
|
121
|
+
version = "0.3.0"
|
122
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
123
|
+
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
124
|
+
|
125
|
+
[[package]]
|
126
|
+
name = "hashbrown"
|
127
|
+
version = "0.11.2"
|
128
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
129
|
+
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
130
|
+
|
131
|
+
[[package]]
|
132
|
+
name = "hermit-abi"
|
133
|
+
version = "0.1.19"
|
134
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
135
|
+
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
136
|
+
dependencies = [
|
137
|
+
"libc",
|
138
|
+
]
|
139
|
+
|
140
|
+
[[package]]
|
141
|
+
name = "humantime"
|
142
|
+
version = "2.1.0"
|
143
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
144
|
+
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
145
|
+
|
146
|
+
[[package]]
|
147
|
+
name = "indexmap"
|
148
|
+
version = "1.8.0"
|
149
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
150
|
+
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
|
151
|
+
dependencies = [
|
152
|
+
"autocfg",
|
153
|
+
"hashbrown",
|
154
|
+
]
|
155
|
+
|
156
|
+
[[package]]
|
157
|
+
name = "lazy_static"
|
158
|
+
version = "1.4.0"
|
159
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
160
|
+
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
161
|
+
|
162
|
+
[[package]]
|
163
|
+
name = "lazycell"
|
164
|
+
version = "1.3.0"
|
165
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
166
|
+
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
167
|
+
|
168
|
+
[[package]]
|
169
|
+
name = "libc"
|
170
|
+
version = "0.2.119"
|
171
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
172
|
+
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
|
173
|
+
|
174
|
+
[[package]]
|
175
|
+
name = "libloading"
|
176
|
+
version = "0.7.3"
|
177
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
178
|
+
checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd"
|
179
|
+
dependencies = [
|
180
|
+
"cfg-if",
|
181
|
+
"winapi",
|
182
|
+
]
|
183
|
+
|
184
|
+
[[package]]
|
185
|
+
name = "log"
|
186
|
+
version = "0.4.14"
|
187
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
188
|
+
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
189
|
+
dependencies = [
|
190
|
+
"cfg-if",
|
191
|
+
]
|
192
|
+
|
193
|
+
[[package]]
|
194
|
+
name = "memchr"
|
195
|
+
version = "2.4.1"
|
196
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
197
|
+
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
198
|
+
|
199
|
+
[[package]]
|
200
|
+
name = "minimal-lexical"
|
201
|
+
version = "0.2.1"
|
202
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
203
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
204
|
+
|
205
|
+
[[package]]
|
206
|
+
name = "nom"
|
207
|
+
version = "7.1.0"
|
208
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
209
|
+
checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"
|
210
|
+
dependencies = [
|
211
|
+
"memchr",
|
212
|
+
"minimal-lexical",
|
213
|
+
"version_check",
|
214
|
+
]
|
215
|
+
|
216
|
+
[[package]]
|
217
|
+
name = "os_str_bytes"
|
218
|
+
version = "6.0.0"
|
219
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
220
|
+
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
|
221
|
+
dependencies = [
|
222
|
+
"memchr",
|
223
|
+
]
|
224
|
+
|
225
|
+
[[package]]
|
226
|
+
name = "peeking_take_while"
|
227
|
+
version = "0.1.2"
|
228
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
229
|
+
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
230
|
+
|
231
|
+
[[package]]
|
232
|
+
name = "pkg-config"
|
233
|
+
version = "0.3.24"
|
234
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
235
|
+
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
236
|
+
|
237
|
+
[[package]]
|
238
|
+
name = "proc-macro2"
|
239
|
+
version = "1.0.36"
|
240
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
241
|
+
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
242
|
+
dependencies = [
|
243
|
+
"unicode-xid",
|
244
|
+
]
|
245
|
+
|
246
|
+
[[package]]
|
247
|
+
name = "quote"
|
248
|
+
version = "1.0.15"
|
249
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
250
|
+
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
|
251
|
+
dependencies = [
|
252
|
+
"proc-macro2",
|
253
|
+
]
|
254
|
+
|
255
|
+
[[package]]
|
256
|
+
name = "rb-sys"
|
257
|
+
version = "0.6.0"
|
258
|
+
source = "git+https://github.com/ianks/rb-sys?tag=v0.6.0#1aa5b589e86a14e01aba806511818c19f85d71f6"
|
259
|
+
dependencies = [
|
260
|
+
"bindgen",
|
261
|
+
"libc",
|
262
|
+
"pkg-config",
|
263
|
+
]
|
264
|
+
|
265
|
+
[[package]]
|
266
|
+
name = "regex"
|
267
|
+
version = "1.5.4"
|
268
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
269
|
+
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
270
|
+
dependencies = [
|
271
|
+
"aho-corasick",
|
272
|
+
"memchr",
|
273
|
+
"regex-syntax",
|
274
|
+
]
|
275
|
+
|
276
|
+
[[package]]
|
277
|
+
name = "regex-syntax"
|
278
|
+
version = "0.6.25"
|
279
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
280
|
+
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
281
|
+
|
282
|
+
[[package]]
|
283
|
+
name = "rust_ruby_example"
|
284
|
+
version = "0.1.0"
|
285
|
+
dependencies = [
|
286
|
+
"rb-sys",
|
287
|
+
]
|
288
|
+
|
289
|
+
[[package]]
|
290
|
+
name = "rustc-hash"
|
291
|
+
version = "1.1.0"
|
292
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
293
|
+
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
294
|
+
|
295
|
+
[[package]]
|
296
|
+
name = "shlex"
|
297
|
+
version = "1.1.0"
|
298
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
299
|
+
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
300
|
+
|
301
|
+
[[package]]
|
302
|
+
name = "strsim"
|
303
|
+
version = "0.10.0"
|
304
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
305
|
+
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
306
|
+
|
307
|
+
[[package]]
|
308
|
+
name = "termcolor"
|
309
|
+
version = "1.1.3"
|
310
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
311
|
+
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
312
|
+
dependencies = [
|
313
|
+
"winapi-util",
|
314
|
+
]
|
315
|
+
|
316
|
+
[[package]]
|
317
|
+
name = "textwrap"
|
318
|
+
version = "0.15.0"
|
319
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
320
|
+
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
321
|
+
|
322
|
+
[[package]]
|
323
|
+
name = "unicode-xid"
|
324
|
+
version = "0.2.2"
|
325
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
326
|
+
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
327
|
+
|
328
|
+
[[package]]
|
329
|
+
name = "version_check"
|
330
|
+
version = "0.9.4"
|
331
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
332
|
+
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
333
|
+
|
334
|
+
[[package]]
|
335
|
+
name = "which"
|
336
|
+
version = "4.2.4"
|
337
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
338
|
+
checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2"
|
339
|
+
dependencies = [
|
340
|
+
"either",
|
341
|
+
"lazy_static",
|
342
|
+
"libc",
|
343
|
+
]
|
344
|
+
|
345
|
+
[[package]]
|
346
|
+
name = "winapi"
|
347
|
+
version = "0.3.9"
|
348
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
349
|
+
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
350
|
+
dependencies = [
|
351
|
+
"winapi-i686-pc-windows-gnu",
|
352
|
+
"winapi-x86_64-pc-windows-gnu",
|
353
|
+
]
|
354
|
+
|
355
|
+
[[package]]
|
356
|
+
name = "winapi-i686-pc-windows-gnu"
|
357
|
+
version = "0.4.0"
|
358
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
359
|
+
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
360
|
+
|
361
|
+
[[package]]
|
362
|
+
name = "winapi-util"
|
363
|
+
version = "0.1.5"
|
364
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
365
|
+
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
366
|
+
dependencies = [
|
367
|
+
"winapi",
|
368
|
+
]
|
369
|
+
|
370
|
+
[[package]]
|
371
|
+
name = "winapi-x86_64-pc-windows-gnu"
|
372
|
+
version = "0.4.0"
|
373
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
374
|
+
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
if ENV['RUBYOPT'] or defined? Gem
|
2
|
+
ENV.delete 'RUBYOPT'
|
3
|
+
|
4
|
+
require 'rbconfig'
|
5
|
+
cmd = [RbConfig.ruby, '--disable-gems', 'build.rb', *ARGV]
|
6
|
+
|
7
|
+
exec(*cmd)
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'tmpdir'
|
11
|
+
|
12
|
+
lp = File.expand_path('../../../../lib', __dir__)
|
13
|
+
gem = ["ruby", "-I#{lp}", File.expand_path('../../../../bin/gem', __dir__)]
|
14
|
+
gemspec = File.expand_path('rust_ruby_example.gemspec', __dir__)
|
15
|
+
|
16
|
+
Dir.mktmpdir("rust_ruby_example") do |dir|
|
17
|
+
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
|
18
|
+
system *gem, "build", gemspec, "--output", built_gem
|
19
|
+
system *gem, "install", "--verbose", "--local", built_gem, *ARGV
|
20
|
+
system %q(ruby -rrust_ruby_example -e "puts 'Result: ' + RustRubyExample.reverse('hello world')")
|
21
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#[macro_use]
|
2
|
+
extern crate rb_sys;
|
3
|
+
|
4
|
+
use rb_sys::{
|
5
|
+
rb_define_module, rb_define_module_function, rb_string_value_cstr, rb_utf8_str_new, VALUE,
|
6
|
+
};
|
7
|
+
use std::ffi::{CStr, CString};
|
8
|
+
use std::os::raw::{c_char, c_long};
|
9
|
+
|
10
|
+
ruby_extension!();
|
11
|
+
|
12
|
+
#[inline]
|
13
|
+
unsafe fn cstr_to_string(str: *const c_char) -> String {
|
14
|
+
CStr::from_ptr(str).to_string_lossy().into_owned()
|
15
|
+
}
|
16
|
+
|
17
|
+
#[no_mangle]
|
18
|
+
unsafe extern "C" fn pub_reverse(_klass: VALUE, mut input: VALUE) -> VALUE {
|
19
|
+
let ruby_string = cstr_to_string(rb_string_value_cstr(&mut input));
|
20
|
+
let reversed = ruby_string.to_string().chars().rev().collect::<String>();
|
21
|
+
let reversed_cstring = CString::new(reversed).unwrap();
|
22
|
+
let size = ruby_string.len() as c_long;
|
23
|
+
|
24
|
+
rb_utf8_str_new(reversed_cstring.as_ptr(), size)
|
25
|
+
}
|
26
|
+
|
27
|
+
#[allow(non_snake_case)]
|
28
|
+
#[no_mangle]
|
29
|
+
pub extern "C" fn Init_rust_ruby_example() {
|
30
|
+
let name = CString::new("RustRubyExample").unwrap();
|
31
|
+
let function_name = CString::new("reverse").unwrap();
|
32
|
+
// bindgen does not properly detect the arity of the ruby callback function, so we have to transmute
|
33
|
+
let callback = unsafe {
|
34
|
+
std::mem::transmute::<
|
35
|
+
unsafe extern "C" fn(VALUE, VALUE) -> VALUE,
|
36
|
+
unsafe extern "C" fn() -> VALUE,
|
37
|
+
>(pub_reverse)
|
38
|
+
};
|
39
|
+
let klass = unsafe { rb_define_module(name.as_ptr()) };
|
40
|
+
|
41
|
+
unsafe { rb_define_module_function(klass, function_name.as_ptr(), Some(callback), 1) }
|
42
|
+
}
|
@@ -0,0 +1,148 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'helper'
|
3
|
+
require 'rubygems/ext'
|
4
|
+
|
5
|
+
class TestGemExtCargoBuilder < Gem::TestCase
|
6
|
+
def setup
|
7
|
+
@orig_env = ENV.to_hash
|
8
|
+
|
9
|
+
@rust_envs = {
|
10
|
+
'CARGO_HOME' => File.join(@orig_env['HOME'], '.cargo'),
|
11
|
+
'RUSTUP_HOME' => File.join(@orig_env['HOME'], '.rustup'),
|
12
|
+
}
|
13
|
+
|
14
|
+
system(@rust_envs, 'cargo', '-V', out: IO::NULL, err: [:child, :out])
|
15
|
+
pend 'cargo not present' unless $?.success?
|
16
|
+
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def setup_rust_gem(name)
|
21
|
+
@ext = File.join(@tempdir, 'ext')
|
22
|
+
@dest_path = File.join(@tempdir, 'prefix')
|
23
|
+
@fixture_dir = Pathname.new(File.expand_path("test_gem_ext_cargo_builder/#{name}/", __dir__))
|
24
|
+
|
25
|
+
FileUtils.mkdir_p @dest_path
|
26
|
+
FileUtils.cp_r(@fixture_dir.to_s, @ext)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_build_staticlib
|
30
|
+
skip_unsupported_platforms!
|
31
|
+
setup_rust_gem "rust_ruby_example"
|
32
|
+
|
33
|
+
content = @fixture_dir.join('Cargo.toml').read.gsub("cdylib", "staticlib")
|
34
|
+
File.write(File.join(@ext, 'Cargo.toml'), content)
|
35
|
+
|
36
|
+
output = []
|
37
|
+
|
38
|
+
Dir.chdir @ext do
|
39
|
+
ENV.update(@rust_envs)
|
40
|
+
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
|
41
|
+
builder = Gem::Ext::CargoBuilder.new(spec)
|
42
|
+
assert_raise(Gem::Ext::CargoBuilder::DylibNotFoundError) do
|
43
|
+
builder.build nil, @dest_path, output
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_build_cdylib
|
49
|
+
skip_unsupported_platforms!
|
50
|
+
setup_rust_gem "rust_ruby_example"
|
51
|
+
|
52
|
+
output = []
|
53
|
+
|
54
|
+
Dir.chdir @ext do
|
55
|
+
ENV.update(@rust_envs)
|
56
|
+
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
|
57
|
+
builder = Gem::Ext::CargoBuilder.new(spec)
|
58
|
+
builder.build nil, @dest_path, output
|
59
|
+
end
|
60
|
+
|
61
|
+
output = output.join "\n"
|
62
|
+
|
63
|
+
bundle = File.join(@dest_path, "release/rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}")
|
64
|
+
|
65
|
+
require(bundle)
|
66
|
+
|
67
|
+
assert_match RustRubyExample.reverse('hello'), 'olleh'
|
68
|
+
|
69
|
+
assert_match "Compiling rust_ruby_example v0.1.0", output
|
70
|
+
assert_match "Finished release [optimized] target(s)", output
|
71
|
+
rescue Exception => e
|
72
|
+
pp output if output
|
73
|
+
|
74
|
+
raise(e)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_build_fail
|
78
|
+
skip_unsupported_platforms!
|
79
|
+
setup_rust_gem "rust_ruby_example"
|
80
|
+
|
81
|
+
output = []
|
82
|
+
|
83
|
+
FileUtils.rm(File.join(@ext, 'src/lib.rs'))
|
84
|
+
|
85
|
+
error = assert_raise(Gem::InstallError) do
|
86
|
+
Dir.chdir @ext do
|
87
|
+
ENV.update(@rust_envs)
|
88
|
+
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
|
89
|
+
builder = Gem::Ext::CargoBuilder.new(spec)
|
90
|
+
builder.build nil, @dest_path, output
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
output = output.join "\n"
|
95
|
+
|
96
|
+
assert_match 'cargo failed', error.message
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_full_integration
|
100
|
+
skip_unsupported_platforms!
|
101
|
+
setup_rust_gem "rust_ruby_example"
|
102
|
+
|
103
|
+
Dir.chdir @ext do
|
104
|
+
require 'tmpdir'
|
105
|
+
|
106
|
+
gem = [@rust_envs, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)]
|
107
|
+
|
108
|
+
Dir.mktmpdir("rust_ruby_example") do |dir|
|
109
|
+
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
|
110
|
+
Open3.capture2e(*gem, "build", "rust_ruby_example.gemspec", "--output", built_gem)
|
111
|
+
Open3.capture2e(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
|
112
|
+
end
|
113
|
+
|
114
|
+
stdout_and_stderr_str, status = Open3.capture2e(@rust_envs, *ruby_with_rubygems_in_load_path, "-rrust_ruby_example", "-e", "puts 'Result: ' + RustRubyExample.reverse('hello world')")
|
115
|
+
|
116
|
+
assert status.success?, stdout_and_stderr_str
|
117
|
+
assert_match "Result: #{"hello world".reverse}", stdout_and_stderr_str
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_custom_name
|
122
|
+
skip_unsupported_platforms!
|
123
|
+
setup_rust_gem "custom_name"
|
124
|
+
|
125
|
+
Dir.chdir @ext do
|
126
|
+
require 'tmpdir'
|
127
|
+
|
128
|
+
gem = [@rust_envs, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)]
|
129
|
+
|
130
|
+
Dir.mktmpdir("custom_name") do |dir|
|
131
|
+
built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
|
132
|
+
Open3.capture2e(*gem, "build", "custom_name.gemspec", "--output", built_gem)
|
133
|
+
Open3.capture2e(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
|
134
|
+
end
|
135
|
+
|
136
|
+
stdout_and_stderr_str, status = Open3.capture2e(@rust_envs, *ruby_with_rubygems_in_load_path, "-rcustom_name", "-e", "puts 'Result: ' + CustomName.say_hello")
|
137
|
+
|
138
|
+
assert status.success?, stdout_and_stderr_str
|
139
|
+
assert_match "Result: Hello world!", stdout_and_stderr_str
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def skip_unsupported_platforms!
|
144
|
+
pend "jruby not supported" if java_platform?
|
145
|
+
pend "truffleruby not supported (yet)" if RUBY_ENGINE == 'truffleruby'
|
146
|
+
pend "mswin not supported (yet)" if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS')
|
147
|
+
end
|
148
|
+
end
|
@@ -9,6 +9,8 @@ class TestGemExtCmakeBuilder < Gem::TestCase
|
|
9
9
|
# Details: https://github.com/rubygems/rubygems/issues/1270#issuecomment-177368340
|
10
10
|
pend "CmakeBuilder doesn't work on Windows." if Gem.win_platform?
|
11
11
|
|
12
|
+
require "open3"
|
13
|
+
|
12
14
|
begin
|
13
15
|
_, status = Open3.capture2e('cmake')
|
14
16
|
pend 'cmake not present' unless status.success?
|
@@ -227,8 +227,9 @@ class TestGemGemcutterUtilities < Gem::TestCase
|
|
227
227
|
end
|
228
228
|
|
229
229
|
def util_sign_in(response, host = nil, args = [], extra_input = '')
|
230
|
-
email
|
231
|
-
password
|
230
|
+
email = 'you@example.com'
|
231
|
+
password = 'secret'
|
232
|
+
profile_response = [ "mfa: disabled\n" , 200, 'OK']
|
232
233
|
|
233
234
|
if host
|
234
235
|
ENV['RUBYGEMS_HOST'] = host
|
@@ -238,6 +239,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
|
|
238
239
|
|
239
240
|
@fetcher = Gem::FakeFetcher.new
|
240
241
|
@fetcher.data["#{host}/api/v1/api_key"] = response
|
242
|
+
@fetcher.data["#{host}/api/v1/profile/me.yaml"] = profile_response
|
241
243
|
Gem::RemoteFetcher.fetcher = @fetcher
|
242
244
|
|
243
245
|
@sign_in_ui = Gem::MockGemUi.new("#{email}\n#{password}\n\n\n\n\n\n\n\n\n" + extra_input)
|
@@ -1068,7 +1068,7 @@ dependencies: []
|
|
1068
1068
|
end
|
1069
1069
|
|
1070
1070
|
def test_handles_private_null_type
|
1071
|
-
path = File.expand_path
|
1071
|
+
path = File.expand_path 'data/null-type.gemspec.rz', __dir__
|
1072
1072
|
|
1073
1073
|
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
|
1074
1074
|
|
@@ -5,7 +5,7 @@ require "open3"
|
|
5
5
|
|
6
6
|
class TestProjectSanity < Gem::TestCase
|
7
7
|
def test_manifest_is_up_to_date
|
8
|
-
pend unless File.exist?(File.expand_path(
|
8
|
+
pend unless File.exist?(File.expand_path('../../Rakefile', __dir__))
|
9
9
|
|
10
10
|
_, status = Open3.capture2e("rake check_manifest")
|
11
11
|
|
@@ -230,7 +230,7 @@ class TestGemRequire < Gem::TestCase
|
|
230
230
|
|
231
231
|
pend "not installed yet" unless RbConfig::TOPDIR
|
232
232
|
|
233
|
-
lib_dir = File.expand_path("
|
233
|
+
lib_dir = File.expand_path("../lib", __dir__)
|
234
234
|
rubylibdir = File.realdirpath(RbConfig::CONFIG["rubylibdir"])
|
235
235
|
if rubylibdir == lib_dir
|
236
236
|
# testing in the ruby repository where RubyGems' lib/ == stdlib lib/
|