cruise 0.2.1 → 0.3.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/Cargo.lock +112 -227
- data/ext/cruise/Cargo.toml +4 -4
- data/ext/cruise/cruise.c +19 -0
- data/ext/cruise/src/ffi.rs +23 -0
- data/ext/cruise/src/watcher.rs +49 -8
- data/lib/cruise/version.rb +1 -1
- data/lib/cruise/watcher.rb +5 -0
- data/lib/cruise.rb +9 -2
- data/sig/cruise/types.rbs +2 -0
- data/sig/cruise/watcher.rbs +3 -0
- data/sig/cruise.rbs +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1aa956c44c1d6ca74c9678a1999bdcc7ad738d570efb10cc91d2eda6ad9fa704
|
|
4
|
+
data.tar.gz: 663c79b381b5e613c85f991eae48bcdc3f85180dfaa2eeee9211cca421baae69
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70e058d3bcce32818e2c5d9938a31ecc90c2b23dbf053561d9bed599271ba31747429ab309dc6f0cd0b5b721006c0dc8f7c51ddcf653f4a078db95241ba80ffa
|
|
7
|
+
data.tar.gz: 3ca83b1cc7ceebacf3d2085f20f97d0fd121cc7e0f550bf13be91e28470153b2a38e3c6b37255db6aced844526f6bb47a28210754560d747b0008f9ae1f18693
|
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
|
]
|
|
@@ -63,31 +63,25 @@ dependencies = [
|
|
|
63
63
|
|
|
64
64
|
[[package]]
|
|
65
65
|
name = "bitflags"
|
|
66
|
-
version = "
|
|
67
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
68
|
-
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
69
|
-
|
|
70
|
-
[[package]]
|
|
71
|
-
name = "bitflags"
|
|
72
|
-
version = "2.11.0"
|
|
66
|
+
version = "2.13.1"
|
|
73
67
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
-
checksum = "
|
|
68
|
+
checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
|
|
75
69
|
|
|
76
70
|
[[package]]
|
|
77
71
|
name = "bstr"
|
|
78
|
-
version = "1.
|
|
72
|
+
version = "1.13.1"
|
|
79
73
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
|
-
checksum = "
|
|
74
|
+
checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f"
|
|
81
75
|
dependencies = [
|
|
82
76
|
"memchr",
|
|
83
|
-
"
|
|
77
|
+
"serde_core",
|
|
84
78
|
]
|
|
85
79
|
|
|
86
80
|
[[package]]
|
|
87
81
|
name = "cbindgen"
|
|
88
|
-
version = "0.
|
|
82
|
+
version = "0.29.4"
|
|
89
83
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
-
checksum = "
|
|
84
|
+
checksum = "2ecb53484c9c167ba674026b656d8a27d7657a58e6066aa902bfb1a4aa00ae20"
|
|
91
85
|
dependencies = [
|
|
92
86
|
"clap",
|
|
93
87
|
"heck",
|
|
@@ -97,7 +91,7 @@ dependencies = [
|
|
|
97
91
|
"quote",
|
|
98
92
|
"serde",
|
|
99
93
|
"serde_json",
|
|
100
|
-
"syn",
|
|
94
|
+
"syn 2.0.119",
|
|
101
95
|
"tempfile",
|
|
102
96
|
"toml",
|
|
103
97
|
]
|
|
@@ -110,18 +104,18 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
|
110
104
|
|
|
111
105
|
[[package]]
|
|
112
106
|
name = "clap"
|
|
113
|
-
version = "4.6.
|
|
107
|
+
version = "4.6.6"
|
|
114
108
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
115
|
-
checksum = "
|
|
109
|
+
checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca"
|
|
116
110
|
dependencies = [
|
|
117
111
|
"clap_builder",
|
|
118
112
|
]
|
|
119
113
|
|
|
120
114
|
[[package]]
|
|
121
115
|
name = "clap_builder"
|
|
122
|
-
version = "4.6.
|
|
116
|
+
version = "4.6.6"
|
|
123
117
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
124
|
-
checksum = "
|
|
118
|
+
checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889"
|
|
125
119
|
dependencies = [
|
|
126
120
|
"anstream",
|
|
127
121
|
"anstyle",
|
|
@@ -143,7 +137,7 @@ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
|
|
|
143
137
|
|
|
144
138
|
[[package]]
|
|
145
139
|
name = "cruise"
|
|
146
|
-
version = "0.
|
|
140
|
+
version = "0.3.0"
|
|
147
141
|
dependencies = [
|
|
148
142
|
"cbindgen",
|
|
149
143
|
"globset",
|
|
@@ -183,17 +177,6 @@ dependencies = [
|
|
|
183
177
|
"windows-sys 0.60.2",
|
|
184
178
|
]
|
|
185
179
|
|
|
186
|
-
[[package]]
|
|
187
|
-
name = "filetime"
|
|
188
|
-
version = "0.2.27"
|
|
189
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
190
|
-
checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db"
|
|
191
|
-
dependencies = [
|
|
192
|
-
"cfg-if",
|
|
193
|
-
"libc",
|
|
194
|
-
"libredox",
|
|
195
|
-
]
|
|
196
|
-
|
|
197
180
|
[[package]]
|
|
198
181
|
name = "fsevent-sys"
|
|
199
182
|
version = "4.1.0"
|
|
@@ -216,9 +199,9 @@ dependencies = [
|
|
|
216
199
|
|
|
217
200
|
[[package]]
|
|
218
201
|
name = "globset"
|
|
219
|
-
version = "0.4.
|
|
202
|
+
version = "0.4.20"
|
|
220
203
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
221
|
-
checksum = "
|
|
204
|
+
checksum = "07c34a9410465b45bd9787443bc7370f37735bad04b0f0cd57ff1a3186c98988"
|
|
222
205
|
dependencies = [
|
|
223
206
|
"aho-corasick",
|
|
224
207
|
"bstr",
|
|
@@ -235,15 +218,15 @@ checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
|
|
235
218
|
|
|
236
219
|
[[package]]
|
|
237
220
|
name = "heck"
|
|
238
|
-
version = "0.
|
|
221
|
+
version = "0.5.0"
|
|
239
222
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
240
|
-
checksum = "
|
|
223
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
241
224
|
|
|
242
225
|
[[package]]
|
|
243
226
|
name = "indexmap"
|
|
244
|
-
version = "2.14.
|
|
227
|
+
version = "2.14.1"
|
|
245
228
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
246
|
-
checksum = "
|
|
229
|
+
checksum = "07aa2048142242915a31d35844fb311e0e53fcca590c3a0a40dcf1b841fa09eb"
|
|
247
230
|
dependencies = [
|
|
248
231
|
"equivalent",
|
|
249
232
|
"hashbrown",
|
|
@@ -251,33 +234,24 @@ dependencies = [
|
|
|
251
234
|
|
|
252
235
|
[[package]]
|
|
253
236
|
name = "inotify"
|
|
254
|
-
version = "0.
|
|
237
|
+
version = "0.11.5"
|
|
255
238
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
256
|
-
checksum = "
|
|
239
|
+
checksum = "4cc00ea907cab49550b7da656f80ebb97be1b997d931fbcd28d39734e17ce592"
|
|
257
240
|
dependencies = [
|
|
258
|
-
"bitflags
|
|
241
|
+
"bitflags",
|
|
259
242
|
"inotify-sys",
|
|
260
243
|
"libc",
|
|
261
244
|
]
|
|
262
245
|
|
|
263
246
|
[[package]]
|
|
264
247
|
name = "inotify-sys"
|
|
265
|
-
version = "0.1.
|
|
248
|
+
version = "0.1.8"
|
|
266
249
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
267
|
-
checksum = "
|
|
250
|
+
checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d"
|
|
268
251
|
dependencies = [
|
|
269
252
|
"libc",
|
|
270
253
|
]
|
|
271
254
|
|
|
272
|
-
[[package]]
|
|
273
|
-
name = "instant"
|
|
274
|
-
version = "0.1.13"
|
|
275
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
276
|
-
checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
|
|
277
|
-
dependencies = [
|
|
278
|
-
"cfg-if",
|
|
279
|
-
]
|
|
280
|
-
|
|
281
255
|
[[package]]
|
|
282
256
|
name = "is_terminal_polyfill"
|
|
283
257
|
version = "1.70.2"
|
|
@@ -292,9 +266,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|
|
292
266
|
|
|
293
267
|
[[package]]
|
|
294
268
|
name = "kqueue"
|
|
295
|
-
version = "1.
|
|
269
|
+
version = "1.2.1"
|
|
296
270
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
297
|
-
checksum = "
|
|
271
|
+
checksum = "8d763e5b24120b4ddf50de6c92308156765aabfbbccebf401da7cff2d70a41ea"
|
|
298
272
|
dependencies = [
|
|
299
273
|
"kqueue-sys",
|
|
300
274
|
"libc",
|
|
@@ -302,31 +276,19 @@ dependencies = [
|
|
|
302
276
|
|
|
303
277
|
[[package]]
|
|
304
278
|
name = "kqueue-sys"
|
|
305
|
-
version = "1.
|
|
279
|
+
version = "1.1.2"
|
|
306
280
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
307
|
-
checksum = "
|
|
281
|
+
checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087"
|
|
308
282
|
dependencies = [
|
|
309
|
-
"bitflags
|
|
283
|
+
"bitflags",
|
|
310
284
|
"libc",
|
|
311
285
|
]
|
|
312
286
|
|
|
313
287
|
[[package]]
|
|
314
288
|
name = "libc"
|
|
315
|
-
version = "0.2.
|
|
289
|
+
version = "0.2.189"
|
|
316
290
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
317
|
-
checksum = "
|
|
318
|
-
|
|
319
|
-
[[package]]
|
|
320
|
-
name = "libredox"
|
|
321
|
-
version = "0.1.14"
|
|
322
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
323
|
-
checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a"
|
|
324
|
-
dependencies = [
|
|
325
|
-
"bitflags 2.11.0",
|
|
326
|
-
"libc",
|
|
327
|
-
"plain",
|
|
328
|
-
"redox_syscall",
|
|
329
|
-
]
|
|
291
|
+
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
330
292
|
|
|
331
293
|
[[package]]
|
|
332
294
|
name = "linux-raw-sys"
|
|
@@ -336,21 +298,21 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
|
|
336
298
|
|
|
337
299
|
[[package]]
|
|
338
300
|
name = "log"
|
|
339
|
-
version = "0.4.
|
|
301
|
+
version = "0.4.34"
|
|
340
302
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
341
|
-
checksum = "
|
|
303
|
+
checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
|
342
304
|
|
|
343
305
|
[[package]]
|
|
344
306
|
name = "memchr"
|
|
345
|
-
version = "2.8.
|
|
307
|
+
version = "2.8.3"
|
|
346
308
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
347
|
-
checksum = "
|
|
309
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
348
310
|
|
|
349
311
|
[[package]]
|
|
350
312
|
name = "mio"
|
|
351
|
-
version = "1.
|
|
313
|
+
version = "1.2.3"
|
|
352
314
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
353
|
-
checksum = "
|
|
315
|
+
checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8"
|
|
354
316
|
dependencies = [
|
|
355
317
|
"libc",
|
|
356
318
|
"log",
|
|
@@ -360,12 +322,11 @@ dependencies = [
|
|
|
360
322
|
|
|
361
323
|
[[package]]
|
|
362
324
|
name = "notify"
|
|
363
|
-
version = "
|
|
325
|
+
version = "8.2.0"
|
|
364
326
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
365
|
-
checksum = "
|
|
327
|
+
checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3"
|
|
366
328
|
dependencies = [
|
|
367
|
-
"bitflags
|
|
368
|
-
"filetime",
|
|
329
|
+
"bitflags",
|
|
369
330
|
"fsevent-sys",
|
|
370
331
|
"inotify",
|
|
371
332
|
"kqueue",
|
|
@@ -374,14 +335,14 @@ dependencies = [
|
|
|
374
335
|
"mio",
|
|
375
336
|
"notify-types",
|
|
376
337
|
"walkdir",
|
|
377
|
-
"windows-sys 0.
|
|
338
|
+
"windows-sys 0.60.2",
|
|
378
339
|
]
|
|
379
340
|
|
|
380
341
|
[[package]]
|
|
381
342
|
name = "notify-debouncer-full"
|
|
382
|
-
version = "0.
|
|
343
|
+
version = "0.7.0"
|
|
383
344
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
384
|
-
checksum = "
|
|
345
|
+
checksum = "c02b49179cfebc9932238d04d6079912d26de0379328872846118a0fa0dbb302"
|
|
385
346
|
dependencies = [
|
|
386
347
|
"file-id",
|
|
387
348
|
"log",
|
|
@@ -392,11 +353,11 @@ dependencies = [
|
|
|
392
353
|
|
|
393
354
|
[[package]]
|
|
394
355
|
name = "notify-types"
|
|
395
|
-
version = "1.0
|
|
356
|
+
version = "2.1.0"
|
|
396
357
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
397
|
-
checksum = "
|
|
358
|
+
checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a"
|
|
398
359
|
dependencies = [
|
|
399
|
-
"
|
|
360
|
+
"bitflags",
|
|
400
361
|
]
|
|
401
362
|
|
|
402
363
|
[[package]]
|
|
@@ -411,26 +372,20 @@ version = "1.70.2"
|
|
|
411
372
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
412
373
|
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
|
413
374
|
|
|
414
|
-
[[package]]
|
|
415
|
-
name = "plain"
|
|
416
|
-
version = "0.2.3"
|
|
417
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
418
|
-
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
|
419
|
-
|
|
420
375
|
[[package]]
|
|
421
376
|
name = "proc-macro2"
|
|
422
|
-
version = "1.0.
|
|
377
|
+
version = "1.0.107"
|
|
423
378
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
424
|
-
checksum = "
|
|
379
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
425
380
|
dependencies = [
|
|
426
381
|
"unicode-ident",
|
|
427
382
|
]
|
|
428
383
|
|
|
429
384
|
[[package]]
|
|
430
385
|
name = "quote"
|
|
431
|
-
version = "1.0.
|
|
386
|
+
version = "1.0.47"
|
|
432
387
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
433
|
-
checksum = "
|
|
388
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
434
389
|
dependencies = [
|
|
435
390
|
"proc-macro2",
|
|
436
391
|
]
|
|
@@ -441,20 +396,11 @@ version = "6.0.0"
|
|
|
441
396
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
442
397
|
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
|
443
398
|
|
|
444
|
-
[[package]]
|
|
445
|
-
name = "redox_syscall"
|
|
446
|
-
version = "0.7.3"
|
|
447
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
448
|
-
checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16"
|
|
449
|
-
dependencies = [
|
|
450
|
-
"bitflags 2.11.0",
|
|
451
|
-
]
|
|
452
|
-
|
|
453
399
|
[[package]]
|
|
454
400
|
name = "regex-automata"
|
|
455
|
-
version = "0.4.
|
|
401
|
+
version = "0.4.18"
|
|
456
402
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
457
|
-
checksum = "
|
|
403
|
+
checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
|
|
458
404
|
dependencies = [
|
|
459
405
|
"aho-corasick",
|
|
460
406
|
"memchr",
|
|
@@ -463,9 +409,9 @@ dependencies = [
|
|
|
463
409
|
|
|
464
410
|
[[package]]
|
|
465
411
|
name = "regex-syntax"
|
|
466
|
-
version = "0.8.
|
|
412
|
+
version = "0.8.11"
|
|
467
413
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
468
|
-
checksum = "
|
|
414
|
+
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
469
415
|
|
|
470
416
|
[[package]]
|
|
471
417
|
name = "rustix"
|
|
@@ -473,7 +419,7 @@ version = "1.1.4"
|
|
|
473
419
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
474
420
|
checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
|
|
475
421
|
dependencies = [
|
|
476
|
-
"bitflags
|
|
422
|
+
"bitflags",
|
|
477
423
|
"errno",
|
|
478
424
|
"libc",
|
|
479
425
|
"linux-raw-sys",
|
|
@@ -491,9 +437,9 @@ dependencies = [
|
|
|
491
437
|
|
|
492
438
|
[[package]]
|
|
493
439
|
name = "serde"
|
|
494
|
-
version = "1.0.
|
|
440
|
+
version = "1.0.229"
|
|
495
441
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
496
|
-
checksum = "
|
|
442
|
+
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
|
497
443
|
dependencies = [
|
|
498
444
|
"serde_core",
|
|
499
445
|
"serde_derive",
|
|
@@ -501,22 +447,22 @@ dependencies = [
|
|
|
501
447
|
|
|
502
448
|
[[package]]
|
|
503
449
|
name = "serde_core"
|
|
504
|
-
version = "1.0.
|
|
450
|
+
version = "1.0.229"
|
|
505
451
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
506
|
-
checksum = "
|
|
452
|
+
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
|
507
453
|
dependencies = [
|
|
508
454
|
"serde_derive",
|
|
509
455
|
]
|
|
510
456
|
|
|
511
457
|
[[package]]
|
|
512
458
|
name = "serde_derive"
|
|
513
|
-
version = "1.0.
|
|
459
|
+
version = "1.0.229"
|
|
514
460
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
515
|
-
checksum = "
|
|
461
|
+
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
516
462
|
dependencies = [
|
|
517
463
|
"proc-macro2",
|
|
518
464
|
"quote",
|
|
519
|
-
"syn",
|
|
465
|
+
"syn 3.0.4",
|
|
520
466
|
]
|
|
521
467
|
|
|
522
468
|
[[package]]
|
|
@@ -534,11 +480,11 @@ dependencies = [
|
|
|
534
480
|
|
|
535
481
|
[[package]]
|
|
536
482
|
name = "serde_spanned"
|
|
537
|
-
version = "
|
|
483
|
+
version = "1.1.1"
|
|
538
484
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
539
|
-
checksum = "
|
|
485
|
+
checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
|
|
540
486
|
dependencies = [
|
|
541
|
-
"
|
|
487
|
+
"serde_core",
|
|
542
488
|
]
|
|
543
489
|
|
|
544
490
|
[[package]]
|
|
@@ -549,9 +495,20 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|
|
549
495
|
|
|
550
496
|
[[package]]
|
|
551
497
|
name = "syn"
|
|
552
|
-
version = "2.0.
|
|
498
|
+
version = "2.0.119"
|
|
499
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
500
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
501
|
+
dependencies = [
|
|
502
|
+
"proc-macro2",
|
|
503
|
+
"quote",
|
|
504
|
+
"unicode-ident",
|
|
505
|
+
]
|
|
506
|
+
|
|
507
|
+
[[package]]
|
|
508
|
+
name = "syn"
|
|
509
|
+
version = "3.0.4"
|
|
553
510
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
554
|
-
checksum = "
|
|
511
|
+
checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
|
|
555
512
|
dependencies = [
|
|
556
513
|
"proc-macro2",
|
|
557
514
|
"quote",
|
|
@@ -573,44 +530,42 @@ dependencies = [
|
|
|
573
530
|
|
|
574
531
|
[[package]]
|
|
575
532
|
name = "toml"
|
|
576
|
-
version = "0.
|
|
533
|
+
version = "0.9.12+spec-1.1.0"
|
|
577
534
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
578
|
-
checksum = "
|
|
535
|
+
checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"
|
|
579
536
|
dependencies = [
|
|
580
|
-
"
|
|
537
|
+
"indexmap",
|
|
538
|
+
"serde_core",
|
|
581
539
|
"serde_spanned",
|
|
582
540
|
"toml_datetime",
|
|
583
|
-
"
|
|
541
|
+
"toml_parser",
|
|
542
|
+
"toml_writer",
|
|
543
|
+
"winnow 0.7.15",
|
|
584
544
|
]
|
|
585
545
|
|
|
586
546
|
[[package]]
|
|
587
547
|
name = "toml_datetime"
|
|
588
|
-
version = "0.
|
|
548
|
+
version = "0.7.5+spec-1.1.0"
|
|
589
549
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
590
|
-
checksum = "
|
|
550
|
+
checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
|
|
591
551
|
dependencies = [
|
|
592
|
-
"
|
|
552
|
+
"serde_core",
|
|
593
553
|
]
|
|
594
554
|
|
|
595
555
|
[[package]]
|
|
596
|
-
name = "
|
|
597
|
-
version = "
|
|
556
|
+
name = "toml_parser"
|
|
557
|
+
version = "1.1.3+spec-1.1.0"
|
|
598
558
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
599
|
-
checksum = "
|
|
559
|
+
checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
|
|
600
560
|
dependencies = [
|
|
601
|
-
"
|
|
602
|
-
"serde",
|
|
603
|
-
"serde_spanned",
|
|
604
|
-
"toml_datetime",
|
|
605
|
-
"toml_write",
|
|
606
|
-
"winnow",
|
|
561
|
+
"winnow 1.0.4",
|
|
607
562
|
]
|
|
608
563
|
|
|
609
564
|
[[package]]
|
|
610
|
-
name = "
|
|
611
|
-
version = "
|
|
565
|
+
name = "toml_writer"
|
|
566
|
+
version = "1.1.2+spec-1.1.0"
|
|
612
567
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
613
|
-
checksum = "
|
|
568
|
+
checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
|
|
614
569
|
|
|
615
570
|
[[package]]
|
|
616
571
|
name = "unicode-ident"
|
|
@@ -655,22 +610,13 @@ version = "0.2.1"
|
|
|
655
610
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
656
611
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
657
612
|
|
|
658
|
-
[[package]]
|
|
659
|
-
name = "windows-sys"
|
|
660
|
-
version = "0.52.0"
|
|
661
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
662
|
-
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
|
663
|
-
dependencies = [
|
|
664
|
-
"windows-targets 0.52.6",
|
|
665
|
-
]
|
|
666
|
-
|
|
667
613
|
[[package]]
|
|
668
614
|
name = "windows-sys"
|
|
669
615
|
version = "0.60.2"
|
|
670
616
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
671
617
|
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
|
672
618
|
dependencies = [
|
|
673
|
-
"windows-targets
|
|
619
|
+
"windows-targets",
|
|
674
620
|
]
|
|
675
621
|
|
|
676
622
|
[[package]]
|
|
@@ -682,22 +628,6 @@ dependencies = [
|
|
|
682
628
|
"windows-link",
|
|
683
629
|
]
|
|
684
630
|
|
|
685
|
-
[[package]]
|
|
686
|
-
name = "windows-targets"
|
|
687
|
-
version = "0.52.6"
|
|
688
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
689
|
-
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
|
690
|
-
dependencies = [
|
|
691
|
-
"windows_aarch64_gnullvm 0.52.6",
|
|
692
|
-
"windows_aarch64_msvc 0.52.6",
|
|
693
|
-
"windows_i686_gnu 0.52.6",
|
|
694
|
-
"windows_i686_gnullvm 0.52.6",
|
|
695
|
-
"windows_i686_msvc 0.52.6",
|
|
696
|
-
"windows_x86_64_gnu 0.52.6",
|
|
697
|
-
"windows_x86_64_gnullvm 0.52.6",
|
|
698
|
-
"windows_x86_64_msvc 0.52.6",
|
|
699
|
-
]
|
|
700
|
-
|
|
701
631
|
[[package]]
|
|
702
632
|
name = "windows-targets"
|
|
703
633
|
version = "0.53.5"
|
|
@@ -705,106 +635,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
705
635
|
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
|
|
706
636
|
dependencies = [
|
|
707
637
|
"windows-link",
|
|
708
|
-
"windows_aarch64_gnullvm
|
|
709
|
-
"windows_aarch64_msvc
|
|
710
|
-
"windows_i686_gnu
|
|
711
|
-
"windows_i686_gnullvm
|
|
712
|
-
"windows_i686_msvc
|
|
713
|
-
"windows_x86_64_gnu
|
|
714
|
-
"windows_x86_64_gnullvm
|
|
715
|
-
"windows_x86_64_msvc
|
|
638
|
+
"windows_aarch64_gnullvm",
|
|
639
|
+
"windows_aarch64_msvc",
|
|
640
|
+
"windows_i686_gnu",
|
|
641
|
+
"windows_i686_gnullvm",
|
|
642
|
+
"windows_i686_msvc",
|
|
643
|
+
"windows_x86_64_gnu",
|
|
644
|
+
"windows_x86_64_gnullvm",
|
|
645
|
+
"windows_x86_64_msvc",
|
|
716
646
|
]
|
|
717
647
|
|
|
718
|
-
[[package]]
|
|
719
|
-
name = "windows_aarch64_gnullvm"
|
|
720
|
-
version = "0.52.6"
|
|
721
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
722
|
-
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
|
723
|
-
|
|
724
648
|
[[package]]
|
|
725
649
|
name = "windows_aarch64_gnullvm"
|
|
726
650
|
version = "0.53.1"
|
|
727
651
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
728
652
|
checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
|
|
729
653
|
|
|
730
|
-
[[package]]
|
|
731
|
-
name = "windows_aarch64_msvc"
|
|
732
|
-
version = "0.52.6"
|
|
733
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
734
|
-
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
|
735
|
-
|
|
736
654
|
[[package]]
|
|
737
655
|
name = "windows_aarch64_msvc"
|
|
738
656
|
version = "0.53.1"
|
|
739
657
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
740
658
|
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
|
|
741
659
|
|
|
742
|
-
[[package]]
|
|
743
|
-
name = "windows_i686_gnu"
|
|
744
|
-
version = "0.52.6"
|
|
745
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
746
|
-
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
|
747
|
-
|
|
748
660
|
[[package]]
|
|
749
661
|
name = "windows_i686_gnu"
|
|
750
662
|
version = "0.53.1"
|
|
751
663
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
752
664
|
checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
|
|
753
665
|
|
|
754
|
-
[[package]]
|
|
755
|
-
name = "windows_i686_gnullvm"
|
|
756
|
-
version = "0.52.6"
|
|
757
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
758
|
-
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
|
759
|
-
|
|
760
666
|
[[package]]
|
|
761
667
|
name = "windows_i686_gnullvm"
|
|
762
668
|
version = "0.53.1"
|
|
763
669
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
764
670
|
checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
|
|
765
671
|
|
|
766
|
-
[[package]]
|
|
767
|
-
name = "windows_i686_msvc"
|
|
768
|
-
version = "0.52.6"
|
|
769
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
770
|
-
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
|
771
|
-
|
|
772
672
|
[[package]]
|
|
773
673
|
name = "windows_i686_msvc"
|
|
774
674
|
version = "0.53.1"
|
|
775
675
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
776
676
|
checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
|
|
777
677
|
|
|
778
|
-
[[package]]
|
|
779
|
-
name = "windows_x86_64_gnu"
|
|
780
|
-
version = "0.52.6"
|
|
781
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
782
|
-
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
|
783
|
-
|
|
784
678
|
[[package]]
|
|
785
679
|
name = "windows_x86_64_gnu"
|
|
786
680
|
version = "0.53.1"
|
|
787
681
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
788
682
|
checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
|
|
789
683
|
|
|
790
|
-
[[package]]
|
|
791
|
-
name = "windows_x86_64_gnullvm"
|
|
792
|
-
version = "0.52.6"
|
|
793
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
794
|
-
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
|
795
|
-
|
|
796
684
|
[[package]]
|
|
797
685
|
name = "windows_x86_64_gnullvm"
|
|
798
686
|
version = "0.53.1"
|
|
799
687
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
800
688
|
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
|
|
801
689
|
|
|
802
|
-
[[package]]
|
|
803
|
-
name = "windows_x86_64_msvc"
|
|
804
|
-
version = "0.52.6"
|
|
805
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
806
|
-
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
807
|
-
|
|
808
690
|
[[package]]
|
|
809
691
|
name = "windows_x86_64_msvc"
|
|
810
692
|
version = "0.53.1"
|
|
@@ -816,9 +698,12 @@ name = "winnow"
|
|
|
816
698
|
version = "0.7.15"
|
|
817
699
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
818
700
|
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
701
|
+
|
|
702
|
+
[[package]]
|
|
703
|
+
name = "winnow"
|
|
704
|
+
version = "1.0.4"
|
|
705
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
706
|
+
checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
|
|
822
707
|
|
|
823
708
|
[[package]]
|
|
824
709
|
name = "zmij"
|
data/ext/cruise/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "cruise"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Marco Roth <marco.roth@intergga.ch>"]
|
|
6
6
|
description = "A fast, OS-native file watcher for Ruby"
|
|
@@ -13,10 +13,10 @@ path = "src/lib.rs"
|
|
|
13
13
|
crate-type = ["staticlib"]
|
|
14
14
|
|
|
15
15
|
[dependencies]
|
|
16
|
-
notify = { version = "
|
|
17
|
-
notify-debouncer-full = "0.
|
|
16
|
+
notify = { version = "8", features = ["macos_fsevent"] }
|
|
17
|
+
notify-debouncer-full = "0.7"
|
|
18
18
|
globset = "0.4"
|
|
19
19
|
libc = "0.2"
|
|
20
20
|
|
|
21
21
|
[build-dependencies]
|
|
22
|
-
cbindgen = "0.
|
|
22
|
+
cbindgen = "0.29"
|
data/ext/cruise/cruise.c
CHANGED
|
@@ -126,6 +126,24 @@ static VALUE watcher_poll(VALUE self) {
|
|
|
126
126
|
return rb_funcall(rb_cEvent, rb_intern("new"), 2, path, kind);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
// watcher.poll_error
|
|
130
|
+
static VALUE watcher_poll_error(VALUE self) {
|
|
131
|
+
struct Watcher *watcher = get_watcher(self);
|
|
132
|
+
|
|
133
|
+
if (!watcher) return Qnil;
|
|
134
|
+
|
|
135
|
+
char *message = NULL;
|
|
136
|
+
|
|
137
|
+
if (!cruise_watcher_poll_error(watcher, &message)) return Qnil;
|
|
138
|
+
if (!message) return Qnil;
|
|
139
|
+
|
|
140
|
+
VALUE string = make_utf8_string(message);
|
|
141
|
+
|
|
142
|
+
cruise_string_free(message);
|
|
143
|
+
|
|
144
|
+
return string;
|
|
145
|
+
}
|
|
146
|
+
|
|
129
147
|
// watcher.close
|
|
130
148
|
static VALUE watcher_close(VALUE self) {
|
|
131
149
|
struct Watcher *watcher = get_watcher(self);
|
|
@@ -154,5 +172,6 @@ void Init_cruise(void) {
|
|
|
154
172
|
rb_define_private_method(rb_cWatcher, "initialize_native", watcher_initialize_native, 4);
|
|
155
173
|
rb_define_method(rb_cWatcher, "io", watcher_io, 0);
|
|
156
174
|
rb_define_method(rb_cWatcher, "poll", watcher_poll, 0);
|
|
175
|
+
rb_define_method(rb_cWatcher, "poll_error", watcher_poll_error, 0);
|
|
157
176
|
rb_define_method(rb_cWatcher, "close", watcher_close, 0);
|
|
158
177
|
}
|
data/ext/cruise/src/ffi.rs
CHANGED
|
@@ -106,6 +106,29 @@ pub unsafe extern "C" fn cruise_watcher_poll(watcher: *mut Watcher, out_event: *
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/// Non-blocking: pop the next queued watcher error into `out_message` and
|
|
110
|
+
/// return true, or return false if there are none. The message is heap
|
|
111
|
+
/// allocated by Rust and must be freed with [`cruise_string_free`].
|
|
112
|
+
#[no_mangle]
|
|
113
|
+
pub unsafe extern "C" fn cruise_watcher_poll_error(watcher: *mut Watcher, out_message: *mut *mut c_char) -> bool {
|
|
114
|
+
if watcher.is_null() {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let watcher = &*watcher;
|
|
119
|
+
|
|
120
|
+
match watcher.poll_error() {
|
|
121
|
+
Some(message) => {
|
|
122
|
+
if !out_message.is_null() {
|
|
123
|
+
*out_message = CString::new(message).unwrap_or_default().into_raw();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
true
|
|
127
|
+
}
|
|
128
|
+
None => false,
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
109
132
|
/// Free a watcher handle. Stops watching, joins the background thread, and
|
|
110
133
|
/// closes the write end of the pipe (the reader then observes EOF).
|
|
111
134
|
#[no_mangle]
|
data/ext/cruise/src/watcher.rs
CHANGED
|
@@ -17,11 +17,14 @@ use std::time::Duration;
|
|
|
17
17
|
|
|
18
18
|
use globset::{Glob, GlobSet, GlobSetBuilder};
|
|
19
19
|
use notify::event::{CreateKind, ModifyKind, RemoveKind};
|
|
20
|
-
use notify::{EventKind, RecursiveMode};
|
|
20
|
+
use notify::{ErrorKind, EventKind, RecursiveMode};
|
|
21
21
|
use notify_debouncer_full::{new_debouncer, DebounceEventResult};
|
|
22
22
|
|
|
23
|
+
const MAX_QUEUED_ERRORS: usize = 64;
|
|
24
|
+
|
|
23
25
|
struct Shared {
|
|
24
26
|
pending: Mutex<VecDeque<(String, String)>>,
|
|
27
|
+
errors: Mutex<VecDeque<String>>,
|
|
25
28
|
glob_set: Option<GlobSet>,
|
|
26
29
|
only_kinds: Vec<String>,
|
|
27
30
|
write_fd: RawFd,
|
|
@@ -52,6 +55,16 @@ impl Shared {
|
|
|
52
55
|
added
|
|
53
56
|
}
|
|
54
57
|
|
|
58
|
+
fn enqueue_error(&self, message: String) {
|
|
59
|
+
let mut errors = self.errors.lock().unwrap();
|
|
60
|
+
|
|
61
|
+
while errors.len() >= MAX_QUEUED_ERRORS {
|
|
62
|
+
errors.pop_front();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
errors.push_back(message);
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
fn wake(&self) {
|
|
56
69
|
let byte = [1u8];
|
|
57
70
|
let _ = unsafe { libc::write(self.write_fd, byte.as_ptr() as *const c_void, 1) };
|
|
@@ -81,6 +94,7 @@ impl Watcher {
|
|
|
81
94
|
|
|
82
95
|
let shared = Arc::new(Shared {
|
|
83
96
|
pending: Mutex::new(VecDeque::new()),
|
|
97
|
+
errors: Mutex::new(VecDeque::new()),
|
|
84
98
|
glob_set,
|
|
85
99
|
only_kinds,
|
|
86
100
|
write_fd,
|
|
@@ -89,17 +103,29 @@ impl Watcher {
|
|
|
89
103
|
let callback_shared = Arc::clone(&shared);
|
|
90
104
|
|
|
91
105
|
let mut debouncer = match new_debouncer(Duration::from_secs_f64(debounce), None, move |result: DebounceEventResult| {
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
match result {
|
|
107
|
+
Ok(events) => {
|
|
108
|
+
let mut added = false;
|
|
109
|
+
|
|
110
|
+
for debounced_event in events {
|
|
111
|
+
if callback_shared.enqueue(debounced_event.event) {
|
|
112
|
+
added = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
94
115
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
added = true;
|
|
116
|
+
if added {
|
|
117
|
+
callback_shared.wake();
|
|
98
118
|
}
|
|
99
119
|
}
|
|
100
120
|
|
|
101
|
-
|
|
102
|
-
|
|
121
|
+
Err(errors) => {
|
|
122
|
+
for error in &errors {
|
|
123
|
+
callback_shared.enqueue_error(describe_error(error));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if !errors.is_empty() {
|
|
127
|
+
callback_shared.wake();
|
|
128
|
+
}
|
|
103
129
|
}
|
|
104
130
|
}
|
|
105
131
|
}) {
|
|
@@ -137,6 +163,21 @@ impl Watcher {
|
|
|
137
163
|
pub fn poll(&self) -> Option<(String, String)> {
|
|
138
164
|
self.shared.pending.lock().unwrap().pop_front()
|
|
139
165
|
}
|
|
166
|
+
|
|
167
|
+
pub fn poll_error(&self) -> Option<String> {
|
|
168
|
+
self.shared.errors.lock().unwrap().pop_front()
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
fn describe_error(error: ¬ify::Error) -> String {
|
|
173
|
+
match error.kind {
|
|
174
|
+
ErrorKind::MaxFilesWatch => format!(
|
|
175
|
+
"Reached the limit of watched files, so parts of the watched tree are no longer monitored. \
|
|
176
|
+
On Linux raise it with `sysctl fs.inotify.max_user_watches`. ({error})"
|
|
177
|
+
),
|
|
178
|
+
|
|
179
|
+
_ => error.to_string(),
|
|
180
|
+
}
|
|
140
181
|
}
|
|
141
182
|
|
|
142
183
|
fn make_pipe() -> Result<(RawFd, RawFd), String> {
|
data/lib/cruise/version.rb
CHANGED
data/lib/cruise/watcher.rb
CHANGED
|
@@ -24,6 +24,11 @@ module Cruise
|
|
|
24
24
|
raise NotImplementedError, "Cruise::Watcher#poll is provided by the native extension"
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
#: () -> String?
|
|
28
|
+
def poll_error
|
|
29
|
+
raise NotImplementedError, "Cruise::Watcher#poll_error is provided by the native extension"
|
|
30
|
+
end
|
|
31
|
+
|
|
27
32
|
#: () -> void
|
|
28
33
|
def close
|
|
29
34
|
raise NotImplementedError, "Cruise::Watcher#close is provided by the native extension"
|
data/lib/cruise.rb
CHANGED
|
@@ -20,6 +20,7 @@ end
|
|
|
20
20
|
|
|
21
21
|
module Cruise
|
|
22
22
|
DEFAULT_DEBOUNCE = 0.1 #: Float
|
|
23
|
+
DEFAULT_ERROR_HANDLER = ->(message) { warn "Cruise: #{message}" } #: error_callback
|
|
23
24
|
|
|
24
25
|
class << self
|
|
25
26
|
# Watch one or more paths and yield a Cruise::Event for each change.
|
|
@@ -28,12 +29,14 @@ module Cruise
|
|
|
28
29
|
# IO#wait_readable, so this releases the GVL for other threads and, when a
|
|
29
30
|
# Fiber scheduler is set (e.g. inside Async), yields to other fibers instead
|
|
30
31
|
# of blocking the reactor.
|
|
31
|
-
#: (*paths paths, ?glob: globs?, ?debounce: debounce, ?only: kinds?, ?callback: callback?) ?{ (Event) -> void } -> void
|
|
32
|
-
def watch(*paths, glob: nil, debounce: DEFAULT_DEBOUNCE, only: nil, callback: nil, &block)
|
|
32
|
+
#: (*paths paths, ?glob: globs?, ?debounce: debounce, ?only: kinds?, ?callback: callback?, ?on_error: error_callback?) ?{ (Event) -> void } -> void
|
|
33
|
+
def watch(*paths, glob: nil, debounce: DEFAULT_DEBOUNCE, only: nil, callback: nil, on_error: nil, &block)
|
|
33
34
|
callback = block || callback
|
|
34
35
|
|
|
35
36
|
raise ArgumentError, "Cruise.watch requires a block or callback" unless callback
|
|
36
37
|
|
|
38
|
+
error_handler = on_error || DEFAULT_ERROR_HANDLER
|
|
39
|
+
|
|
37
40
|
watcher = Watcher.new(*paths, glob: glob, debounce: debounce, only: only)
|
|
38
41
|
io = watcher.io
|
|
39
42
|
|
|
@@ -42,6 +45,10 @@ module Cruise
|
|
|
42
45
|
io.wait_readable
|
|
43
46
|
closed = drain_wakeups(io)
|
|
44
47
|
|
|
48
|
+
while (message = watcher.poll_error)
|
|
49
|
+
error_handler.call(message)
|
|
50
|
+
end
|
|
51
|
+
|
|
45
52
|
while (event = watcher.poll)
|
|
46
53
|
callback.call(event)
|
|
47
54
|
end
|
data/sig/cruise/types.rbs
CHANGED
data/sig/cruise/watcher.rbs
CHANGED
data/sig/cruise.rbs
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
module Cruise
|
|
4
4
|
DEFAULT_DEBOUNCE: Float
|
|
5
5
|
|
|
6
|
+
DEFAULT_ERROR_HANDLER: error_callback
|
|
7
|
+
|
|
6
8
|
# Watch one or more paths and yield a Cruise::Event for each change.
|
|
7
9
|
#
|
|
8
10
|
# Blocks until interrupted. Waiting happens on the watcher's pipe via
|
|
9
11
|
# IO#wait_readable, so this releases the GVL for other threads and, when a
|
|
10
12
|
# Fiber scheduler is set (e.g. inside Async), yields to other fibers instead
|
|
11
13
|
# of blocking the reactor.
|
|
12
|
-
# : (*paths paths, ?glob: globs?, ?debounce: debounce, ?only: kinds?, ?callback: callback?) ?{ (Event) -> void } -> void
|
|
13
|
-
def self.watch: (*paths paths, ?glob: globs?, ?debounce: debounce, ?only: kinds?, ?callback: callback?) ?{ (Event) -> void } -> void
|
|
14
|
+
# : (*paths paths, ?glob: globs?, ?debounce: debounce, ?only: kinds?, ?callback: callback?, ?on_error: error_callback?) ?{ (Event) -> void } -> void
|
|
15
|
+
def self.watch: (*paths paths, ?glob: globs?, ?debounce: debounce, ?only: kinds?, ?callback: callback?, ?on_error: error_callback?) ?{ (Event) -> void } -> void
|
|
14
16
|
|
|
15
17
|
# : (IO io) -> bool
|
|
16
18
|
private def self.drain_wakeups: (IO io) -> bool
|