Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 75 lines (61 sloc) 1.575 kB
64d5d51 @methodmissing Initial skeleton
authored
1 #!/usr/bin/env rake
2 require 'rake/testtask'
3 require 'rake/clean'
4 $:.unshift(File.expand_path('lib'))
5 VIO_ROOT = 'ext/vio'
6
7 desc 'Default: test'
8 task :default => :test
9
10 desc 'Run VIO tests.'
11 Rake::TestTask.new(:test) do |t|
12 t.libs = [VIO_ROOT]
13 t.pattern = 'test/test_*.rb'
14 t.verbose = true
15 end
16 task :test => :build
17
18 namespace :build do
19 file "#{VIO_ROOT}/vio.c"
20 file "#{VIO_ROOT}/extconf.rb"
21 file "#{VIO_ROOT}/Makefile" => %W(#{VIO_ROOT}/vio.c #{VIO_ROOT}/extconf.rb) do
22 Dir.chdir(VIO_ROOT) do
23 ruby 'extconf.rb'
24 end
25 end
26
27 desc "generate makefile"
28 task :makefile => %W(#{VIO_ROOT}/Makefile #{VIO_ROOT}/vio.c)
29
30 dlext = Config::CONFIG['DLEXT']
31 file "#{VIO_ROOT}/vio.#{dlext}" => %W(#{VIO_ROOT}/Makefile #{VIO_ROOT}/vio.c) do
32 Dir.chdir(VIO_ROOT) do
33 sh 'make' # TODO - is there a config for which make somewhere?
34 end
35 end
36
37 desc "compile vio extension"
38 task :compile => "#{VIO_ROOT}/vio.#{dlext}"
39
40 task :clean do
41 Dir.chdir(VIO_ROOT) do
42 sh 'make clean'
43 end if File.exists?("#{VIO_ROOT}/Makefile")
44 end
45
46 CLEAN.include("#{VIO_ROOT}/Makefile")
47 CLEAN.include("#{VIO_ROOT}/vio.#{dlext}")
48 end
49
50 task :clean => %w(build:clean)
51
52 desc "compile"
53 task :build => %w(build:compile)
54
55 task :install do |t|
56 Dir.chdir(VIO_ROOT) do
57 sh 'sudo make install'
58 end
59 end
60
61 desc "clean build install"
62 task :setup => %w(clean build install)
63
909ba1a @methodmissing Rework writev benches
authored
64 namespace :bench do |t|
65 desc "bench reads"
66 task :read do
67 ruby "bench/read.rb"
68 end
69
70 desc "bench writes"
71 task :write do
72 ruby "bench/write.rb"
73 end
74 end
64d5d51 @methodmissing Initial skeleton
authored
75 task :bench => :build
Something went wrong with that request. Please try again.