-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
68 lines (55 loc) · 1.4 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
# encoding: utf-8
require 'rake/extensiontask'
require 'rake/testtask'
begin
require 'rdoc/task'
rescue LoadError # fallback to older 1.8.7 rubies
require 'rake/rdoctask'
end
spec = eval(IO.read('eio.gemspec'))
task :compile => :build_libeio
task :clobber => :clobber_libeio
Rake::ExtensionTask.new('eio', spec) do |ext|
ext.name = 'eio_ext'
ext.ext_dir = 'ext/eio'
end
task :clobber_libeio do
Dir.chdir "ext/libeio" do
sh "make clean"
end
end
task :build_libeio do
Dir.chdir "ext/libeio" do
sh "./autogen.sh"
sh "./configure"
sh "make"
end unless File.exist?("ext/libeio/.libs/eio.o")
end
RDOC_FILES = FileList["README.rdoc", "ext/eio/eio_ext.c", "lib/eio.rb", "lib/eio/eventmachine.rb", "lib/eio/middleware.rb"]
Rake::RDocTask.new do |rd|
rd.title = "eio - a libeio wrapper for Ruby"
rd.main = "README.rdoc"
rd.rdoc_dir = "doc"
rd.rdoc_files.include(RDOC_FILES)
end
desc 'Run EIO tests'
Rake::TestTask.new(:test) do |t|
t.pattern = "test/test_*.rb"
t.verbose = true
t.warning = true
end
task :test => :compile
task :default => :test
namespace :bench do
desc 'Benchmark - eventmachine'
task :eventmachine do
ruby 'bench/eventmachine.rb'
end
desc 'Benchmark - middleware'
task :middleware do
ruby 'bench/middleware.rb'
end
end
task 'bench:middleware' => :compile
task 'bench:eventmachine' => :compile
task :bench => %w(bench:middleware bench:eventmachine)