eventmachine-eventmachine 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +169 -0
- data/docs/COPYING +60 -0
- data/docs/ChangeLog +183 -0
- data/docs/DEFERRABLES +138 -0
- data/docs/EPOLL +141 -0
- data/docs/GNU +281 -0
- data/docs/INSTALL +15 -0
- data/docs/KEYBOARD +38 -0
- data/docs/LEGAL +25 -0
- data/docs/LIGHTWEIGHT_CONCURRENCY +72 -0
- data/docs/PURE_RUBY +77 -0
- data/docs/README +74 -0
- data/docs/RELEASE_NOTES +96 -0
- data/docs/SMTP +9 -0
- data/docs/SPAWNED_PROCESSES +93 -0
- data/docs/TODO +10 -0
- data/ext/binder.cpp +126 -0
- data/ext/binder.h +48 -0
- data/ext/cmain.cpp +530 -0
- data/ext/cplusplus.cpp +172 -0
- data/ext/ed.cpp +1473 -0
- data/ext/ed.h +361 -0
- data/ext/em.cpp +1895 -0
- data/ext/em.h +170 -0
- data/ext/emwin.cpp +300 -0
- data/ext/emwin.h +94 -0
- data/ext/epoll.cpp +26 -0
- data/ext/epoll.h +25 -0
- data/ext/eventmachine.h +90 -0
- data/ext/eventmachine_cpp.h +94 -0
- data/ext/extconf.rb +150 -0
- data/ext/files.cpp +94 -0
- data/ext/files.h +65 -0
- data/ext/kb.cpp +368 -0
- data/ext/page.cpp +107 -0
- data/ext/page.h +51 -0
- data/ext/pipe.cpp +327 -0
- data/ext/project.h +119 -0
- data/ext/rubymain.cpp +683 -0
- data/ext/sigs.cpp +89 -0
- data/ext/sigs.h +32 -0
- data/ext/ssl.cpp +408 -0
- data/ext/ssl.h +86 -0
- data/java/src/com/rubyeventmachine/Application.java +196 -0
- data/java/src/com/rubyeventmachine/Connection.java +74 -0
- data/java/src/com/rubyeventmachine/ConnectionFactory.java +37 -0
- data/java/src/com/rubyeventmachine/DefaultConnectionFactory.java +46 -0
- data/java/src/com/rubyeventmachine/EmReactor.java +408 -0
- data/java/src/com/rubyeventmachine/EmReactorException.java +40 -0
- data/java/src/com/rubyeventmachine/EventableChannel.java +57 -0
- data/java/src/com/rubyeventmachine/EventableDatagramChannel.java +171 -0
- data/java/src/com/rubyeventmachine/EventableSocketChannel.java +244 -0
- data/java/src/com/rubyeventmachine/PeriodicTimer.java +38 -0
- data/java/src/com/rubyeventmachine/Timer.java +54 -0
- data/java/src/com/rubyeventmachine/tests/ApplicationTest.java +108 -0
- data/java/src/com/rubyeventmachine/tests/ConnectTest.java +124 -0
- data/java/src/com/rubyeventmachine/tests/EMTest.java +80 -0
- data/java/src/com/rubyeventmachine/tests/TestDatagrams.java +53 -0
- data/java/src/com/rubyeventmachine/tests/TestServers.java +74 -0
- data/java/src/com/rubyeventmachine/tests/TestTimers.java +89 -0
- data/lib/em/deferrable.rb +208 -0
- data/lib/em/eventable.rb +39 -0
- data/lib/em/future.rb +62 -0
- data/lib/em/messages.rb +66 -0
- data/lib/em/processes.rb +68 -0
- data/lib/em/spawnable.rb +88 -0
- data/lib/em/streamer.rb +112 -0
- data/lib/eventmachine.rb +1763 -0
- data/lib/eventmachine_version.rb +31 -0
- data/lib/evma.rb +32 -0
- data/lib/evma/callback.rb +32 -0
- data/lib/evma/container.rb +75 -0
- data/lib/evma/factory.rb +77 -0
- data/lib/evma/protocol.rb +87 -0
- data/lib/evma/reactor.rb +48 -0
- data/lib/jeventmachine.rb +137 -0
- data/lib/pr_eventmachine.rb +1011 -0
- data/lib/protocols/buftok.rb +127 -0
- data/lib/protocols/header_and_content.rb +129 -0
- data/lib/protocols/httpcli2.rb +794 -0
- data/lib/protocols/httpclient.rb +270 -0
- data/lib/protocols/line_and_text.rb +122 -0
- data/lib/protocols/linetext2.rb +163 -0
- data/lib/protocols/postgres.rb +261 -0
- data/lib/protocols/saslauth.rb +179 -0
- data/lib/protocols/smtpclient.rb +308 -0
- data/lib/protocols/smtpserver.rb +556 -0
- data/lib/protocols/stomp.rb +130 -0
- data/lib/protocols/tcptest.rb +57 -0
- data/tasks/cpp.rake +77 -0
- data/tasks/project.rake +78 -0
- data/tasks/tests.rake +192 -0
- data/tests/test_attach.rb +66 -0
- data/tests/test_basic.rb +231 -0
- data/tests/test_defer.rb +47 -0
- data/tests/test_epoll.rb +161 -0
- data/tests/test_errors.rb +82 -0
- data/tests/test_eventables.rb +78 -0
- data/tests/test_exc.rb +58 -0
- data/tests/test_futures.rb +214 -0
- data/tests/test_hc.rb +218 -0
- data/tests/test_httpclient.rb +215 -0
- data/tests/test_httpclient2.rb +133 -0
- data/tests/test_kb.rb +61 -0
- data/tests/test_ltp.rb +192 -0
- data/tests/test_ltp2.rb +320 -0
- data/tests/test_next_tick.rb +102 -0
- data/tests/test_processes.rb +56 -0
- data/tests/test_pure.rb +129 -0
- data/tests/test_running.rb +47 -0
- data/tests/test_sasl.rb +74 -0
- data/tests/test_send_file.rb +245 -0
- data/tests/test_servers.rb +80 -0
- data/tests/test_smtpclient.rb +81 -0
- data/tests/test_smtpserver.rb +93 -0
- data/tests/test_spawn.rb +329 -0
- data/tests/test_ssl_args.rb +68 -0
- data/tests/test_timers.rb +146 -0
- data/tests/test_ud.rb +43 -0
- data/tests/testem.rb +31 -0
- metadata +197 -0
@@ -0,0 +1,130 @@
|
|
1
|
+
# $Id$
|
2
|
+
#
|
3
|
+
# Author:: Francis Cianfrocca (gmail: blackhedd)
|
4
|
+
# Homepage:: http://rubyeventmachine.com
|
5
|
+
# Date:: 15 November 2006
|
6
|
+
#
|
7
|
+
# See EventMachine and EventMachine::Connection for documentation and
|
8
|
+
# usage examples.
|
9
|
+
#
|
10
|
+
#----------------------------------------------------------------------------
|
11
|
+
#
|
12
|
+
# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
13
|
+
# Gmail: blackhedd
|
14
|
+
#
|
15
|
+
# This program is free software; you can redistribute it and/or modify
|
16
|
+
# it under the terms of either: 1) the GNU General Public License
|
17
|
+
# as published by the Free Software Foundation; either version 2 of the
|
18
|
+
# License, or (at your option) any later version; or 2) Ruby's License.
|
19
|
+
#
|
20
|
+
# See the file COPYING for complete licensing information.
|
21
|
+
#
|
22
|
+
#---------------------------------------------------------------------------
|
23
|
+
#
|
24
|
+
#
|
25
|
+
#
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
module EventMachine
|
30
|
+
module Protocols
|
31
|
+
|
32
|
+
# Implements Stomp (http://docs.codehaus.org/display/STOMP/Protocol).
|
33
|
+
#
|
34
|
+
module Stomp
|
35
|
+
include LineText2
|
36
|
+
|
37
|
+
class Message
|
38
|
+
attr_accessor :command, :header, :body
|
39
|
+
def initialize
|
40
|
+
@header = {}
|
41
|
+
@state = :precommand
|
42
|
+
@content_length = nil
|
43
|
+
end
|
44
|
+
def consume_line line
|
45
|
+
if @state == :precommand
|
46
|
+
unless line =~ /\A\s*\Z/
|
47
|
+
@command = line
|
48
|
+
@state = :headers
|
49
|
+
end
|
50
|
+
elsif @state == :headers
|
51
|
+
if line == ""
|
52
|
+
if @content_length
|
53
|
+
yield( [:sized_text, @content_length+1] )
|
54
|
+
else
|
55
|
+
@state = :body
|
56
|
+
yield( [:unsized_text] )
|
57
|
+
end
|
58
|
+
elsif line =~ /\A([^:]+):(.+)\Z/
|
59
|
+
k = $1.dup.strip
|
60
|
+
v = $2.dup.strip
|
61
|
+
@header[k] = v
|
62
|
+
if k == "content-length"
|
63
|
+
@content_length = v.to_i
|
64
|
+
end
|
65
|
+
else
|
66
|
+
# This is a protocol error. How to signal it?
|
67
|
+
end
|
68
|
+
elsif @state == :body
|
69
|
+
@body = line
|
70
|
+
yield( [:dispatch] )
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def send_frame verb, headers={}, body=""
|
76
|
+
ary = [verb, "\n"]
|
77
|
+
headers.each {|k,v| ary << "#{k}:#{v}\n" }
|
78
|
+
ary << "content-length: #{body.to_s.length}\n"
|
79
|
+
ary << "content-type: text/plain; charset=UTF-8\n"
|
80
|
+
ary << "\n"
|
81
|
+
ary << body.to_s
|
82
|
+
ary << "\0"
|
83
|
+
send_data ary.join
|
84
|
+
end
|
85
|
+
|
86
|
+
def receive_line line
|
87
|
+
@stomp_initialized || init_message_reader
|
88
|
+
@stomp_message.consume_line(line) {|outcome|
|
89
|
+
if outcome.first == :sized_text
|
90
|
+
set_text_mode outcome[1]
|
91
|
+
elsif outcome.first == :unsized_text
|
92
|
+
set_delimiter "\0"
|
93
|
+
elsif outcome.first == :dispatch
|
94
|
+
receive_msg(@stomp_message) if respond_to?(:receive_msg)
|
95
|
+
init_message_reader
|
96
|
+
end
|
97
|
+
}
|
98
|
+
end
|
99
|
+
def receive_binary_data data
|
100
|
+
@stomp_message.body = data[0..-2]
|
101
|
+
receive_msg(@stomp_message) if respond_to?(:receive_msg)
|
102
|
+
init_message_reader
|
103
|
+
end
|
104
|
+
|
105
|
+
def init_message_reader
|
106
|
+
@stomp_initialized = true
|
107
|
+
set_delimiter "\n"
|
108
|
+
set_line_mode
|
109
|
+
@stomp_message = Message.new
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
# STOMP verbs
|
114
|
+
def connect parms={}
|
115
|
+
send_frame "CONNECT", parms
|
116
|
+
end
|
117
|
+
def send destination, body, parms={}
|
118
|
+
send_frame "SEND", parms.merge( :destination=>destination ), body.to_s
|
119
|
+
end
|
120
|
+
def subscribe dest, ack=false
|
121
|
+
send_frame "SUBSCRIBE", {:destination=>dest, :ack=>(ack ? "client" : "auto")}
|
122
|
+
end
|
123
|
+
def ack msgid
|
124
|
+
send_frame "ACK", { :'message-id'=> msgid }
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# $Id$
|
2
|
+
#
|
3
|
+
# Author:: Francis Cianfrocca (gmail: blackhedd)
|
4
|
+
# Homepage:: http://rubyeventmachine.com
|
5
|
+
# Date:: 16 July 2006
|
6
|
+
#
|
7
|
+
# See EventMachine and EventMachine::Connection for documentation and
|
8
|
+
# usage examples.
|
9
|
+
#
|
10
|
+
#----------------------------------------------------------------------------
|
11
|
+
#
|
12
|
+
# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
13
|
+
# Gmail: blackhedd
|
14
|
+
#
|
15
|
+
# This program is free software; you can redistribute it and/or modify
|
16
|
+
# it under the terms of either: 1) the GNU General Public License
|
17
|
+
# as published by the Free Software Foundation; either version 2 of the
|
18
|
+
# License, or (at your option) any later version; or 2) Ruby's License.
|
19
|
+
#
|
20
|
+
# See the file COPYING for complete licensing information.
|
21
|
+
#
|
22
|
+
#---------------------------------------------------------------------------
|
23
|
+
#
|
24
|
+
#
|
25
|
+
#
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
module EventMachine
|
30
|
+
module Protocols
|
31
|
+
|
32
|
+
class TcpConnectTester < Connection
|
33
|
+
include EventMachine::Deferrable
|
34
|
+
|
35
|
+
def self.test( host, port )
|
36
|
+
EventMachine.connect( host, port, self )
|
37
|
+
end
|
38
|
+
|
39
|
+
def post_init
|
40
|
+
@start_time = Time.now
|
41
|
+
end
|
42
|
+
|
43
|
+
def connection_completed
|
44
|
+
@completed = true
|
45
|
+
set_deferred_status :succeeded, (Time.now - @start_time)
|
46
|
+
close_connection
|
47
|
+
end
|
48
|
+
|
49
|
+
def unbind
|
50
|
+
set_deferred_status :failed, (Time.now - @start_time) unless @completed
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
data/tasks/cpp.rake
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# EventMachine C++ Rakefile Stab Case
|
2
|
+
# TODO : track header files as a build dependency...
|
3
|
+
# TODO : cross platform support
|
4
|
+
# TODO : configure style functionality
|
5
|
+
namespace :cpp do
|
6
|
+
|
7
|
+
require 'rake/clean'
|
8
|
+
|
9
|
+
# *nix only atm...
|
10
|
+
module Cpp
|
11
|
+
class <<self
|
12
|
+
def cpp; "g++"; end
|
13
|
+
def archive; "ar"; end
|
14
|
+
def compile file, output, includes=nil, flags=nil
|
15
|
+
sh %{#{cpp} #{file} #{includes} #{flags} -c -o #{output}}
|
16
|
+
end
|
17
|
+
def link file, output, libs=nil, flags=nil
|
18
|
+
sh %{#{cpp} #{file} #{libs} #{flags} -o #{output}}
|
19
|
+
end
|
20
|
+
def static output, files
|
21
|
+
sh %{#{archive} cr #{output} #{files}}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module EmConfig
|
27
|
+
Path = ENV['EVENTMACHINE_SOURCE'] || 'ext'
|
28
|
+
Sources = FileList["#{Path}/*.cpp"]
|
29
|
+
Sources.delete_if { |s| /ruby/ =~ s }
|
30
|
+
Compiled = Sources.sub(%r{^#{Path}/(.*)\.cpp}, "#{Path}/\\1.o")
|
31
|
+
|
32
|
+
Flags = "-O2 -pipe -fno-common -DOS_UNIX -DWITHOUT_SSL"
|
33
|
+
Includes = ""
|
34
|
+
Libs = ''
|
35
|
+
end
|
36
|
+
CLEAN.include(EmConfig::Compiled)
|
37
|
+
|
38
|
+
rule %r{^#{EmConfig::Path}/.*\.o$} => [proc { |targ|
|
39
|
+
targ.sub(%r{^#{EmConfig::Path}/(.*)\.o$}, "#{EmConfig::Path}/\\1.cpp")
|
40
|
+
}] do |t|
|
41
|
+
Cpp.compile t.source, t.name, EmConfig::Includes, EmConfig::Flags
|
42
|
+
end
|
43
|
+
|
44
|
+
file "#{EmConfig::Path}/libeventmachine.a" => EmConfig::Compiled do |t|
|
45
|
+
Cpp.static t.name, EmConfig::Compiled
|
46
|
+
end
|
47
|
+
CLEAN.include("#{EmConfig::Path}/libeventmachine.a")
|
48
|
+
|
49
|
+
module AppConfig
|
50
|
+
Appname = 'echo_em'
|
51
|
+
Sources = FileList['*.cpp']
|
52
|
+
Compiled = Sources.sub(%r{^(.*)\.cpp}, '\\1.o')
|
53
|
+
|
54
|
+
Flags = ["", EmConfig::Flags].join(' ')
|
55
|
+
Includes = ["-I. -I#{EmConfig::Path}", EmConfig::Includes].join(' ')
|
56
|
+
Libs = ["-L#{EmConfig::Path} -leventmachine", EmConfig::Libs].join(' ')
|
57
|
+
end
|
58
|
+
CLEAN.include(AppConfig::Compiled)
|
59
|
+
CLEAN.include(AppConfig::Appname)
|
60
|
+
|
61
|
+
rule %r{^.*\.o$} => [proc { |targ|
|
62
|
+
targ.sub(%r{^(.*)\.o$}, '\\1.cpp')
|
63
|
+
}] do |t|
|
64
|
+
Cpp.compile t.source, t.name, AppConfig::Includes, AppConfig::Flags
|
65
|
+
end
|
66
|
+
|
67
|
+
file AppConfig::Appname => ["#{EmConfig::Path}/libeventmachine.a", AppConfig::Compiled] do |t|
|
68
|
+
Cpp.link AppConfig::Compiled, t.name, AppConfig::Libs, AppConfig::Flags
|
69
|
+
end
|
70
|
+
|
71
|
+
task :build => AppConfig::Appname
|
72
|
+
|
73
|
+
task :run => AppConfig::Appname do
|
74
|
+
sh "./#{AppConfig::Appname}"
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
data/tasks/project.rake
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'rake/gempackagetask'
|
2
|
+
require 'rake/rdoctask'
|
3
|
+
require 'rake/clean'
|
4
|
+
|
5
|
+
# monkey bitchin' for windows stuffs...
|
6
|
+
module FileUtils
|
7
|
+
# If any of these methods ever clobber, try removing them.
|
8
|
+
# Hopefully they'll do something semantically similar.
|
9
|
+
abort "Err: #{__FILE__}:#{__LINE__} monkey patch windows? clobbers!" unless instance_methods.grep(/windows\?/).empty?
|
10
|
+
abort "Err: #{__FILE__}:#{__LINE__} monkey patch sudo clobbers!" unless instance_methods.grep(/sudo/).empty?
|
11
|
+
abort "Err: #{__FILE__}:#{__LINE__} monkey patch gem_cmd clobbers!" unless instance_methods.grep(/gem_cmd/).empty?
|
12
|
+
def windows?; RUBY_PLATFORM =~ /mswin|mingw/; end
|
13
|
+
def sudo(cmd)
|
14
|
+
if windows? || (require 'etc'; Etc.getpwuid.uid == 0)
|
15
|
+
sh cmd
|
16
|
+
else
|
17
|
+
sh "sudo #{cmd}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
def gem_cmd(action, name, *args)
|
21
|
+
rb = Gem.ruby rescue nil
|
22
|
+
rb ||= (require 'rbconfig'; File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']))
|
23
|
+
sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
# Setup our packaging tasks, we're just jacking the builtins.
|
29
|
+
Rake::GemPackageTask.new(Spec) do |pkg|
|
30
|
+
pkg.need_tar, pkg.need_tar_gz, pkg.need_zip = true, true, true if Package
|
31
|
+
pkg.gem_spec = Spec
|
32
|
+
end
|
33
|
+
Rake::Task[:clean].enhance [:clobber_package]
|
34
|
+
|
35
|
+
# Only generate rdoc if the spec says so, again, jack the builtins.
|
36
|
+
if Spec.has_rdoc
|
37
|
+
Rake::RDocTask.new do |rd|
|
38
|
+
rd.title = Spec.name
|
39
|
+
rd.rdoc_dir = 'rdoc'
|
40
|
+
rd.main = "docs/README" if test ?e, "docs/README"
|
41
|
+
rd.rdoc_files.include("lib/**/*.rb", *Spec.extra_rdoc_files)
|
42
|
+
end
|
43
|
+
Rake::Task[:clean].enhance [:clobber_rdoc]
|
44
|
+
|
45
|
+
desc 'Generate and open documentation'
|
46
|
+
task :docs => :rdoc do
|
47
|
+
case RUBY_PLATFORM
|
48
|
+
when /darwin/ ; sh 'open rdoc/index.html'
|
49
|
+
when /mswin|mingw/ ; sh 'start rdoc\index.html'
|
50
|
+
else
|
51
|
+
sh 'firefox rdoc/index.html'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
if Spec.default_executable
|
57
|
+
desc "Run #{Spec.default_executable}"
|
58
|
+
task :run do ruby File.join(Spec.bindir, Spec.default_executable) end
|
59
|
+
end
|
60
|
+
|
61
|
+
require 'rubygems'
|
62
|
+
|
63
|
+
desc 'Install gem (and sudo if required)'
|
64
|
+
task :install => :package do
|
65
|
+
gem_cmd(:install, "pkg/#{Spec.name}-#{Spec.version}.gem")
|
66
|
+
end
|
67
|
+
|
68
|
+
desc 'Uninstall gem (and sudo if required)'
|
69
|
+
task :uninstall do
|
70
|
+
gem_cmd(:uninstall, "#{Spec.name}", "-v=#{Spec.version}")
|
71
|
+
end
|
72
|
+
|
73
|
+
# Find an scm's store directory, if we do, make a task to commit to it only
|
74
|
+
# after running all the tests (successfully).
|
75
|
+
if scm = %w(git svn bzr hg).find { |d| File.directory? ".#{d}" }
|
76
|
+
desc "Run tests then commit to #{scm}"
|
77
|
+
task :commit => :test do sh "#{scm} commit" end
|
78
|
+
end
|
data/tasks/tests.rake
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
# This is used by several rake tasks, that parameterize the
|
2
|
+
# behavior so we can use the same tests to test both the
|
3
|
+
# extension and non-extension versions.
|
4
|
+
def run_tests t, libr = :cascade, test_files="test_*.rb"
|
5
|
+
require 'test/unit/testsuite'
|
6
|
+
require 'test/unit/ui/console/testrunner'
|
7
|
+
require 'tests/testem'
|
8
|
+
|
9
|
+
base_dir = File.expand_path(File.dirname(__FILE__) + '/../') + '/'
|
10
|
+
|
11
|
+
runner = Test::Unit::UI::Console::TestRunner
|
12
|
+
|
13
|
+
$eventmachine_library = libr
|
14
|
+
EmTestRunner.run(test_files)
|
15
|
+
|
16
|
+
suite = Test::Unit::TestSuite.new($name)
|
17
|
+
|
18
|
+
ObjectSpace.each_object(Class) do |testcase|
|
19
|
+
suite << testcase.suite if testcase < Test::Unit::TestCase
|
20
|
+
end
|
21
|
+
|
22
|
+
runner.run(suite)
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Run tests for #{Spec.name}."
|
26
|
+
task :test do |t|
|
27
|
+
# run_tests t
|
28
|
+
# Rake +/ friends leave threads, etc, less stable test runs.
|
29
|
+
ruby "-Ilib -Iext -Ijava tests/testem.rb #{'-v' if ENV['VERBOSE']}"
|
30
|
+
end
|
31
|
+
|
32
|
+
namespace :test do
|
33
|
+
desc "Run tests for #{Spec.name}."
|
34
|
+
task :partial do |t|
|
35
|
+
lib = RUBY_PLATFORM =~ /java/ ? :java : :extension
|
36
|
+
run_tests t, lib, [
|
37
|
+
"test_basic.rb",
|
38
|
+
"test_epoll.rb",
|
39
|
+
"test_errors.rb",
|
40
|
+
"test_eventables.rb",
|
41
|
+
"test_exc.rb",
|
42
|
+
"test_futures.rb",
|
43
|
+
"test_hc.rb",
|
44
|
+
"test_httpclient2.rb",
|
45
|
+
"test_httpclient.rb",
|
46
|
+
"test_kb.rb",
|
47
|
+
"test_ltp2.rb",
|
48
|
+
"test_ltp.rb",
|
49
|
+
"test_next_tick.rb",
|
50
|
+
"test_processes.rb",
|
51
|
+
"test_pure.rb",
|
52
|
+
"test_running.rb",
|
53
|
+
"test_sasl.rb",
|
54
|
+
#"test_send_file.rb",
|
55
|
+
"test_servers.rb",
|
56
|
+
"test_smtpclient.rb",
|
57
|
+
"test_smtpserver.rb",
|
58
|
+
"test_spawn.rb",
|
59
|
+
"test_timers.rb",
|
60
|
+
"test_ud.rb",
|
61
|
+
].map { |tf| "tests/#{tf}" }
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Run java tests for #$name."
|
65
|
+
task :testjava do |t|
|
66
|
+
run_tests t, :java
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "Run pure-ruby tests for #$name."
|
70
|
+
task :testpr do |t|
|
71
|
+
run_tests t, :pure_ruby
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "Run extension tests for #$name."
|
75
|
+
task :testext do |t|
|
76
|
+
run_tests t, :extension
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "PROVISIONAL: run tests for user-defined events"
|
80
|
+
task :ud do |t|
|
81
|
+
run_tests t, :extension, "test_ud.rb"
|
82
|
+
end
|
83
|
+
|
84
|
+
desc "PROVISIONAL: run tests for line/text protocol handler"
|
85
|
+
task :ltp do |t|
|
86
|
+
run_tests t, :extension, "test_ltp*.rb"
|
87
|
+
end
|
88
|
+
|
89
|
+
desc "PROVISIONAL: run tests for header/content protocol handler"
|
90
|
+
task :hc do |t|
|
91
|
+
run_tests t, :extension, "test_hc.rb"
|
92
|
+
end
|
93
|
+
|
94
|
+
desc "PROVISIONAL: run tests for exceptions"
|
95
|
+
task :exc do |t|
|
96
|
+
run_tests t, :extension, "test_exc.rb"
|
97
|
+
end
|
98
|
+
|
99
|
+
desc "Test protocol handlers"
|
100
|
+
task :protocols => [ :hc, :ltp ]
|
101
|
+
|
102
|
+
|
103
|
+
desc "Test HTTP client"
|
104
|
+
task :httpclient do |t|
|
105
|
+
run_tests t, :extension, "test_httpclient.rb"
|
106
|
+
end
|
107
|
+
|
108
|
+
desc "Test HTTP client2"
|
109
|
+
task :httpclient2 do |t|
|
110
|
+
run_tests t, :extension, "test_httpclient2.rb"
|
111
|
+
end
|
112
|
+
|
113
|
+
desc "Test futures"
|
114
|
+
task :futures do |t|
|
115
|
+
run_tests t, :extension, "test_future*.rb"
|
116
|
+
end
|
117
|
+
|
118
|
+
desc "Test Timers"
|
119
|
+
task :timers do |t|
|
120
|
+
run_tests t, :extension, "test_timer*.rb"
|
121
|
+
end
|
122
|
+
|
123
|
+
desc "Test Next Tick"
|
124
|
+
task :next_tick do |t|
|
125
|
+
run_tests t, :extension, "test_next_tick*.rb"
|
126
|
+
end
|
127
|
+
|
128
|
+
desc "Test Epoll"
|
129
|
+
task :epoll do |t|
|
130
|
+
run_tests t, :extension, "test_epoll*.rb"
|
131
|
+
end
|
132
|
+
|
133
|
+
desc "Test Servers"
|
134
|
+
task :servers do |t|
|
135
|
+
run_tests t, :extension, "test_servers*.rb"
|
136
|
+
end
|
137
|
+
|
138
|
+
desc "Test Basic"
|
139
|
+
task :basic do |t|
|
140
|
+
run_tests t, :extension, "test_basic*.rb"
|
141
|
+
end
|
142
|
+
|
143
|
+
desc "Test Send File"
|
144
|
+
task :send_file do |t|
|
145
|
+
run_tests t, :extension, "test_send_file*.rb"
|
146
|
+
end
|
147
|
+
|
148
|
+
desc "Test Running"
|
149
|
+
task :running do |t|
|
150
|
+
run_tests t, :extension, "test_running*.rb"
|
151
|
+
end
|
152
|
+
|
153
|
+
desc "Test Keyboard Events"
|
154
|
+
task :keyboard do |t|
|
155
|
+
run_tests t, :extension, "test_kb*.rb"
|
156
|
+
end
|
157
|
+
|
158
|
+
desc "Test Spawn"
|
159
|
+
task :spawn do |t|
|
160
|
+
run_tests t, :extension, "test_spawn*.rb"
|
161
|
+
end
|
162
|
+
|
163
|
+
desc "Test SMTP"
|
164
|
+
task :smtp do |t|
|
165
|
+
run_tests t, :extension, "test_smtp*.rb"
|
166
|
+
end
|
167
|
+
|
168
|
+
desc "Test Errors"
|
169
|
+
task :errors do |t|
|
170
|
+
run_tests t, :extension, "test_errors*.rb"
|
171
|
+
end
|
172
|
+
|
173
|
+
desc "Test Pure Ruby"
|
174
|
+
task :pure do |t|
|
175
|
+
run_tests t, :extension, "test_pure*.rb"
|
176
|
+
end
|
177
|
+
|
178
|
+
desc "Test Processes"
|
179
|
+
task :processes do |t|
|
180
|
+
run_tests t, :extension, "test_process*.rb"
|
181
|
+
end
|
182
|
+
|
183
|
+
desc "Test SASL"
|
184
|
+
task :sasl do |t|
|
185
|
+
run_tests t, :java, "test_sasl*.rb"
|
186
|
+
end
|
187
|
+
|
188
|
+
desc "Test Attach"
|
189
|
+
task :attach do |t|
|
190
|
+
run_tests t, :extension, "test_attach*.rb"
|
191
|
+
end
|
192
|
+
end
|