cool.io 1.2.0-x86-mswin32-60

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.
Files changed (79) hide show
  1. data/.gitignore +26 -0
  2. data/.rspec +3 -0
  3. data/.travis.yml +5 -0
  4. data/CHANGES.md +177 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +20 -0
  7. data/README.md +172 -0
  8. data/Rakefile +81 -0
  9. data/cool.io.gemspec +28 -0
  10. data/examples/dslified_echo_client.rb +34 -0
  11. data/examples/dslified_echo_server.rb +24 -0
  12. data/examples/echo_client.rb +38 -0
  13. data/examples/echo_server.rb +27 -0
  14. data/examples/google.rb +9 -0
  15. data/examples/httpclient.rb +38 -0
  16. data/ext/cool.io/.gitignore +5 -0
  17. data/ext/cool.io/cool.io.h +58 -0
  18. data/ext/cool.io/cool.io_ext.c +25 -0
  19. data/ext/cool.io/ev_wrap.h +8 -0
  20. data/ext/cool.io/extconf.rb +73 -0
  21. data/ext/cool.io/iowatcher.c +189 -0
  22. data/ext/cool.io/libev.c +8 -0
  23. data/ext/cool.io/loop.c +301 -0
  24. data/ext/cool.io/stat_watcher.c +269 -0
  25. data/ext/cool.io/timer_watcher.c +219 -0
  26. data/ext/cool.io/utils.c +122 -0
  27. data/ext/cool.io/watcher.c +264 -0
  28. data/ext/cool.io/watcher.h +71 -0
  29. data/ext/http11_client/.gitignore +5 -0
  30. data/ext/http11_client/LICENSE +31 -0
  31. data/ext/http11_client/ext_help.h +14 -0
  32. data/ext/http11_client/extconf.rb +6 -0
  33. data/ext/http11_client/http11_client.c +300 -0
  34. data/ext/http11_client/http11_parser.c +403 -0
  35. data/ext/http11_client/http11_parser.h +48 -0
  36. data/ext/http11_client/http11_parser.rl +173 -0
  37. data/ext/iobuffer/extconf.rb +9 -0
  38. data/ext/iobuffer/iobuffer.c +765 -0
  39. data/ext/libev/Changes +388 -0
  40. data/ext/libev/LICENSE +36 -0
  41. data/ext/libev/README +58 -0
  42. data/ext/libev/README.embed +3 -0
  43. data/ext/libev/ev.c +4803 -0
  44. data/ext/libev/ev.h +845 -0
  45. data/ext/libev/ev_epoll.c +279 -0
  46. data/ext/libev/ev_kqueue.c +214 -0
  47. data/ext/libev/ev_poll.c +148 -0
  48. data/ext/libev/ev_port.c +185 -0
  49. data/ext/libev/ev_select.c +314 -0
  50. data/ext/libev/ev_vars.h +203 -0
  51. data/ext/libev/ev_win32.c +163 -0
  52. data/ext/libev/ev_wrap.h +200 -0
  53. data/ext/libev/test_libev_win32.c +123 -0
  54. data/lib/.gitignore +2 -0
  55. data/lib/cool.io.rb +32 -0
  56. data/lib/cool.io/async_watcher.rb +43 -0
  57. data/lib/cool.io/custom_require.rb +9 -0
  58. data/lib/cool.io/dns_resolver.rb +225 -0
  59. data/lib/cool.io/dsl.rb +135 -0
  60. data/lib/cool.io/eventmachine.rb +234 -0
  61. data/lib/cool.io/http_client.rb +427 -0
  62. data/lib/cool.io/io.rb +174 -0
  63. data/lib/cool.io/iowatcher.rb +17 -0
  64. data/lib/cool.io/listener.rb +93 -0
  65. data/lib/cool.io/loop.rb +130 -0
  66. data/lib/cool.io/meta.rb +49 -0
  67. data/lib/cool.io/server.rb +74 -0
  68. data/lib/cool.io/socket.rb +230 -0
  69. data/lib/cool.io/timer_watcher.rb +17 -0
  70. data/lib/cool.io/version.rb +5 -0
  71. data/lib/coolio.rb +2 -0
  72. data/spec/async_watcher_spec.rb +57 -0
  73. data/spec/dns_spec.rb +39 -0
  74. data/spec/spec_helper.rb +12 -0
  75. data/spec/stat_watcher_spec.rb +77 -0
  76. data/spec/timer_watcher_spec.rb +55 -0
  77. data/spec/unix_listener_spec.rb +25 -0
  78. data/spec/unix_server_spec.rb +25 -0
  79. metadata +200 -0
@@ -0,0 +1,77 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ TEMP_FILE_PATH = "./test.txt"
4
+
5
+ INTERVAL = 0.010
6
+
7
+ class MyStatWatcher < Cool.io::StatWatcher
8
+ attr_accessor :accessed, :previous, :current
9
+
10
+ def initialize(path)
11
+ super path, INTERVAL
12
+ end
13
+
14
+ def on_change(previous, current)
15
+ self.accessed = true
16
+ self.previous = previous
17
+ self.current = current
18
+ end
19
+ end
20
+
21
+ def run_with_file_change(path)
22
+ reactor = Cool.io::Loop.new
23
+
24
+ sw = MyStatWatcher.new(path)
25
+ sw.attach(reactor)
26
+
27
+ tw = Cool.io::TimerWatcher.new(INTERVAL, true)
28
+ tw.on_timer do
29
+ reactor.stop if sw.accessed
30
+ write_file(path)
31
+ end
32
+ tw.attach(reactor)
33
+
34
+ reactor.run
35
+
36
+ tw.detach
37
+ sw.detach
38
+
39
+ sw
40
+ end
41
+
42
+ def write_file(path)
43
+ File.open(path, "w+") { |f| f.write(rand.to_s) }
44
+ end
45
+
46
+ def delete_file(path)
47
+ File.delete(TEMP_FILE_PATH)
48
+ end
49
+
50
+ describe Cool.io::StatWatcher do
51
+
52
+ let :watcher do
53
+ run_with_file_change(TEMP_FILE_PATH)
54
+ end
55
+
56
+ before :each do
57
+ write_file(TEMP_FILE_PATH)
58
+ end
59
+
60
+ after :each do
61
+ delete_file(TEMP_FILE_PATH)
62
+ end
63
+
64
+ it "fire on_change when the file it is watching is modified" do
65
+ watcher.accessed.should eql(true)
66
+ end
67
+
68
+ it "should pass previous and current file stat info given a stat watcher" do
69
+ watcher.previous.ino.should eql(watcher.current.ino)
70
+ end
71
+
72
+ it "should raise when the handler does not take 2 parameters" do
73
+ class MyStatWatcher < Cool.io::StatWatcher; def on_change; end; end
74
+ lambda { watcher.accessed }.should raise_error(ArgumentError)
75
+ end
76
+
77
+ end
@@ -0,0 +1,55 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe Cool.io::TimerWatcher do
4
+
5
+ interval = 0.010
6
+
7
+ it "can have the on_timer callback defined after creation" do
8
+ @watcher = Cool.io::TimerWatcher.new(interval, true)
9
+ nr = '0'
10
+ @watcher.on_timer { nr.succ! }.should == nil
11
+ @watcher.attach(Cool.io::Loop.default).should == @watcher
12
+ nr.should == '0'
13
+ sleep interval
14
+ Cool.io::Loop.default.run_once
15
+ nr.should == '1'
16
+ end
17
+
18
+ it "can be subclassed" do
19
+ class MyTimerWatcher < Cool.io::TimerWatcher
20
+ TMP = '0'
21
+
22
+ def on_timer
23
+ TMP.succ!
24
+ end
25
+ end
26
+ @watcher = MyTimerWatcher.new(interval, true)
27
+ @watcher.attach(Cool.io::Loop.default).should == @watcher
28
+ MyTimerWatcher::TMP.should == '0'
29
+ sleep interval
30
+ Cool.io::Loop.default.run_once
31
+ MyTimerWatcher::TMP.should == '1'
32
+ end
33
+
34
+ it "can have the on_timer callback redefined between runs" do
35
+ @watcher = Cool.io::TimerWatcher.new(interval, true)
36
+ nr = '0'
37
+ @watcher.on_timer { nr.succ! }.should == nil
38
+ @watcher.attach(Cool.io::Loop.default).should == @watcher
39
+ nr.should == '0'
40
+ sleep interval
41
+ Cool.io::Loop.default.run_once
42
+ nr.should == '1'
43
+ @watcher.detach
44
+ @watcher.on_timer { nr = :foo }.should == nil
45
+ @watcher.attach(Cool.io::Loop.default).should == @watcher
46
+ nr.should == '1'
47
+ sleep interval
48
+ Cool.io::Loop.default.run_once
49
+ nr.should == :foo
50
+ end
51
+
52
+ after :each do
53
+ @watcher.detach if defined?(@watcher)
54
+ end
55
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+ require 'tempfile'
3
+
4
+ describe Cool.io::UNIXListener, :env => :win do
5
+
6
+ before :each do
7
+ @tmp = Tempfile.new('coolio_unix_listener_spec')
8
+ File.unlink(@tmp.path).should == 1
9
+ File.exist?(@tmp.path).should == false
10
+ end
11
+
12
+ it "creates a new UNIXListener" do
13
+ listener = Cool.io::UNIXListener.new(@tmp.path)
14
+ File.socket?(@tmp.path).should == true
15
+ end
16
+
17
+ it "builds off an existing UNIXServer" do
18
+ unix_server = UNIXServer.new(@tmp.path)
19
+ File.socket?(@tmp.path).should == true
20
+ listener = Cool.io::UNIXListener.new(unix_server)
21
+ File.socket?(@tmp.path).should == true
22
+ listener.fileno.should == unix_server.fileno
23
+ end
24
+
25
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+ require 'tempfile'
3
+
4
+ describe Cool.io::UNIXServer, :env => :win do
5
+
6
+ before :each do
7
+ @tmp = Tempfile.new('coolio_unix_server_spec')
8
+ File.unlink(@tmp.path).should == 1
9
+ File.exist?(@tmp.path).should == false
10
+ end
11
+
12
+ it "creates a new Cool.io::UNIXServer" do
13
+ listener = Cool.io::UNIXListener.new(@tmp.path)
14
+ File.socket?(@tmp.path).should == true
15
+ end
16
+
17
+ it "builds off an existing ::UNIXServer" do
18
+ unix_server = ::UNIXServer.new(@tmp.path)
19
+ File.socket?(@tmp.path).should == true
20
+ listener = Cool.io::UNIXServer.new(unix_server)
21
+ File.socket?(@tmp.path).should == true
22
+ listener.fileno.should == unix_server.fileno
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cool.io
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
11
+ platform: x86-mswin32-60
12
+ authors:
13
+ - Tony Arcieri
14
+ - Masahiro Nakagawa
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2013-05-27 00:00:00 -07:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ type: :development
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 57
30
+ segments:
31
+ - 0
32
+ - 8
33
+ - 3
34
+ version: 0.8.3
35
+ name: rake-compiler
36
+ version_requirements: *id001
37
+ prerelease: false
38
+ - !ruby/object:Gem::Dependency
39
+ type: :development
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 59
46
+ segments:
47
+ - 2
48
+ - 13
49
+ - 0
50
+ version: 2.13.0
51
+ name: rspec
52
+ version_requirements: *id002
53
+ prerelease: false
54
+ - !ruby/object:Gem::Dependency
55
+ type: :development
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 31
62
+ segments:
63
+ - 3
64
+ - 6
65
+ - 0
66
+ version: 3.6.0
67
+ name: rdoc
68
+ version_requirements: *id003
69
+ prerelease: false
70
+ description: Cool.io provides a high performance event framework for Ruby which uses the libev C library
71
+ email:
72
+ - tony.arcieri@gmail.com
73
+ - repeatedly@gmail.com
74
+ executables: []
75
+
76
+ extensions: []
77
+
78
+ extra_rdoc_files: []
79
+
80
+ files:
81
+ - .gitignore
82
+ - .rspec
83
+ - .travis.yml
84
+ - CHANGES.md
85
+ - Gemfile
86
+ - LICENSE
87
+ - README.md
88
+ - Rakefile
89
+ - cool.io.gemspec
90
+ - examples/dslified_echo_client.rb
91
+ - examples/dslified_echo_server.rb
92
+ - examples/echo_client.rb
93
+ - examples/echo_server.rb
94
+ - examples/google.rb
95
+ - examples/httpclient.rb
96
+ - ext/cool.io/.gitignore
97
+ - ext/cool.io/cool.io.h
98
+ - ext/cool.io/cool.io_ext.c
99
+ - ext/cool.io/ev_wrap.h
100
+ - ext/cool.io/extconf.rb
101
+ - ext/cool.io/iowatcher.c
102
+ - ext/cool.io/libev.c
103
+ - ext/cool.io/loop.c
104
+ - ext/cool.io/stat_watcher.c
105
+ - ext/cool.io/timer_watcher.c
106
+ - ext/cool.io/utils.c
107
+ - ext/cool.io/watcher.c
108
+ - ext/cool.io/watcher.h
109
+ - ext/http11_client/.gitignore
110
+ - ext/http11_client/LICENSE
111
+ - ext/http11_client/ext_help.h
112
+ - ext/http11_client/extconf.rb
113
+ - ext/http11_client/http11_client.c
114
+ - ext/http11_client/http11_parser.c
115
+ - ext/http11_client/http11_parser.h
116
+ - ext/http11_client/http11_parser.rl
117
+ - ext/iobuffer/extconf.rb
118
+ - ext/iobuffer/iobuffer.c
119
+ - ext/libev/Changes
120
+ - ext/libev/LICENSE
121
+ - ext/libev/README
122
+ - ext/libev/README.embed
123
+ - ext/libev/ev.c
124
+ - ext/libev/ev.h
125
+ - ext/libev/ev_epoll.c
126
+ - ext/libev/ev_kqueue.c
127
+ - ext/libev/ev_poll.c
128
+ - ext/libev/ev_port.c
129
+ - ext/libev/ev_select.c
130
+ - ext/libev/ev_vars.h
131
+ - ext/libev/ev_win32.c
132
+ - ext/libev/ev_wrap.h
133
+ - ext/libev/test_libev_win32.c
134
+ - lib/.gitignore
135
+ - lib/cool.io.rb
136
+ - lib/cool.io/async_watcher.rb
137
+ - lib/cool.io/custom_require.rb
138
+ - lib/cool.io/dns_resolver.rb
139
+ - lib/cool.io/dsl.rb
140
+ - lib/cool.io/eventmachine.rb
141
+ - lib/cool.io/http_client.rb
142
+ - lib/cool.io/io.rb
143
+ - lib/cool.io/iowatcher.rb
144
+ - lib/cool.io/listener.rb
145
+ - lib/cool.io/loop.rb
146
+ - lib/cool.io/meta.rb
147
+ - lib/cool.io/server.rb
148
+ - lib/cool.io/socket.rb
149
+ - lib/cool.io/timer_watcher.rb
150
+ - lib/cool.io/version.rb
151
+ - lib/coolio.rb
152
+ - spec/async_watcher_spec.rb
153
+ - spec/dns_spec.rb
154
+ - spec/spec_helper.rb
155
+ - spec/stat_watcher_spec.rb
156
+ - spec/timer_watcher_spec.rb
157
+ - spec/unix_listener_spec.rb
158
+ - spec/unix_server_spec.rb
159
+ - lib/1.9/iobuffer_ext.so
160
+ - lib/2.0/iobuffer_ext.so
161
+ - lib/1.9/http11_client.so
162
+ - lib/2.0/http11_client.so
163
+ - lib/1.9/cool.io_ext.so
164
+ - lib/2.0/cool.io_ext.so
165
+ has_rdoc: true
166
+ homepage: http://coolio.github.com
167
+ licenses: []
168
+
169
+ post_install_message:
170
+ rdoc_options: []
171
+
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ none: false
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ hash: 3
180
+ segments:
181
+ - 0
182
+ version: "0"
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
+ none: false
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ hash: 3
189
+ segments:
190
+ - 0
191
+ version: "0"
192
+ requirements: []
193
+
194
+ rubyforge_project:
195
+ rubygems_version: 1.6.2
196
+ signing_key:
197
+ specification_version: 3
198
+ summary: A cool framework for doing high performance I/O in Ruby
199
+ test_files: []
200
+