kgio 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -2,6 +2,7 @@ LICENSE
2
2
  README
3
3
  TODO
4
4
  NEWS
5
+ LATEST
5
6
  ChangeLog
6
7
  ISSUES
7
8
  HACKING
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ pkg/
18
18
  /man
19
19
  tags
20
20
  TAGS
21
+ /LATEST
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v2.0.0.GIT
4
+ DEF_VER=v2.1.0.GIT
5
5
 
6
6
  LF='
7
7
  '
@@ -3,7 +3,6 @@ all::
3
3
  RUBY = ruby
4
4
  RAKE = rake
5
5
  RSYNC = rsync
6
- GIT_URL = git://git.bogomips.org/kgio.git
7
6
 
8
7
  GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
9
8
  @./GIT-VERSION-GEN
@@ -32,56 +31,22 @@ clean:
32
31
  -$(MAKE) -C ext/kgio clean
33
32
  $(RM) $(setup_rb_files) ext/kgio/Makefile
34
33
 
35
- pkg_extra := GIT-VERSION-FILE NEWS ChangeLog
36
- manifest: $(pkg_extra)
37
- $(RM) .manifest
38
- $(MAKE) .manifest
34
+ pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST
35
+ ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
36
+ wrongdoc prepare
39
37
 
40
- .manifest:
41
- (git ls-files && \
42
- for i in $@ $(pkg_extra) $(man1_paths); \
43
- do echo $$i; done) | LC_ALL=C sort > $@+
38
+ .manifest: ChangeLog
39
+ (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
40
+ LC_ALL=C sort > $@+
44
41
  cmp $@+ $@ || mv $@+ $@
45
42
  $(RM) $@+
46
43
 
47
- NEWS: GIT-VERSION-FILE
48
- $(RAKE) -s news_rdoc > $@+
49
- mv $@+ $@
50
-
51
- latest: NEWS
52
- @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $<
53
-
54
- SINCE =
55
- ChangeLog: LOG_VERSION = \
56
- $(shell git rev-parse -q "$(GIT_VERSION)" >/dev/null 2>&1 && \
57
- echo $(GIT_VERSION) || git describe)
58
- ifneq ($(SINCE),)
59
- ChangeLog: log_range = v$(SINCE)..$(LOG_VERSION)
60
- endif
61
- ChangeLog: GIT-VERSION-FILE
62
- @echo "ChangeLog from $(GIT_URL) ($(log_range))" > $@+
63
- @echo >> $@+
64
- git log $(log_range) | sed -e 's/^/ /' >> $@+
65
- mv $@+ $@
66
-
67
- news_atom := http://bogomips.org/kgio/NEWS.atom.xml
68
- cgit_atom := http://git.bogomips.org/cgit/kgio.git/atom/?h=master
69
- atom = <link rel="alternate" title="Atom feed" href="$(1)" \
70
- type="application/atom+xml"/>
71
-
72
- # using rdoc 2.5.x
73
- doc: .document NEWS ChangeLog
74
- rdoc -t "$(shell sed -ne '1s/^= //p' README)"
44
+ doc: .document .wrongdoc.yml
45
+ find lib ext -type f -name '*.rbc' -exec rm -f '{}' ';'
46
+ $(RM) -r doc
47
+ wrongdoc all
75
48
  install -m644 COPYING doc/COPYING
76
49
  install -m644 $(shell grep '^[A-Z]' .document) doc/
77
- $(RUBY) -i -p -e \
78
- '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
79
- doc/ChangeLog.html
80
- $(RUBY) -i -p -e \
81
- '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
82
- doc/NEWS.html doc/README.html
83
- $(RAKE) -s news_atom > doc/NEWS.atom.xml
84
- cd doc && ln README.html tmp && mv tmp index.html
85
50
 
86
51
  ifneq ($(VERSION),)
87
52
  rfproject := rainbows
@@ -94,10 +59,10 @@ release_changes := release_changes-$(VERSION)
94
59
  release-notes: $(release_notes)
95
60
  release-changes: $(release_changes)
96
61
  $(release_changes):
97
- $(RAKE) -s release_changes > $@+
62
+ wrongdoc release_changes > $@+
98
63
  $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
99
64
  $(release_notes):
100
- GIT_URL=$(GIT_URL) $(RAKE) -s release_notes > $@+
65
+ wrongdoc release_notes > $@+
101
66
  $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
102
67
 
103
68
  # ensures we're actually on the tagged $(VERSION), only used for release
@@ -170,10 +135,8 @@ $(test_units): build
170
135
  # this requires GNU coreutils variants
171
136
  publish_doc:
172
137
  -git set-file-times
173
- $(RM) -r doc ChangeLog NEWS
174
- $(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
175
- $(MAKE) -s latest > doc/LATEST
176
- find doc/images doc/js -type f | \
138
+ $(MAKE) doc
139
+ find doc/images -type f | \
177
140
  TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
178
141
  $(MAKE) doc_gz
179
142
  chmod 644 $$(find doc -type f)
@@ -184,8 +147,7 @@ publish_doc:
184
147
  # "gzip_static on" can serve the gzipped versions directly.
185
148
  doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
186
149
  doc_gz:
187
- touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
188
150
  for i in $(docs); do \
189
151
  gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
190
152
 
191
- .PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test $(test_units)
153
+ .PHONY: .FORCE-GIT-VERSION-FILE doc manifest test $(test_units)
data/Rakefile CHANGED
@@ -1,106 +1,6 @@
1
1
  # -*- encoding: binary -*-
2
-
3
- # most tasks are in the GNUmakefile which offers better parallelism
4
-
5
- def tags
6
- timefmt = '%Y-%m-%dT%H:%M:%SZ'
7
- @tags ||= `git tag -l`.split(/\n/).map do |tag|
8
- if %r{\Av[\d\.]+} =~ tag
9
- header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
10
- header = header.split(/\n/)
11
- tagger = header.grep(/\Atagger /).first
12
- body ||= "initial"
13
- {
14
- :time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
15
- :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1].strip,
16
- :tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
17
- :id => `git rev-parse refs/tags/#{tag}`.chomp!,
18
- :tag => tag,
19
- :subject => subject,
20
- :body => body,
21
- }
22
- end
23
- end.compact.sort { |a,b| b[:time] <=> a[:time] }
24
- end
25
-
26
2
  cgit_url = "http://git.bogomips.org/cgit/kgio.git"
27
- git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/kgio.git'
28
- web_url = "http://bogomips.org/kgio"
29
-
30
- desc 'prints news as an Atom feed'
31
- task :news_atom do
32
- require 'nokogiri'
33
- new_tags = tags[0,10]
34
- puts(Nokogiri::XML::Builder.new do
35
- feed :xmlns => "http://www.w3.org/2005/Atom" do
36
- id! "#{web_url}NEWS.atom.xml"
37
- title "kgio news"
38
- subtitle "socket methods using MSG_DONTWAIT and more"
39
- link! :rel => "alternate", :type => "text/html",
40
- :href => "#{web_url}NEWS.html"
41
- updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time])
42
- new_tags.each do |tag|
43
- entry do
44
- title tag[:subject]
45
- updated tag[:time]
46
- published tag[:time]
47
- author {
48
- name tag[:tagger_name]
49
- email tag[:tagger_email]
50
- }
51
- url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
52
- link! :rel => "alternate", :type => "text/html", :href =>url
53
- id! url
54
- message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/s).first.strip
55
- content({:type =>:text}, message_only)
56
- content(:type =>:xhtml) { pre tag[:body] }
57
- end
58
- end
59
- end
60
- end.to_xml)
61
- end
62
-
63
- desc 'prints RDoc-formatted news'
64
- task :news_rdoc do
65
- tags.each do |tag|
66
- time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
67
- puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
68
- puts ""
69
-
70
- body = tag[:body]
71
- puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
72
- puts ""
73
- end
74
- end
75
-
76
- desc "print release changelog for Rubyforge"
77
- task :release_changes do
78
- version = ENV['VERSION'] or abort "VERSION= needed"
79
- version = "v#{version}"
80
- vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
81
- prev = vtags[vtags.index(version) - 1]
82
- if prev
83
- system('git', 'diff', '--stat', prev, version) or abort $?
84
- puts ""
85
- system('git', 'log', "#{prev}..#{version}") or abort $?
86
- else
87
- system('git', 'log', version) or abort $?
88
- end
89
- end
90
-
91
- desc "print release notes for Rubyforge"
92
- task :release_notes do
93
- spec = Gem::Specification.load('kgio.gemspec')
94
- puts spec.description.strip
95
- puts ""
96
- puts "* #{spec.homepage}"
97
- puts "* #{spec.email}"
98
- puts "* #{git_url}"
99
-
100
- _, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
101
- print "\nChanges:\n\n"
102
- puts body
103
- end
3
+ git_url = 'git://git.bogomips.org/kgio.git'
104
4
 
105
5
  desc "post news article to rubyforge"
106
6
  task :publish_news do
@@ -157,7 +57,7 @@ task :raa_update do
157
57
  :category_minor => 'System',
158
58
  :url => s.homepage,
159
59
  :download => 'http://rubyforge.org/frs/?group_id=8977',
160
- :license => "Ruby's",
60
+ :license => "LGPL",
161
61
  :description_style => 'Plain',
162
62
  :description => desc,
163
63
  :pass => password,
@@ -20,6 +20,11 @@ struct accept_args {
20
20
  socklen_t *addrlen;
21
21
  };
22
22
 
23
+ /*
24
+ * Sets the default class for newly accepted sockets. This is
25
+ * legacy behavior, kgio_accept and kgio_tryaccept now take optional
26
+ * class arguments to override this value.
27
+ */
23
28
  static VALUE set_accepted(VALUE klass, VALUE aclass)
24
29
  {
25
30
  VALUE tmp;
@@ -39,6 +44,10 @@ static VALUE set_accepted(VALUE klass, VALUE aclass)
39
44
  return aclass;
40
45
  }
41
46
 
47
+ /*
48
+ * Returns the default class for newly accepted sockets when kgio_accept
49
+ * or kgio_tryaccept are not passed arguments
50
+ */
42
51
  static VALUE get_accepted(VALUE klass)
43
52
  {
44
53
  return cClientSocket;
@@ -47,8 +56,15 @@ static VALUE get_accepted(VALUE klass)
47
56
  static VALUE xaccept(void *ptr)
48
57
  {
49
58
  struct accept_args *a = ptr;
59
+ int rv;
50
60
 
51
- return (VALUE)accept4(a->fd, a->addr, a->addrlen, accept4_flags);
61
+ rv = accept_fn(a->fd, a->addr, a->addrlen, accept4_flags);
62
+ if (rv == -1 && errno == ENOSYS && accept_fn != my_accept4) {
63
+ accept_fn = my_accept4;
64
+ rv = accept_fn(a->fd, a->addr, a->addrlen, accept4_flags);
65
+ }
66
+
67
+ return (VALUE)rv;
52
68
  }
53
69
 
54
70
  #ifdef HAVE_RB_THREAD_BLOCKING_REGION
@@ -107,8 +123,19 @@ static int thread_accept(struct accept_args *a, int force_nonblock)
107
123
  #define set_blocking_or_block(fd) (void)rb_io_wait_readable(fd)
108
124
  #endif /* ! HAVE_RB_THREAD_BLOCKING_REGION */
109
125
 
126
+ static VALUE acceptor(int argc, const VALUE *argv)
127
+ {
128
+ if (argc == 0)
129
+ return cClientSocket; /* default, legacy behavior */
130
+ else if (argc == 1)
131
+ return argv[0];
132
+
133
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
134
+ }
135
+
110
136
  static VALUE
111
- my_accept(VALUE io, struct sockaddr *addr, socklen_t *addrlen, int nonblock)
137
+ my_accept(VALUE io, VALUE klass,
138
+ struct sockaddr *addr, socklen_t *addrlen, int nonblock)
112
139
  {
113
140
  int client;
114
141
  struct accept_args a;
@@ -148,7 +175,7 @@ retry:
148
175
  rb_sys_fail("accept");
149
176
  }
150
177
  }
151
- return sock_for_fd(cClientSocket, client);
178
+ return sock_for_fd(klass, client);
152
179
  }
153
180
 
154
181
  static void in_addr_set(VALUE io, struct sockaddr_in *addr)
@@ -175,12 +202,18 @@ static void in_addr_set(VALUE io, struct sockaddr_in *addr)
175
202
  * connected client on success.
176
203
  *
177
204
  * Returns nil on EAGAIN, and raises on other errors.
205
+ *
206
+ * An optional class argument may be specified to override the
207
+ * Kgio::Socket-class return value:
208
+ *
209
+ * server.kgio_accept(MySocket) -> MySocket
178
210
  */
179
- static VALUE tcp_tryaccept(VALUE io)
211
+ static VALUE tcp_tryaccept(int argc, VALUE *argv, VALUE io)
180
212
  {
181
213
  struct sockaddr_in addr;
182
214
  socklen_t addrlen = sizeof(struct sockaddr_in);
183
- VALUE rv = my_accept(io, (struct sockaddr *)&addr, &addrlen, 1);
215
+ VALUE klass = acceptor(argc, argv);
216
+ VALUE rv = my_accept(io, klass, (struct sockaddr *)&addr, &addrlen, 1);
184
217
 
185
218
  if (!NIL_P(rv))
186
219
  in_addr_set(rv, &addr);
@@ -199,12 +232,18 @@ static VALUE tcp_tryaccept(VALUE io)
199
232
  *
200
233
  * On Ruby implementations using native threads, this can use a blocking
201
234
  * accept(2) (or accept4(2)) system call to avoid thundering herds.
235
+ *
236
+ * An optional class argument may be specified to override the
237
+ * Kgio::Socket-class return value:
238
+ *
239
+ * server.kgio_accept(MySocket) -> MySocket
202
240
  */
203
- static VALUE tcp_accept(VALUE io)
241
+ static VALUE tcp_accept(int argc, VALUE *argv, VALUE io)
204
242
  {
205
243
  struct sockaddr_in addr;
206
244
  socklen_t addrlen = sizeof(struct sockaddr_in);
207
- VALUE rv = my_accept(io, (struct sockaddr *)&addr, &addrlen, 0);
245
+ VALUE klass = acceptor(argc, argv);
246
+ VALUE rv = my_accept(io, klass, (struct sockaddr *)&addr, &addrlen, 0);
208
247
 
209
248
  in_addr_set(rv, &addr);
210
249
  return rv;
@@ -221,10 +260,16 @@ static VALUE tcp_accept(VALUE io)
221
260
  * Kgio::LOCALHOST) on success.
222
261
  *
223
262
  * Returns nil on EAGAIN, and raises on other errors.
263
+ *
264
+ * An optional class argument may be specified to override the
265
+ * Kgio::Socket-class return value:
266
+ *
267
+ * server.kgio_tryaccept(MySocket) -> MySocket
224
268
  */
225
- static VALUE unix_tryaccept(VALUE io)
269
+ static VALUE unix_tryaccept(int argc, VALUE *argv, VALUE io)
226
270
  {
227
- VALUE rv = my_accept(io, NULL, NULL, 1);
271
+ VALUE klass = acceptor(argc, argv);
272
+ VALUE rv = my_accept(io, klass, NULL, NULL, 1);
228
273
 
229
274
  if (!NIL_P(rv))
230
275
  rb_ivar_set(rv, iv_kgio_addr, localhost);
@@ -243,10 +288,16 @@ static VALUE unix_tryaccept(VALUE io)
243
288
  *
244
289
  * On Ruby implementations using native threads, this can use a blocking
245
290
  * accept(2) (or accept4(2)) system call to avoid thundering herds.
291
+ *
292
+ * An optional class argument may be specified to override the
293
+ * Kgio::Socket-class return value:
294
+ *
295
+ * server.kgio_accept(MySocket) -> MySocket
246
296
  */
247
- static VALUE unix_accept(VALUE io)
297
+ static VALUE unix_accept(int argc, VALUE *argv, VALUE io)
248
298
  {
249
- VALUE rv = my_accept(io, NULL, NULL, 0);
299
+ VALUE klass = acceptor(argc, argv);
300
+ VALUE rv = my_accept(io, klass, NULL, NULL, 0);
250
301
 
251
302
  rb_ivar_set(rv, iv_kgio_addr, localhost);
252
303
  return rv;
@@ -360,13 +411,13 @@ void init_kgio_accept(void)
360
411
 
361
412
  cUNIXServer = rb_const_get(rb_cObject, rb_intern("UNIXServer"));
362
413
  cUNIXServer = rb_define_class_under(mKgio, "UNIXServer", cUNIXServer);
363
- rb_define_method(cUNIXServer, "kgio_tryaccept", unix_tryaccept, 0);
364
- rb_define_method(cUNIXServer, "kgio_accept", unix_accept, 0);
414
+ rb_define_method(cUNIXServer, "kgio_tryaccept", unix_tryaccept, -1);
415
+ rb_define_method(cUNIXServer, "kgio_accept", unix_accept, -1);
365
416
 
366
417
  cTCPServer = rb_const_get(rb_cObject, rb_intern("TCPServer"));
367
418
  cTCPServer = rb_define_class_under(mKgio, "TCPServer", cTCPServer);
368
- rb_define_method(cTCPServer, "kgio_tryaccept", tcp_tryaccept, 0);
369
- rb_define_method(cTCPServer, "kgio_accept", tcp_accept, 0);
419
+ rb_define_method(cTCPServer, "kgio_tryaccept", tcp_tryaccept, -1);
420
+ rb_define_method(cTCPServer, "kgio_accept", tcp_accept, -1);
370
421
  init_sock_for_fd();
371
422
  iv_kgio_addr = rb_intern("@kgio_addr");
372
423
  }
@@ -119,7 +119,7 @@ static VALUE unix_connect(VALUE klass, VALUE path, int io_wait)
119
119
 
120
120
  StringValue(path);
121
121
  len = RSTRING_LEN(path);
122
- if (sizeof(addr.sun_path) <= len)
122
+ if ((long)sizeof(addr.sun_path) <= len)
123
123
  rb_raise(rb_eArgError,
124
124
  "too long unix socket path (max: %dbytes)",
125
125
  (int)sizeof(addr.sun_path)-1);
@@ -13,10 +13,11 @@
13
13
  # define SOCK_NONBLOCK O_NONBLOCK
14
14
  # endif
15
15
  # endif
16
+ #endif /* !HAVE_ACCEPT4 */
16
17
 
17
18
  /* accept4() is currently a Linux-only goodie */
18
19
  static int
19
- accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
20
+ my_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
20
21
  {
21
22
  int fd = accept(sockfd, addr, addrlen);
22
23
 
@@ -49,4 +50,10 @@ accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
49
50
  }
50
51
  return fd;
51
52
  }
52
- #endif /* !HAVE_ACCEPT4 */
53
+
54
+ typedef int accept_fn_t(int, struct sockaddr *, socklen_t *, int);
55
+ #ifdef HAVE_ACCEPT4
56
+ static accept_fn_t *accept_fn = accept4;
57
+ #else
58
+ static accept_fn_t *accept_fn = my_accept4;
59
+ #endif
@@ -64,6 +64,6 @@ static void init_sock_for_fd(void)
64
64
  }
65
65
  #endif /* sock_for_fd */
66
66
  #if SOCK_FOR_FD > 0
67
- # define init_sock_for_fd() if (0)
67
+ # define init_sock_for_fd() for (;0;)
68
68
  #endif
69
69
  #endif /* SOCK_FOR_FD_H */
@@ -11,7 +11,7 @@ static ID id_wait_rd, id_wait_wr;
11
11
 
12
12
 
13
13
  /*
14
- * Blocks the running Thread indefinitely until +self+ IO object is writable.
14
+ * Blocks the running Thread indefinitely until +self+ IO object is readable.
15
15
  * This method is automatically called by default whenever kgio_read needs
16
16
  * to block on input.
17
17
  *
@@ -29,9 +29,10 @@ static VALUE kgio_wait_readable(VALUE self)
29
29
  }
30
30
 
31
31
  /*
32
- * blocks the running Thread indefinitely until +self+ IO object is writable
32
+ * Blocks the running Thread indefinitely until +self+ IO object is writable.
33
33
  * This method is automatically called whenever kgio_write needs to
34
34
  * block on output.
35
+ *
35
36
  * Users of alternative threading/fiber libraries are
36
37
  * encouraged to override this method in their subclasses or modules to
37
38
  * work with their threading/blocking methods.
@@ -1,36 +1,27 @@
1
1
  ENV["VERSION"] or abort "VERSION= must be specified"
2
2
  manifest = File.readlines('.manifest').map! { |x| x.chomp! }
3
- summary = File.readlines("README")[0].gsub(/\A=\s+\S+[^\w]+/, '').strip
4
- description = File.read("README").split(/\n\n/)[1].strip
3
+ require 'wrongdoc'
4
+ extend Wrongdoc::Gemspec
5
+ name, summary, title = readme_metadata
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = %q{kgio}
8
- s.version = ENV["VERSION"]
9
-
10
- s.homepage = 'http://bogomips.org/kgio/'
11
- s.authors = ["kgio hackers"]
9
+ s.version = ENV["VERSION"].dup
10
+ s.homepage = Wrongdoc.config[:rdoc_url]
11
+ s.authors = ["#{name} hackers"]
12
12
  s.date = Time.now.utc.strftime('%Y-%m-%d')
13
- s.description = description
13
+ s.description = readme_description
14
14
  s.email = %q{kgio@bogomips.org}
15
-
16
- s.extra_rdoc_files = File.readlines('.document').map! do |x|
17
- x.chomp!
18
- if File.directory?(x)
19
- manifest.grep(%r{\A#{x}/})
20
- elsif File.file?(x)
21
- x
22
- else
23
- nil
24
- end
25
- end.flatten.compact
26
-
15
+ s.extra_rdoc_files = extra_rdoc_files(manifest)
27
16
  s.files = manifest
28
- s.rdoc_options = [ "-t", summary ]
17
+ s.rdoc_options = rdoc_options
29
18
  s.require_paths = %w(lib ext)
30
19
  s.rubyforge_project = %q{rainbows}
31
20
  s.summary = summary
32
21
  s.test_files = Dir['test/test_*.rb']
33
22
  s.extensions = %w(ext/kgio/extconf.rb)
34
23
 
24
+ s.add_development_dependency('wrongdoc', '~> 1.0.1')
25
+
35
26
  # s.license = %w(LGPL) # disabled for compatibility with older RubyGems
36
27
  end
@@ -4,6 +4,9 @@ $-w = true
4
4
  require 'kgio'
5
5
 
6
6
  class TestAcceptClass < Test::Unit::TestCase
7
+ class FooSocket < Kgio::Socket
8
+ end
9
+
7
10
  def setup
8
11
  assert_equal Kgio::Socket, Kgio.accept_class
9
12
  end
@@ -48,5 +51,12 @@ class TestAcceptClass < Test::Unit::TestCase
48
51
  client = TCPSocket.new(@host, @port)
49
52
  IO.select([@srv])
50
53
  assert_instance_of Kgio::UNIXSocket, @srv.kgio_tryaccept
54
+
55
+ client = TCPSocket.new(@host, @port)
56
+ assert_instance_of FooSocket, @srv.kgio_accept(FooSocket)
57
+
58
+ client = TCPSocket.new(@host, @port)
59
+ IO.select([@srv])
60
+ assert_instance_of FooSocket, @srv.kgio_tryaccept(FooSocket)
51
61
  end
52
62
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kgio
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 2.0.0
10
+ version: 2.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - kgio hackers
@@ -15,10 +15,25 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-19 00:00:00 +00:00
18
+ date: 2010-12-26 00:00:00 +00:00
19
19
  default_executable:
20
- dependencies: []
21
-
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: wrongdoc
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 1
34
+ version: 1.0.1
35
+ type: :development
36
+ version_requirements: *id001
22
37
  description: |-
23
38
  kgio provides non-blocking I/O methods for Ruby without raising
24
39
  exceptions on EAGAIN and EINPROGRESS. It is intended for use with the
@@ -97,7 +112,9 @@ licenses: []
97
112
  post_install_message:
98
113
  rdoc_options:
99
114
  - -t
100
- - kinder, gentler I/O for Ruby
115
+ - kgio - kinder, gentler I/O for Ruby
116
+ - -W
117
+ - http://git.bogomips.org/cgit/kgio.git/tree/%s
101
118
  require_paths:
102
119
  - lib
103
120
  - ext