io-wait 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/Gemfile +7 -0
- data/ext/io/wait/extconf.rb +18 -14
- data/ext/io/wait/wait.c +127 -85
- metadata +6 -10
- data/Rakefile +0 -19
- data/io-wait.gemspec +0 -27
- data/rakelib/changelogs.rake +0 -34
- data/rakelib/epoch.rake +0 -5
- data/rakelib/sync_tool.rake +0 -6
- data/rakelib/version.rake +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 630936f8af6e2cf9265ebff0794cab1daf10048933460b71306486aecb92a85a
|
4
|
+
data.tar.gz: 153bc0301fdb8fce6f4983d45879364509bb6534a81775d98e5f61b5ffe1923e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07e0a9997d9e8dd84368feb0fdcd681282d7c583aea8d03d90abf031d6474224aa7a6f61050de11a03750cc0e20ba5759ac4eca28aae07891a778ef82cef24c6
|
7
|
+
data.tar.gz: 7294e823b4536cded39faead19916b437e4a8a4d398e35917c81e84d4618d5f99bd414aa9f6989cfad4bfb8bf0721fb7934b083a72576a7e95a60d7fcf35e853
|
data/Gemfile
CHANGED
data/ext/io/wait/extconf.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
require 'mkmf'
|
3
|
-
target = "io/wait"
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
|
8
|
-
fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
|
9
|
-
have_macro("FIONREAD", [h, ioctl_h].compact)
|
10
|
-
end
|
11
|
-
if fionread
|
12
|
-
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
|
13
|
-
create_makefile(target)
|
14
|
-
end
|
4
|
+
if RUBY_VERSION < "2.6"
|
5
|
+
File.write("Makefile", dummy_makefile($srcdir).join(""))
|
15
6
|
else
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
target = "io/wait"
|
8
|
+
have_func("rb_io_wait")
|
9
|
+
unless macro_defined?("DOSISH", "#include <ruby.h>")
|
10
|
+
have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
|
11
|
+
fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
|
12
|
+
have_macro("FIONREAD", [h, ioctl_h].compact)
|
13
|
+
end
|
14
|
+
if fionread
|
15
|
+
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
|
16
|
+
create_makefile(target)
|
17
|
+
end
|
18
|
+
else
|
19
|
+
if have_func("rb_w32_ioctlsocket", "ruby.h")
|
20
|
+
have_func("rb_w32_is_socket", "ruby.h")
|
21
|
+
create_makefile(target)
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|
data/ext/io/wait/wait.c
CHANGED
@@ -41,22 +41,17 @@
|
|
41
41
|
#endif
|
42
42
|
|
43
43
|
#ifndef HAVE_RB_IO_WAIT
|
44
|
-
static VALUE io_ready_p _((VALUE io));
|
45
|
-
static VALUE io_wait_readable _((int argc, VALUE *argv, VALUE io));
|
46
|
-
static VALUE io_wait_writable _((int argc, VALUE *argv, VALUE io));
|
47
|
-
void Init_wait _((void));
|
48
|
-
|
49
44
|
static struct timeval *
|
50
45
|
get_timeout(int argc, VALUE *argv, struct timeval *timerec)
|
51
46
|
{
|
52
47
|
VALUE timeout = Qnil;
|
53
48
|
rb_check_arity(argc, 0, 1);
|
54
49
|
if (!argc || NIL_P(timeout = argv[0])) {
|
55
|
-
|
50
|
+
return NULL;
|
56
51
|
}
|
57
52
|
else {
|
58
|
-
|
59
|
-
|
53
|
+
*timerec = rb_time_interval(timeout);
|
54
|
+
return timerec;
|
60
55
|
}
|
61
56
|
}
|
62
57
|
|
@@ -65,7 +60,7 @@ wait_for_single_fd(rb_io_t *fptr, int events, struct timeval *tv)
|
|
65
60
|
{
|
66
61
|
int i = rb_wait_for_single_fd(fptr->fd, events, tv);
|
67
62
|
if (i < 0)
|
68
|
-
|
63
|
+
rb_sys_fail(0);
|
69
64
|
rb_io_check_closed(fptr);
|
70
65
|
return (i & events);
|
71
66
|
}
|
@@ -77,6 +72,8 @@ wait_for_single_fd(rb_io_t *fptr, int events, struct timeval *tv)
|
|
77
72
|
*
|
78
73
|
* Returns number of bytes that can be read without blocking.
|
79
74
|
* Returns zero if no information available.
|
75
|
+
*
|
76
|
+
* You must require 'io/wait' to use this method.
|
80
77
|
*/
|
81
78
|
|
82
79
|
static VALUE
|
@@ -98,30 +95,36 @@ io_nread(VALUE io)
|
|
98
95
|
|
99
96
|
#ifdef HAVE_RB_IO_WAIT
|
100
97
|
static VALUE
|
101
|
-
io_wait_event(VALUE io, int event, VALUE timeout)
|
98
|
+
io_wait_event(VALUE io, int event, VALUE timeout, int return_io)
|
102
99
|
{
|
103
100
|
VALUE result = rb_io_wait(io, RB_INT2NUM(event), timeout);
|
104
101
|
|
105
102
|
if (!RB_TEST(result)) {
|
106
|
-
|
103
|
+
return Qnil;
|
107
104
|
}
|
108
105
|
|
109
106
|
int mask = RB_NUM2INT(result);
|
110
107
|
|
111
108
|
if (mask & event) {
|
112
|
-
|
109
|
+
if (return_io)
|
110
|
+
return io;
|
111
|
+
else
|
112
|
+
return result;
|
113
113
|
}
|
114
114
|
else {
|
115
|
-
|
115
|
+
return Qfalse;
|
116
116
|
}
|
117
117
|
}
|
118
118
|
#endif
|
119
119
|
|
120
120
|
/*
|
121
121
|
* call-seq:
|
122
|
-
* io.ready? ->
|
122
|
+
* io.ready? -> truthy or falsy
|
123
|
+
*
|
124
|
+
* Returns a truthy value if input available without blocking, or a
|
125
|
+
* falsy value.
|
123
126
|
*
|
124
|
-
*
|
127
|
+
* You must require 'io/wait' to use this method.
|
125
128
|
*/
|
126
129
|
|
127
130
|
static VALUE
|
@@ -137,23 +140,25 @@ io_ready_p(VALUE io)
|
|
137
140
|
if (rb_io_read_pending(fptr)) return Qtrue;
|
138
141
|
|
139
142
|
#ifndef HAVE_RB_IO_WAIT
|
140
|
-
|
141
|
-
return Qtrue;
|
143
|
+
return wait_for_single_fd(fptr, RB_WAITFD_IN, &tv) ? Qtrue : Qfalse;
|
142
144
|
#else
|
143
|
-
|
144
|
-
return Qtrue;
|
145
|
+
return io_wait_event(io, RUBY_IO_READABLE, RB_INT2NUM(0), 1);
|
145
146
|
#endif
|
146
|
-
return Qfalse;
|
147
147
|
}
|
148
148
|
|
149
|
+
/* Ruby 3.2+ can define these methods. This macro indicates that case. */
|
150
|
+
#ifndef RUBY_IO_WAIT_METHODS
|
151
|
+
|
149
152
|
/*
|
150
153
|
* call-seq:
|
151
|
-
* io.wait_readable ->
|
152
|
-
* io.wait_readable(timeout) ->
|
154
|
+
* io.wait_readable -> truthy or falsy
|
155
|
+
* io.wait_readable(timeout) -> truthy or falsy
|
156
|
+
*
|
157
|
+
* Waits until IO is readable and returns a truthy value, or a falsy
|
158
|
+
* value when times out. Returns a truthy value immediately when
|
159
|
+
* buffered data is available.
|
153
160
|
*
|
154
|
-
*
|
155
|
-
* +false+ when times out.
|
156
|
-
* Returns +true+ immediately when buffered data is available.
|
161
|
+
* You must require 'io/wait' to use this method.
|
157
162
|
*/
|
158
163
|
|
159
164
|
static VALUE
|
@@ -175,24 +180,26 @@ io_wait_readable(int argc, VALUE *argv, VALUE io)
|
|
175
180
|
|
176
181
|
#ifndef HAVE_RB_IO_WAIT
|
177
182
|
if (wait_for_single_fd(fptr, RB_WAITFD_IN, tv)) {
|
178
|
-
|
183
|
+
return io;
|
179
184
|
}
|
180
185
|
return Qnil;
|
181
186
|
#else
|
182
187
|
rb_check_arity(argc, 0, 1);
|
183
188
|
VALUE timeout = (argc == 1 ? argv[0] : Qnil);
|
184
189
|
|
185
|
-
return io_wait_event(io, RUBY_IO_READABLE, timeout);
|
190
|
+
return io_wait_event(io, RUBY_IO_READABLE, timeout, 1);
|
186
191
|
#endif
|
187
192
|
}
|
188
193
|
|
189
194
|
/*
|
190
195
|
* call-seq:
|
191
|
-
* io.wait_writable ->
|
192
|
-
* io.wait_writable(timeout) ->
|
196
|
+
* io.wait_writable -> truthy or falsy
|
197
|
+
* io.wait_writable(timeout) -> truthy or falsy
|
193
198
|
*
|
194
|
-
* Waits until IO is writable and returns
|
195
|
-
*
|
199
|
+
* Waits until IO is writable and returns a truthy value or a falsy
|
200
|
+
* value when times out.
|
201
|
+
*
|
202
|
+
* You must require 'io/wait' to use this method.
|
196
203
|
*/
|
197
204
|
static VALUE
|
198
205
|
io_wait_writable(int argc, VALUE *argv, VALUE io)
|
@@ -209,25 +216,28 @@ io_wait_writable(int argc, VALUE *argv, VALUE io)
|
|
209
216
|
#ifndef HAVE_RB_IO_WAIT
|
210
217
|
tv = get_timeout(argc, argv, &timerec);
|
211
218
|
if (wait_for_single_fd(fptr, RB_WAITFD_OUT, tv)) {
|
212
|
-
|
219
|
+
return io;
|
213
220
|
}
|
214
221
|
return Qnil;
|
215
222
|
#else
|
216
223
|
rb_check_arity(argc, 0, 1);
|
217
224
|
VALUE timeout = (argc == 1 ? argv[0] : Qnil);
|
218
225
|
|
219
|
-
return io_wait_event(io, RUBY_IO_WRITABLE, timeout);
|
226
|
+
return io_wait_event(io, RUBY_IO_WRITABLE, timeout, 1);
|
220
227
|
#endif
|
221
228
|
}
|
222
229
|
|
223
230
|
#ifdef HAVE_RB_IO_WAIT
|
224
231
|
/*
|
225
232
|
* call-seq:
|
226
|
-
* io.wait_priority ->
|
227
|
-
* io.wait_priority(timeout) ->
|
233
|
+
* io.wait_priority -> truthy or falsy
|
234
|
+
* io.wait_priority(timeout) -> truthy or falsy
|
235
|
+
*
|
236
|
+
* Waits until IO is priority and returns a truthy value or a falsy
|
237
|
+
* value when times out. Priority data is sent and received using
|
238
|
+
* the Socket::MSG_OOB flag and is typically limited to streams.
|
228
239
|
*
|
229
|
-
*
|
230
|
-
* +false+ when times out.
|
240
|
+
* You must require 'io/wait' to use this method.
|
231
241
|
*/
|
232
242
|
static VALUE
|
233
243
|
io_wait_priority(int argc, VALUE *argv, VALUE io)
|
@@ -242,7 +252,7 @@ io_wait_priority(int argc, VALUE *argv, VALUE io)
|
|
242
252
|
rb_check_arity(argc, 0, 1);
|
243
253
|
VALUE timeout = argc == 1 ? argv[0] : Qnil;
|
244
254
|
|
245
|
-
return io_wait_event(io, RUBY_IO_PRIORITY, timeout);
|
255
|
+
return io_wait_event(io, RUBY_IO_PRIORITY, timeout, 1);
|
246
256
|
}
|
247
257
|
#endif
|
248
258
|
|
@@ -250,51 +260,65 @@ static int
|
|
250
260
|
wait_mode_sym(VALUE mode)
|
251
261
|
{
|
252
262
|
if (mode == ID2SYM(rb_intern("r"))) {
|
253
|
-
|
263
|
+
return RB_WAITFD_IN;
|
254
264
|
}
|
255
265
|
if (mode == ID2SYM(rb_intern("read"))) {
|
256
|
-
|
266
|
+
return RB_WAITFD_IN;
|
257
267
|
}
|
258
268
|
if (mode == ID2SYM(rb_intern("readable"))) {
|
259
|
-
|
269
|
+
return RB_WAITFD_IN;
|
260
270
|
}
|
261
271
|
if (mode == ID2SYM(rb_intern("w"))) {
|
262
|
-
|
272
|
+
return RB_WAITFD_OUT;
|
263
273
|
}
|
264
274
|
if (mode == ID2SYM(rb_intern("write"))) {
|
265
|
-
|
275
|
+
return RB_WAITFD_OUT;
|
266
276
|
}
|
267
277
|
if (mode == ID2SYM(rb_intern("writable"))) {
|
268
|
-
|
278
|
+
return RB_WAITFD_OUT;
|
269
279
|
}
|
270
280
|
if (mode == ID2SYM(rb_intern("rw"))) {
|
271
|
-
|
281
|
+
return RB_WAITFD_IN|RB_WAITFD_OUT;
|
272
282
|
}
|
273
283
|
if (mode == ID2SYM(rb_intern("read_write"))) {
|
274
|
-
|
284
|
+
return RB_WAITFD_IN|RB_WAITFD_OUT;
|
275
285
|
}
|
276
286
|
if (mode == ID2SYM(rb_intern("readable_writable"))) {
|
277
|
-
|
287
|
+
return RB_WAITFD_IN|RB_WAITFD_OUT;
|
278
288
|
}
|
279
289
|
rb_raise(rb_eArgError, "unsupported mode: %"PRIsVALUE, mode);
|
280
290
|
return 0;
|
281
291
|
}
|
282
292
|
|
293
|
+
#ifdef HAVE_RB_IO_WAIT
|
294
|
+
static inline rb_io_event_t
|
295
|
+
io_event_from_value(VALUE value)
|
296
|
+
{
|
297
|
+
int events = RB_NUM2INT(value);
|
298
|
+
|
299
|
+
if (events <= 0) rb_raise(rb_eArgError, "Events must be positive integer!");
|
300
|
+
|
301
|
+
return events;
|
302
|
+
}
|
303
|
+
#endif
|
304
|
+
|
283
305
|
/*
|
284
306
|
* call-seq:
|
285
|
-
* io.wait(events, timeout) -> event mask or
|
286
|
-
* io.wait(timeout = nil, mode = :read) ->
|
307
|
+
* io.wait(events, timeout) -> event mask, false or nil
|
308
|
+
* io.wait(timeout = nil, mode = :read) -> self, true, or false
|
287
309
|
*
|
288
310
|
* Waits until the IO becomes ready for the specified events and returns the
|
289
|
-
* subset of events that become ready, or
|
311
|
+
* subset of events that become ready, or a falsy value when times out.
|
290
312
|
*
|
291
313
|
* The events can be a bit mask of +IO::READABLE+, +IO::WRITABLE+ or
|
292
314
|
* +IO::PRIORITY+.
|
293
315
|
*
|
294
|
-
* Returns
|
316
|
+
* Returns a truthy value immediately when buffered data is available.
|
295
317
|
*
|
296
318
|
* Optional parameter +mode+ is one of +:read+, +:write+, or
|
297
319
|
* +:read_write+.
|
320
|
+
*
|
321
|
+
* You must require 'io/wait' to use this method.
|
298
322
|
*/
|
299
323
|
|
300
324
|
static VALUE
|
@@ -309,61 +333,77 @@ io_wait(int argc, VALUE *argv, VALUE io)
|
|
309
333
|
|
310
334
|
GetOpenFile(io, fptr);
|
311
335
|
for (i = 0; i < argc; ++i) {
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
336
|
+
if (SYMBOL_P(argv[i])) {
|
337
|
+
event |= wait_mode_sym(argv[i]);
|
338
|
+
}
|
339
|
+
else {
|
340
|
+
*(tv = &timerec) = rb_time_interval(argv[i]);
|
341
|
+
}
|
318
342
|
}
|
319
343
|
/* rb_time_interval() and might_mode() might convert the argument */
|
320
344
|
rb_io_check_closed(fptr);
|
321
345
|
if (!event) event = RB_WAITFD_IN;
|
322
346
|
if ((event & RB_WAITFD_IN) && rb_io_read_pending(fptr))
|
323
|
-
|
347
|
+
return Qtrue;
|
324
348
|
if (wait_for_single_fd(fptr, event, tv))
|
325
|
-
|
349
|
+
return io;
|
326
350
|
return Qnil;
|
327
351
|
#else
|
328
352
|
VALUE timeout = Qundef;
|
329
353
|
rb_io_event_t events = 0;
|
354
|
+
int i, return_io = 0;
|
330
355
|
|
356
|
+
/* The documented signature for this method is actually incorrect.
|
357
|
+
* A single timeout is allowed in any position, and multiple symbols can be given.
|
358
|
+
* Whether this is intentional or not, I don't know, and as such I consider this to
|
359
|
+
* be a legacy/slow path. */
|
331
360
|
if (argc != 2 || (RB_SYMBOL_P(argv[0]) || RB_SYMBOL_P(argv[1]))) {
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
361
|
+
/* We'd prefer to return the actual mask, but this form would return the io itself: */
|
362
|
+
return_io = 1;
|
363
|
+
|
364
|
+
/* Slow/messy path: */
|
365
|
+
for (i = 0; i < argc; i += 1) {
|
366
|
+
if (RB_SYMBOL_P(argv[i])) {
|
367
|
+
events |= wait_mode_sym(argv[i]);
|
368
|
+
}
|
369
|
+
else if (timeout == Qundef) {
|
370
|
+
rb_time_interval(timeout = argv[i]);
|
371
|
+
}
|
372
|
+
else {
|
373
|
+
rb_raise(rb_eArgError, "timeout given more than once");
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
if (timeout == Qundef) timeout = Qnil;
|
378
|
+
|
379
|
+
if (events == 0) {
|
380
|
+
events = RUBY_IO_READABLE;
|
381
|
+
}
|
344
382
|
}
|
345
|
-
else /* argc == 2 */ {
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
if (events == 0) {
|
351
|
-
events = RUBY_IO_READABLE;
|
383
|
+
else /* argc == 2 and neither are symbols */ {
|
384
|
+
/* This is the fast path: */
|
385
|
+
events = io_event_from_value(argv[0]);
|
386
|
+
timeout = argv[1];
|
352
387
|
}
|
353
388
|
|
354
389
|
if (events & RUBY_IO_READABLE) {
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
390
|
+
rb_io_t *fptr = NULL;
|
391
|
+
RB_IO_POINTER(io, fptr);
|
392
|
+
|
393
|
+
if (rb_io_read_pending(fptr)) {
|
394
|
+
/* This was the original behaviour: */
|
395
|
+
if (return_io) return Qtrue;
|
396
|
+
/* New behaviour always returns an event mask: */
|
397
|
+
else return RB_INT2NUM(RUBY_IO_READABLE);
|
398
|
+
}
|
361
399
|
}
|
362
400
|
|
363
|
-
return io_wait_event(io, events, timeout);
|
401
|
+
return io_wait_event(io, events, timeout, return_io);
|
364
402
|
#endif
|
365
403
|
}
|
366
404
|
|
405
|
+
#endif /* RUBY_IO_WAIT_METHODS */
|
406
|
+
|
367
407
|
/*
|
368
408
|
* IO wait methods
|
369
409
|
*/
|
@@ -378,6 +418,7 @@ Init_wait(void)
|
|
378
418
|
rb_define_method(rb_cIO, "nread", io_nread, 0);
|
379
419
|
rb_define_method(rb_cIO, "ready?", io_ready_p, 0);
|
380
420
|
|
421
|
+
#ifndef RUBY_IO_WAIT_METHODS
|
381
422
|
rb_define_method(rb_cIO, "wait", io_wait, -1);
|
382
423
|
|
383
424
|
rb_define_method(rb_cIO, "wait_readable", io_wait_readable, -1);
|
@@ -385,4 +426,5 @@ Init_wait(void)
|
|
385
426
|
#ifdef HAVE_RB_IO_WAIT
|
386
427
|
rb_define_method(rb_cIO, "wait_priority", io_wait_priority, -1);
|
387
428
|
#endif
|
429
|
+
#endif
|
388
430
|
}
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: io-wait
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nobu Nakada
|
8
|
+
- Charles Oliver Nutter
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
14
|
description: Waits until IO is readable or writable without blocking.
|
14
15
|
email:
|
15
16
|
- nobu@ruby-lang.org
|
17
|
+
- headius@headius.com
|
16
18
|
executables: []
|
17
19
|
extensions:
|
18
20
|
- ext/io/wait/extconf.rb
|
@@ -21,15 +23,9 @@ files:
|
|
21
23
|
- COPYING
|
22
24
|
- Gemfile
|
23
25
|
- README.md
|
24
|
-
- Rakefile
|
25
26
|
- ext/io/wait/depend
|
26
27
|
- ext/io/wait/extconf.rb
|
27
28
|
- ext/io/wait/wait.c
|
28
|
-
- io-wait.gemspec
|
29
|
-
- rakelib/changelogs.rake
|
30
|
-
- rakelib/epoch.rake
|
31
|
-
- rakelib/sync_tool.rake
|
32
|
-
- rakelib/version.rake
|
33
29
|
homepage: https://github.com/ruby/io-wait
|
34
30
|
licenses:
|
35
31
|
- Ruby
|
@@ -45,14 +41,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
41
|
requirements:
|
46
42
|
- - ">="
|
47
43
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
44
|
+
version: '0'
|
49
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
46
|
requirements:
|
51
47
|
- - ">="
|
52
48
|
- !ruby/object:Gem::Version
|
53
49
|
version: '0'
|
54
50
|
requirements: []
|
55
|
-
rubygems_version: 3.
|
51
|
+
rubygems_version: 3.4.0.dev
|
56
52
|
signing_key:
|
57
53
|
specification_version: 4
|
58
54
|
summary: Waits until IO is readable or writable without blocking.
|
data/Rakefile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
name = "io/wait"
|
5
|
-
|
6
|
-
require 'rake/extensiontask'
|
7
|
-
extask = Rake::ExtensionTask.new(name) do |x|
|
8
|
-
x.lib_dir << "/#{RUBY_VERSION}/#{x.platform}"
|
9
|
-
end
|
10
|
-
Rake::TestTask.new(:test) do |t|
|
11
|
-
t.libs << extask.lib_dir
|
12
|
-
t.libs << "test/lib"
|
13
|
-
t.ruby_opts << "-rhelper"
|
14
|
-
t.test_files = FileList["test/**/test_*.rb"]
|
15
|
-
end
|
16
|
-
|
17
|
-
task :test => :compile
|
18
|
-
|
19
|
-
task :default => :test
|
data/io-wait.gemspec
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
_VERSION = "0.2.1"
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = "io-wait"
|
5
|
-
spec.version = _VERSION
|
6
|
-
spec.authors = ["Nobu Nakada"]
|
7
|
-
spec.email = ["nobu@ruby-lang.org"]
|
8
|
-
|
9
|
-
spec.summary = %q{Waits until IO is readable or writable without blocking.}
|
10
|
-
spec.description = %q{Waits until IO is readable or writable without blocking.}
|
11
|
-
spec.homepage = "https://github.com/ruby/io-wait"
|
12
|
-
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
14
|
-
|
15
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
17
|
-
|
18
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
20
|
-
f.match(%r{\A(?:test|spec|features)/|\A\.(?:git|travis)})
|
21
|
-
end
|
22
|
-
end
|
23
|
-
spec.extensions = %w[ext/io/wait/extconf.rb]
|
24
|
-
spec.bindir = "exe"
|
25
|
-
spec.executables = []
|
26
|
-
spec.require_paths = ["lib"]
|
27
|
-
end
|
data/rakelib/changelogs.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
task "build" => "changelogs"
|
2
|
-
|
3
|
-
changelog = proc do |output, ver = nil, prev = nil|
|
4
|
-
ver &&= Gem::Version.new(ver)
|
5
|
-
range = [[prev], [ver, "HEAD"]].map {|ver, branch| ver ? "v#{ver.to_s}" : branch}.compact.join("..")
|
6
|
-
IO.popen(%W[git log --format=fuller --topo-order --no-merges #{range}]) do |log|
|
7
|
-
line = log.gets
|
8
|
-
FileUtils.mkpath(File.dirname(output))
|
9
|
-
File.open(output, "wb") do |f|
|
10
|
-
f.print "-*- coding: utf-8 -*-\n\n", line
|
11
|
-
log.each_line do |line|
|
12
|
-
line.sub!(/^(?!:)(?:Author|Commit)?(?:Date)?: /, ' \&')
|
13
|
-
line.sub!(/ +$/, '')
|
14
|
-
f.print(line)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
tags = IO.popen(%w[git tag -l v[0-9]*]).grep(/v(.*)/) {$1}
|
21
|
-
tags.sort_by! {|tag| tag.scan(/\d+/).map(&:to_i)}
|
22
|
-
tags.inject(nil) do |prev, tag|
|
23
|
-
task("logs/ChangeLog-#{tag}") {|t| changelog[t.name, tag, prev]}
|
24
|
-
tag
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "Make ChangeLog"
|
28
|
-
task "ChangeLog", [:ver, :prev] do |t, ver: nil, prev: tags.last|
|
29
|
-
changelog[t.name, ver, prev]
|
30
|
-
end
|
31
|
-
|
32
|
-
changelogs = ["ChangeLog", *tags.map {|tag| "logs/ChangeLog-#{tag}"}]
|
33
|
-
task "changelogs" => changelogs
|
34
|
-
CLOBBER.concat(changelogs) << "logs"
|
data/rakelib/epoch.rake
DELETED
data/rakelib/sync_tool.rake
DELETED
data/rakelib/version.rake
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
class << (helper = Bundler::GemHelper.instance)
|
2
|
-
def update_gemspec
|
3
|
-
path = gemspec.loaded_from
|
4
|
-
File.open(path, "r+b") do |f|
|
5
|
-
d = f.read
|
6
|
-
if d.sub!(/^(_VERSION\s*=\s*)".*"/) {$1 + gemspec.version.to_s.dump}
|
7
|
-
f.rewind
|
8
|
-
f.truncate(0)
|
9
|
-
f.print(d)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def commit_bump
|
15
|
-
sh(%W[git commit -m bump\ up\ to\ #{gemspec.version}
|
16
|
-
#{gemspec.loaded_from}])
|
17
|
-
end
|
18
|
-
|
19
|
-
def version=(v)
|
20
|
-
gemspec.version = v
|
21
|
-
update_gemspec
|
22
|
-
commit_bump
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
major, minor, teeny = helper.gemspec.version.segments
|
27
|
-
|
28
|
-
task "bump:teeny" do
|
29
|
-
helper.version = Gem::Version.new("#{major}.#{minor}.#{teeny+1}")
|
30
|
-
end
|
31
|
-
|
32
|
-
task "bump:minor" do
|
33
|
-
helper.version = Gem::Version.new("#{major}.#{minor+1}.0")
|
34
|
-
end
|
35
|
-
|
36
|
-
task "bump:major" do
|
37
|
-
helper.version = Gem::Version.new("#{major+1}.0.0")
|
38
|
-
end
|
39
|
-
|
40
|
-
task "bump" => "bump:teeny"
|
41
|
-
|
42
|
-
task "tag" do
|
43
|
-
helper.__send__(:tag_version)
|
44
|
-
end
|