io-wait 0.2.1 → 0.2.2.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e443d24e34f86142b3d27ca1a774e3828b63f445b00f94bd79273bb5583e4699
4
- data.tar.gz: 5766517962c90389a10199460414a7088b8316edaa7f0854c98ebbdfd65ec4ba
3
+ metadata.gz: 3cdf9086254a2bafdcebba616ff05a5b024389e554861fcea442fc27882bd73a
4
+ data.tar.gz: 51740df7f2f5b67161a3c6e336698de3a345f38ed331e4e701af28f3990875b8
5
5
  SHA512:
6
- metadata.gz: 526b1f255ac3a9999f9965a5ee35b4c43d32d0493bfaf2cb32e2ad8e4978f57c579574649986f6dfd77a5a2a058f7c5b2f8eaf2b83d8f31a9deac5fc24ffd55f
7
- data.tar.gz: 0424cf27d9a11aeb5dc142963073b9624e9102465cd5358d5f92b9e1cb258b2b60f224d0ef43c1d49d6156d04c0f6a8e26dcb6d339adcfab1400d7c53bd5b1b7
6
+ metadata.gz: 55eb2c59c806b21fb6d038c7ccc58ec59f1a7e7a5a4e5bc2991b893b19f2a8265624e666daed915a4b58c0981619bb3459d80aa7856be6a8c9ba1277449f1b83
7
+ data.tar.gz: ecc6d22a99dbb5ac2c911f187c0253a30c3764e398997cde8d57efd54d278a317cfbc6149ab8d2a1695b71119ab04c0498c122111d37b8eeb544a74372ce3937
data/Gemfile CHANGED
@@ -2,3 +2,10 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in io-wait.gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem "rake"
8
+ gem "rake-compiler"
9
+ gem "test-unit"
10
+ gem 'ruby-maven', :platforms => :jruby
11
+ end
@@ -1,20 +1,24 @@
1
1
  # frozen_string_literal: false
2
2
  require 'mkmf'
3
- target = "io/wait"
4
3
 
5
- have_func("rb_io_wait")
6
- unless macro_defined?("DOSISH", "#include <ruby.h>")
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
- if have_func("rb_w32_ioctlsocket", "ruby.h")
17
- have_func("rb_w32_is_socket", "ruby.h")
18
- create_makefile(target)
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
@@ -77,6 +77,8 @@ wait_for_single_fd(rb_io_t *fptr, int events, struct timeval *tv)
77
77
  *
78
78
  * Returns number of bytes that can be read without blocking.
79
79
  * Returns zero if no information available.
80
+ *
81
+ * You must require 'io/wait' to use this method.
80
82
  */
81
83
 
82
84
  static VALUE
@@ -119,9 +121,12 @@ io_wait_event(VALUE io, int event, VALUE timeout)
119
121
 
120
122
  /*
121
123
  * call-seq:
122
- * io.ready? -> true or false
124
+ * io.ready? -> truthy or falsy
125
+ *
126
+ * Returns a truthy value if input available without blocking, or a
127
+ * falsy value.
123
128
  *
124
- * Returns +true+ if input available without blocking, or +false+.
129
+ * You must require 'io/wait' to use this method.
125
130
  */
126
131
 
127
132
  static VALUE
@@ -148,12 +153,14 @@ io_ready_p(VALUE io)
148
153
 
149
154
  /*
150
155
  * call-seq:
151
- * io.wait_readable -> true or false
152
- * io.wait_readable(timeout) -> true or false
156
+ * io.wait_readable -> truthy or falsy
157
+ * io.wait_readable(timeout) -> truthy or falsy
158
+ *
159
+ * Waits until IO is readable and returns a truthy value, or a falsy
160
+ * value when times out. Returns a truthy value immediately when
161
+ * buffered data is available.
153
162
  *
154
- * Waits until IO is readable and returns +true+, or
155
- * +false+ when times out.
156
- * Returns +true+ immediately when buffered data is available.
163
+ * You must require 'io/wait' to use this method.
157
164
  */
158
165
 
159
166
  static VALUE
@@ -188,11 +195,13 @@ io_wait_readable(int argc, VALUE *argv, VALUE io)
188
195
 
189
196
  /*
190
197
  * call-seq:
191
- * io.wait_writable -> true or false
192
- * io.wait_writable(timeout) -> true or false
198
+ * io.wait_writable -> truthy or falsy
199
+ * io.wait_writable(timeout) -> truthy or falsy
193
200
  *
194
- * Waits until IO is writable and returns +true+ or
195
- * +false+ when times out.
201
+ * Waits until IO is writable and returns a truthy value or a falsy
202
+ * value when times out.
203
+ *
204
+ * You must require 'io/wait' to use this method.
196
205
  */
197
206
  static VALUE
198
207
  io_wait_writable(int argc, VALUE *argv, VALUE io)
@@ -223,11 +232,13 @@ io_wait_writable(int argc, VALUE *argv, VALUE io)
223
232
  #ifdef HAVE_RB_IO_WAIT
224
233
  /*
225
234
  * call-seq:
226
- * io.wait_priority -> true or false
227
- * io.wait_priority(timeout) -> true or false
235
+ * io.wait_priority -> truthy or falsy
236
+ * io.wait_priority(timeout) -> truthy or falsy
237
+ *
238
+ * Waits until IO is priority and returns a truthy value or a falsy
239
+ * value when times out.
228
240
  *
229
- * Waits until IO is priority and returns +true+ or
230
- * +false+ when times out.
241
+ * You must require 'io/wait' to use this method.
231
242
  */
232
243
  static VALUE
233
244
  io_wait_priority(int argc, VALUE *argv, VALUE io)
@@ -282,19 +293,21 @@ wait_mode_sym(VALUE mode)
282
293
 
283
294
  /*
284
295
  * call-seq:
285
- * io.wait(events, timeout) -> event mask or false.
286
- * io.wait(timeout = nil, mode = :read) -> event mask or false.
296
+ * io.wait(events, timeout) -> truthy or falsy
297
+ * io.wait(timeout = nil, mode = :read) -> truthy or falsy.
287
298
  *
288
299
  * Waits until the IO becomes ready for the specified events and returns the
289
- * subset of events that become ready, or +false+ when times out.
300
+ * subset of events that become ready, or a falsy value when times out.
290
301
  *
291
302
  * The events can be a bit mask of +IO::READABLE+, +IO::WRITABLE+ or
292
303
  * +IO::PRIORITY+.
293
304
  *
294
- * Returns +true+ immediately when buffered data is available.
305
+ * Returns a truthy value immediately when buffered data is available.
295
306
  *
296
307
  * Optional parameter +mode+ is one of +:read+, +:write+, or
297
308
  * +:read_write+.
309
+ *
310
+ * You must require 'io/wait' to use this method.
298
311
  */
299
312
 
300
313
  static VALUE
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.2.1
4
+ version: 0.2.2.pre1
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: 2021-11-19 00:00:00.000000000 Z
12
+ date: 2022-03-10 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: 2.6.0
44
+ version: '0'
49
45
  required_rubygems_version: !ruby/object:Gem::Requirement
50
46
  requirements:
51
- - - ">="
47
+ - - ">"
52
48
  - !ruby/object:Gem::Version
53
- version: '0'
49
+ version: 1.3.1
54
50
  requirements: []
55
- rubygems_version: 3.3.0.dev
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
@@ -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
@@ -1,5 +0,0 @@
1
- task "build" => "date_epoch"
2
-
3
- task "date_epoch" do
4
- ENV["SOURCE_DATE_EPOCH"] = IO.popen(%W[git -C #{__dir__} log -1 --format=%ct], &:read).chomp
5
- end
@@ -1,6 +0,0 @@
1
- task :sync_tool do
2
- require 'fileutils'
3
- FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib"
4
- FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
5
- FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
6
- end
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