eventmachine 0.12.8-x86-mswin32-60 → 0.12.10-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -13
- data/Rakefile +374 -264
- data/eventmachine.gemspec +4 -5
- data/ext/binder.cpp +125 -126
- data/ext/binder.h +46 -48
- data/ext/cmain.cpp +184 -42
- data/ext/cplusplus.cpp +202 -202
- data/ext/ed.cpp +242 -81
- data/ext/ed.h +39 -22
- data/ext/em.cpp +127 -108
- data/ext/em.h +27 -18
- data/ext/emwin.cpp +3 -3
- data/ext/eventmachine.h +49 -38
- data/ext/eventmachine_cpp.h +96 -96
- data/ext/extconf.rb +147 -132
- data/ext/fastfilereader/extconf.rb +82 -76
- data/ext/project.h +151 -140
- data/ext/rubymain.cpp +222 -103
- data/ext/ssl.cpp +460 -460
- data/ext/ssl.h +94 -94
- data/java/src/com/rubyeventmachine/EmReactor.java +570 -423
- data/java/src/com/rubyeventmachine/EventableChannel.java +69 -57
- data/java/src/com/rubyeventmachine/EventableDatagramChannel.java +189 -171
- data/java/src/com/rubyeventmachine/EventableSocketChannel.java +364 -244
- data/java/src/com/rubyeventmachine/{Application.java → application/Application.java} +194 -200
- data/java/src/com/rubyeventmachine/{Connection.java → application/Connection.java} +74 -74
- data/java/src/com/rubyeventmachine/{ConnectionFactory.java → application/ConnectionFactory.java} +36 -36
- data/java/src/com/rubyeventmachine/{DefaultConnectionFactory.java → application/DefaultConnectionFactory.java} +46 -46
- data/java/src/com/rubyeventmachine/{PeriodicTimer.java → application/PeriodicTimer.java} +38 -38
- data/java/src/com/rubyeventmachine/{Timer.java → application/Timer.java} +54 -54
- data/java/src/com/rubyeventmachine/tests/ApplicationTest.java +109 -108
- data/java/src/com/rubyeventmachine/tests/ConnectTest.java +148 -146
- data/java/src/com/rubyeventmachine/tests/TestDatagrams.java +53 -53
- data/java/src/com/rubyeventmachine/tests/TestServers.java +75 -74
- data/java/src/com/rubyeventmachine/tests/TestTimers.java +90 -89
- data/lib/em/connection.rb +71 -12
- data/lib/em/deferrable.rb +191 -186
- data/lib/em/protocols.rb +36 -35
- data/lib/em/protocols/httpclient2.rb +590 -582
- data/lib/em/protocols/line_and_text.rb +125 -126
- data/lib/em/protocols/linetext2.rb +161 -160
- data/lib/em/protocols/object_protocol.rb +45 -39
- data/lib/em/protocols/smtpclient.rb +357 -331
- data/lib/em/protocols/socks4.rb +66 -0
- data/lib/em/queue.rb +60 -60
- data/lib/em/timers.rb +56 -55
- data/lib/em/version.rb +1 -1
- data/lib/eventmachine.rb +125 -169
- data/lib/jeventmachine.rb +257 -142
- data/tasks/{cpp.rake → cpp.rake_example} +76 -76
- data/tests/test_attach.rb +125 -100
- data/tests/test_basic.rb +1 -2
- data/tests/test_connection_count.rb +34 -44
- data/tests/test_epoll.rb +0 -2
- data/tests/test_get_sock_opt.rb +30 -0
- data/tests/test_httpclient2.rb +3 -3
- data/tests/test_inactivity_timeout.rb +21 -1
- data/tests/test_ltp.rb +182 -188
- data/tests/test_next_tick.rb +0 -2
- data/tests/test_pause.rb +70 -0
- data/tests/test_pending_connect_timeout.rb +48 -0
- data/tests/test_ssl_args.rb +78 -67
- data/tests/test_timers.rb +162 -141
- metadata +13 -11
- data/tasks/project.rake +0 -79
- data/tasks/tests.rake +0 -193
data/.gitignore
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
pkg
|
2
|
-
rdoc
|
3
|
-
Makefile
|
4
|
-
|
5
|
-
*.bundle
|
6
|
-
*.dll
|
7
|
-
*.so
|
8
|
-
*.jar
|
9
|
-
*.class
|
10
|
-
*.o
|
11
|
-
*.log
|
12
|
-
*.def
|
13
|
-
*.pdb
|
1
|
+
pkg
|
2
|
+
rdoc
|
3
|
+
Makefile
|
4
|
+
|
5
|
+
*.bundle
|
6
|
+
*.dll
|
7
|
+
*.so
|
8
|
+
*.jar
|
9
|
+
*.class
|
10
|
+
*.o
|
11
|
+
*.log
|
12
|
+
*.def
|
13
|
+
*.pdb
|
14
|
+
java/src/.project
|
data/Rakefile
CHANGED
@@ -1,264 +1,374 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
#--
|
3
|
-
# Ruby/EventMachine
|
4
|
-
# http://rubyeventmachine.com
|
5
|
-
# Copyright (C) 2006-07 by Francis Cianfrocca
|
6
|
-
#
|
7
|
-
# This program is copyrighted free software. You may use it under
|
8
|
-
# the terms of either the GPL or Ruby's License. See the file
|
9
|
-
# COPYING in the EventMachine distribution for full licensing
|
10
|
-
# information.
|
11
|
-
#
|
12
|
-
# $Id$
|
13
|
-
#++
|
14
|
-
|
15
|
-
### OLD RAKE: ###
|
16
|
-
# # The tasks and external gemspecs we used to generate binary gems are now
|
17
|
-
# # obsolete. Use Patrick Hurley's gembuilder to build binary gems for any
|
18
|
-
# # desired platform.
|
19
|
-
# # To build a binary gem on Win32, ensure that the include and lib paths
|
20
|
-
# # both contain the proper references to OPENSSL. Use the static version
|
21
|
-
# # of the libraries, not the dynamic, otherwise we expose the user to a
|
22
|
-
# # runtime dependency.
|
23
|
-
#
|
24
|
-
# # To build a binary gem for win32, first build rubyeventmachine.so
|
25
|
-
# # using VC6 outside of the build tree (the normal way: ruby extconf.rb,
|
26
|
-
# # and then nmake). Then copy rubyeventmachine.so into the lib directory,
|
27
|
-
# # and run rake gemwin32.
|
28
|
-
#
|
29
|
-
|
30
|
-
require 'rubygems' unless defined?(Gem)
|
31
|
-
require 'rake' unless defined?(Rake)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
$eventmachine_library = :
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
s.
|
86
|
-
s.
|
87
|
-
s.
|
88
|
-
|
89
|
-
s.
|
90
|
-
|
91
|
-
s.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
#
|
99
|
-
#
|
100
|
-
# s.
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
s.
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
s.
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
Spec.platform = '
|
133
|
-
Spec.files += %w[ lib/
|
134
|
-
Spec.extensions = nil
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
sh '
|
176
|
-
end
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
chdir
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
task :
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
task :
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
#--
|
3
|
+
# Ruby/EventMachine
|
4
|
+
# http://rubyeventmachine.com
|
5
|
+
# Copyright (C) 2006-07 by Francis Cianfrocca
|
6
|
+
#
|
7
|
+
# This program is copyrighted free software. You may use it under
|
8
|
+
# the terms of either the GPL or Ruby's License. See the file
|
9
|
+
# COPYING in the EventMachine distribution for full licensing
|
10
|
+
# information.
|
11
|
+
#
|
12
|
+
# $Id$
|
13
|
+
#++
|
14
|
+
|
15
|
+
### OLD RAKE: ###
|
16
|
+
# # The tasks and external gemspecs we used to generate binary gems are now
|
17
|
+
# # obsolete. Use Patrick Hurley's gembuilder to build binary gems for any
|
18
|
+
# # desired platform.
|
19
|
+
# # To build a binary gem on Win32, ensure that the include and lib paths
|
20
|
+
# # both contain the proper references to OPENSSL. Use the static version
|
21
|
+
# # of the libraries, not the dynamic, otherwise we expose the user to a
|
22
|
+
# # runtime dependency.
|
23
|
+
#
|
24
|
+
# # To build a binary gem for win32, first build rubyeventmachine.so
|
25
|
+
# # using VC6 outside of the build tree (the normal way: ruby extconf.rb,
|
26
|
+
# # and then nmake). Then copy rubyeventmachine.so into the lib directory,
|
27
|
+
# # and run rake gemwin32.
|
28
|
+
#
|
29
|
+
|
30
|
+
require 'rubygems' unless defined?(Gem)
|
31
|
+
require 'rake' unless defined?(Rake)
|
32
|
+
|
33
|
+
Package = false # Build zips and tarballs?
|
34
|
+
Dir.glob('tasks/*.rake').each { |r| Rake.application.add_import r }
|
35
|
+
|
36
|
+
# e.g. rake EVENTMACHINE_LIBRARY=java for forcing java build tasks as defaults!
|
37
|
+
$eventmachine_library = :java if RUBY_PLATFORM =~ /java/ || ENV['EVENTMACHINE_LIBRARY'] == 'java'
|
38
|
+
$eventmachine_library = :pure_ruby if ENV['EVENTMACHINE_LIBRARY'] == 'pure_ruby'
|
39
|
+
|
40
|
+
MAKE = ENV['MAKE'] || if RUBY_PLATFORM =~ /mswin/ # mingw uses make.
|
41
|
+
'nmake'
|
42
|
+
else
|
43
|
+
'make'
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Build gemspec, then build eventmachine, then run tests."
|
47
|
+
task :default => [:build, :test]
|
48
|
+
|
49
|
+
desc "Build extension (or EVENTMACHINE_LIBRARY) and place in lib"
|
50
|
+
build_task = 'ext:build'
|
51
|
+
build_task = 'java:build' if $eventmachine_library == :java
|
52
|
+
build_task = :dummy_build if $eventmachine_library == :pure_ruby
|
53
|
+
task :build => build_task do |t|
|
54
|
+
Dir.glob('{ext,java/src,ext/fastfilereader}/*.{so,bundle,dll,jar}').each do |f|
|
55
|
+
mv f, "lib"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
task :dummy_build
|
60
|
+
|
61
|
+
require 'rake/testtask'
|
62
|
+
Rake::TestTask.new(:test) do |t|
|
63
|
+
t.pattern = 'tests/**/test_*.rb'
|
64
|
+
t.warning = true
|
65
|
+
end
|
66
|
+
|
67
|
+
# Basic clean definition, this is enhanced by imports aswell.
|
68
|
+
task :clean do
|
69
|
+
chdir 'ext' do
|
70
|
+
sh "#{MAKE} clean" if test ?e, 'Makefile'
|
71
|
+
end
|
72
|
+
chdir 'ext/fastfilereader' do
|
73
|
+
sh "#{MAKE} clean" if test ?e, 'Makefile'
|
74
|
+
end
|
75
|
+
Dir.glob('**/Makefile').each { |file| rm file }
|
76
|
+
Dir.glob('**/*.{o,so,bundle,class,jar,dll,log}').each { |file| rm file }
|
77
|
+
Dir.glob('ext/**/conftest.dSYM').each{ |file| rm_rf file }
|
78
|
+
end
|
79
|
+
|
80
|
+
Spec = Gem::Specification.new do |s|
|
81
|
+
s.name = "eventmachine"
|
82
|
+
s.summary = "Ruby/EventMachine library"
|
83
|
+
s.platform = Gem::Platform::RUBY
|
84
|
+
|
85
|
+
s.has_rdoc = true
|
86
|
+
s.rdoc_options = %w(--title EventMachine --main README --line-numbers -x lib/em/version -x lib/emva -x lib/evma/ -x lib/pr_eventmachine -x lib/jeventmachine)
|
87
|
+
s.extra_rdoc_files = Dir['README,docs/*']
|
88
|
+
|
89
|
+
s.files = `git ls-files`.split("\n")
|
90
|
+
|
91
|
+
s.require_path = 'lib'
|
92
|
+
|
93
|
+
# TODO / XXX - should we enable this? rubygems fails the install if anything
|
94
|
+
# is broken. What we could do is CI submission, though, and always terminate
|
95
|
+
# with a positive code...
|
96
|
+
# s.test_file = "tests/testem.rb"
|
97
|
+
|
98
|
+
# XXX Using rake to compile extensions breaks when you have multiple ruby installations
|
99
|
+
# and your path isn't set. We can switch back to this once the Gem.exec patch is merged.
|
100
|
+
# s.extensions = "Rakefile"
|
101
|
+
s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
|
102
|
+
|
103
|
+
s.author = "Francis Cianfrocca"
|
104
|
+
s.email = "garbagecat10@gmail.com"
|
105
|
+
s.rubyforge_project = 'eventmachine'
|
106
|
+
s.homepage = "http://rubyeventmachine.com"
|
107
|
+
|
108
|
+
# Pulled in from readme, as code to pull from readme was not working!
|
109
|
+
# Might be worth removing as no one seems to use gem info anyway.
|
110
|
+
s.description = <<-EOD
|
111
|
+
EventMachine implements a fast, single-threaded engine for arbitrary network
|
112
|
+
communications. It's extremely easy to use in Ruby. EventMachine wraps all
|
113
|
+
interactions with IP sockets, allowing programs to concentrate on the
|
114
|
+
implementation of network protocols. It can be used to create both network
|
115
|
+
servers and clients. To create a server or client, a Ruby program only needs
|
116
|
+
to specify the IP address and port, and provide a Module that implements the
|
117
|
+
communications protocol. Implementations of several standard network protocols
|
118
|
+
are provided with the package, primarily to serve as examples. The real goal
|
119
|
+
of EventMachine is to enable programs to easily interface with other programs
|
120
|
+
using TCP/IP, especially if custom protocols are required.
|
121
|
+
EOD
|
122
|
+
|
123
|
+
require 'lib/em/version'
|
124
|
+
s.version = EventMachine::VERSION
|
125
|
+
end
|
126
|
+
|
127
|
+
if RUBY_PLATFORM =~ /mswin/
|
128
|
+
Spec.platform = 'x86-mswin32-60'
|
129
|
+
Spec.files += %w[ lib/rubyeventmachine.so lib/fastfilereaderext.so ]
|
130
|
+
Spec.extensions = nil
|
131
|
+
elsif RUBY_PLATFORM =~ /java/
|
132
|
+
Spec.platform = 'java'
|
133
|
+
Spec.files += %w[ lib/em_reactor.jar ]
|
134
|
+
Spec.extensions = nil
|
135
|
+
end
|
136
|
+
|
137
|
+
# this is a hack right now, it requires installing msysgit in the global path so it can use tar/curl/etc.
|
138
|
+
namespace :win32 do
|
139
|
+
task :check_git do
|
140
|
+
unless `git` =~ /rebase/
|
141
|
+
raise 'git not found, install msys git into the GLOBAL PATH: http://msysgit.googlecode.com/files/Git-1.6.2-preview20090308.exe'
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
task :check_vc6 do
|
146
|
+
begin
|
147
|
+
raise unless `nmake 2>&1` =~ /Microsoft/
|
148
|
+
rescue
|
149
|
+
raise 'VC6 not found, please run c:\vc\setvc.bat vc6'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
task :check_perl do
|
154
|
+
unless `perl --version` =~ /ActiveState/
|
155
|
+
raise 'ActiveState perl required to build OpenSSL: http://downloads.activestate.com/ActivePerl/Windows/5.10/ActivePerl-5.10.0.1004-MSWin32-x86-287188.msi'
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
task :build_openssl => [:check_git, :check_perl, :check_vc6] do
|
160
|
+
mkdir_p 'build'
|
161
|
+
chdir 'build' do
|
162
|
+
unless File.exists?('openssl-0.9.8j')
|
163
|
+
sh 'curl http://www.openssl.org/source/openssl-0.9.8j.tar.gz > openssl.tar.gz'
|
164
|
+
sh 'tar zxvf openssl.tar.gz' rescue nil # fails because of symlinks
|
165
|
+
end
|
166
|
+
|
167
|
+
mkdir_p 'local'
|
168
|
+
chdir 'openssl-0.9.8j' do
|
169
|
+
sh "perl Configure VC-WIN32 --prefix=\"../local/\""
|
170
|
+
sh 'ms\do_ms.bat'
|
171
|
+
sh 'nmake -f ms\nt.mak install'
|
172
|
+
end
|
173
|
+
|
174
|
+
chdir '../ext' do
|
175
|
+
sh 'git clean -fd .'
|
176
|
+
end
|
177
|
+
|
178
|
+
mv 'local/include/openssl', '../ext/'
|
179
|
+
mv 'local/lib/ssleay32.lib', '../ext/'
|
180
|
+
mv 'local/lib/libeay32.lib', '../ext/'
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
desc "build binary win32 gem"
|
185
|
+
task :gem => :build_openssl do
|
186
|
+
Rake::Task['build'].invoke
|
187
|
+
Rake::Task['gem'].invoke
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
namespace :ext do
|
192
|
+
ext_sources = FileList['ext/*.{h,cpp,rb,c}']
|
193
|
+
ffr_sources = FileList['ext/fastfilereader/*.{h,cpp,rb}']
|
194
|
+
file ext_extconf = 'ext/extconf.rb'
|
195
|
+
file ffr_extconf = 'ext/fastfilereader/extconf.rb'
|
196
|
+
ext_libname = "lib/rubyeventmachine.#{Config::CONFIG['DLEXT']}"
|
197
|
+
ffr_libname = "lib/fastfilereaderext.#{Config::CONFIG['DLEXT']}"
|
198
|
+
|
199
|
+
file ext_libname => ext_sources + ['ext/Makefile'] do
|
200
|
+
chdir('ext') { sh MAKE }
|
201
|
+
end
|
202
|
+
|
203
|
+
file ffr_libname => ffr_sources + ['ext/fastfilereader/Makefile'] do
|
204
|
+
chdir('ext/fastfilereader') { sh MAKE }
|
205
|
+
end
|
206
|
+
|
207
|
+
desc "Build C++ extension"
|
208
|
+
task :build => [:make]
|
209
|
+
|
210
|
+
task :make => ext_libname
|
211
|
+
task :make => ffr_libname
|
212
|
+
|
213
|
+
file 'ext/Makefile' => ext_extconf do
|
214
|
+
chdir 'ext' do
|
215
|
+
ruby 'extconf.rb'
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
file 'ext/fastfilereader/Makefile' => ffr_extconf do
|
220
|
+
chdir 'ext/fastfilereader' do
|
221
|
+
ruby 'extconf.rb'
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
namespace :java do
|
227
|
+
# This task creates the JRuby JAR file and leaves it in the lib directory.
|
228
|
+
# This step is required before executing the jgem task.
|
229
|
+
desc "Build java extension"
|
230
|
+
task :build => [:jar] do |t|
|
231
|
+
mv 'java/em_reactor.jar', 'lib/'
|
232
|
+
end
|
233
|
+
|
234
|
+
task :compile do
|
235
|
+
chdir('java') do
|
236
|
+
mkdir_p "build"
|
237
|
+
sh 'javac src/com/rubyeventmachine/*.java -d build'
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
task :jar => [:compile] do
|
242
|
+
chdir('java/build') do
|
243
|
+
sh "jar -cf ../em_reactor.jar com/rubyeventmachine/*.class"
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
desc "build a java binary gem"
|
248
|
+
task :gem => :build do
|
249
|
+
Spec.platform = 'java'
|
250
|
+
Spec.files += %w[ lib/em_reactor.jar ]
|
251
|
+
Spec.extensions = nil
|
252
|
+
|
253
|
+
Rake::Task['gem'].invoke
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
namespace :osx do
|
258
|
+
desc "Build OSX binary gem"
|
259
|
+
task :gem do
|
260
|
+
Spec.platform = RUBY_PLATFORM.sub(/darwin.+$/, 'darwin')
|
261
|
+
Spec.files += %w[ lib/rubyeventmachine.bundle lib/fastfilereaderext.bundle ]
|
262
|
+
Spec.extensions = nil
|
263
|
+
|
264
|
+
Rake::Task['build'].invoke
|
265
|
+
Rake::Task['gem'].invoke
|
266
|
+
end
|
267
|
+
|
268
|
+
# XXX gcc will still prefer the shared libssl on the system, so we need to hack the extconf
|
269
|
+
# XXX to use the static library to make this actually work
|
270
|
+
task :static_gem => [:build_openssl, :gem]
|
271
|
+
|
272
|
+
task :build_openssl do
|
273
|
+
mkdir_p 'build'
|
274
|
+
chdir 'build' do
|
275
|
+
unless File.exists?('openssl-0.9.8j')
|
276
|
+
sh 'curl http://www.openssl.org/source/openssl-0.9.8j.tar.gz > openssl-0.9.8j.tar.gz'
|
277
|
+
sh 'tar zxvf openssl-0.9.8j.tar.gz'
|
278
|
+
end
|
279
|
+
|
280
|
+
mkdir_p 'local'
|
281
|
+
chdir 'openssl-0.9.8j' do
|
282
|
+
local_dir = File.expand_path(File.join(File.dirname(__FILE__),'build','local'))
|
283
|
+
sh "./config --prefix=#{local_dir}"
|
284
|
+
sh 'make'
|
285
|
+
sh 'make install'
|
286
|
+
end
|
287
|
+
|
288
|
+
chdir '../ext' do
|
289
|
+
sh 'git clean -fd .'
|
290
|
+
end
|
291
|
+
|
292
|
+
mv 'local/include/openssl', '../ext/'
|
293
|
+
mv 'local/lib/libssl.a', '../ext/'
|
294
|
+
mv 'local/lib/libcrypto.a', '../ext/'
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
require 'rake/clean'
|
300
|
+
|
301
|
+
rdoc_task_type = begin
|
302
|
+
require 'rdoc/task'
|
303
|
+
RDoc::Task
|
304
|
+
rescue LoadError
|
305
|
+
require 'rake/rdoctask'
|
306
|
+
Rake::RDocTask
|
307
|
+
end
|
308
|
+
df = begin; require 'rdoc/generator/darkfish'; true; rescue LoadError; end
|
309
|
+
rdtask = rdoc_task_type.new do |rd|
|
310
|
+
rd.title = Spec.name
|
311
|
+
rd.rdoc_dir = 'rdoc'
|
312
|
+
rd.main = "README"
|
313
|
+
rd.rdoc_files.include("lib/**/*.rb", *Spec.extra_rdoc_files)
|
314
|
+
rd.rdoc_files.exclude(*%w(lib/em/version lib/emva lib/evma/ lib/pr_eventmachine lib/jeventmachine))
|
315
|
+
rd.template = 'darkfish' if df
|
316
|
+
end
|
317
|
+
Rake::Task[:clean].enhance [:clobber_rdoc]
|
318
|
+
|
319
|
+
desc 'Generate and open documentation'
|
320
|
+
task :docs => :rdoc do
|
321
|
+
case RUBY_PLATFORM
|
322
|
+
when /darwin/ ; sh 'open rdoc/index.html'
|
323
|
+
when /mswin|mingw/ ; sh 'start rdoc\index.html'
|
324
|
+
else
|
325
|
+
sh 'firefox rdoc/index.html'
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
def windows?; RUBY_PLATFORM =~ /mswin|mingw/; end
|
330
|
+
def sudo(cmd)
|
331
|
+
if windows? || (require 'etc'; Etc.getpwuid.uid == 0)
|
332
|
+
sh cmd
|
333
|
+
else
|
334
|
+
sh "sudo #{cmd}"
|
335
|
+
end
|
336
|
+
end
|
337
|
+
def gem_cmd(action, name, *args)
|
338
|
+
rb = Gem.ruby rescue nil
|
339
|
+
rb ||= (require 'rbconfig'; File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']))
|
340
|
+
sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'"
|
341
|
+
end
|
342
|
+
|
343
|
+
begin
|
344
|
+
require 'rubygems/package_task'
|
345
|
+
Gem::PackageTask
|
346
|
+
rescue LoadError
|
347
|
+
require 'rake/gempackagetask'
|
348
|
+
Rake::GemPackageTask
|
349
|
+
end.new(Spec) do |pkg|
|
350
|
+
pkg.need_tar, pkg.need_tar_gz, pkg.need_zip = true, true, true if Package
|
351
|
+
pkg.gem_spec = Spec
|
352
|
+
end
|
353
|
+
|
354
|
+
Rake::Task[:clean].enhance [:clobber_package]
|
355
|
+
|
356
|
+
namespace :gem do
|
357
|
+
desc 'Install gem (and sudo if required)'
|
358
|
+
task :install => :package do
|
359
|
+
gem_cmd(:install, "pkg/#{Spec.name}-#{Spec.version}.gem")
|
360
|
+
end
|
361
|
+
|
362
|
+
desc 'Uninstall gem (and sudo if required)'
|
363
|
+
task :uninstall do
|
364
|
+
gem_cmd(:uninstall, "#{Spec.name}", "-v=#{Spec.version}")
|
365
|
+
end
|
366
|
+
|
367
|
+
desc "Generate new gemspec"
|
368
|
+
task :spec => :clobber do
|
369
|
+
open("eventmachine.gemspec", 'w') { |f| f.write Spec.to_ruby }
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
task :clobber => :clean
|
374
|
+
task :test => :build
|