-
Notifications
You must be signed in to change notification settings - Fork 44
/
Rakefile
92 lines (73 loc) · 2.47 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# $Id: Rakefile 3546 2006-12-31 21:01:27Z francis $
require 'rubygems/package_task'
require 'rake/clean'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs += %w(ext)
t.test_files = FileList['test/test_*.rb']
t.verbose = true
end
namespace :build do
sources = FileList['ext/*.{cpp,c,h}']
file 'ext/Makefile' => 'ext/extconf.rb' do
Dir.chdir 'ext' do
ruby 'extconf.rb'
end
end
CLEAN.include('ext/Makefile')
CLEAN.include('ext/*.log')
libfile = "ext/eventmachine_httpserver.#{RbConfig::CONFIG['DLEXT']}"
file libfile => ['ext/Makefile', *sources] do
Dir.chdir 'ext' do
make = case RUBY_PLATFORM
when /mswin32/
'nmake'
else
# typical gcc stack, might need a case for gmake on some
'make'
end
sh make
end
end
CLEAN.include(libfile)
task :makefile => 'ext/Makefile'
task :extension => libfile
end
desc "Build the extension inside the ext dir"
task :build => :"build:extension"
desc "Build as necessary, then run tests"
task :test => :build
namespace :gem do
# TODO : use rake-compiler (github.com/luislavena/rake-compiler) for this!
# specbinary = eval(File.read("eventmachine_httpserver-binary.gemspec"))
# specbinary.version = $version
# desc "Build a binary RubyGem for EventMachine HTTP Server"
# task :gembinary => ["pkg/eventmachine_httpserver-binary-#{$version}.gem"]
# Rake::GemPackageTask.new(specbinary)
def gemspec
# The template executes some ruby code to make a manifest, so we just eval
# it. Later you could fill it with an ERB processor or whatever. It must
# return a valid gemspec object.
@gemspec ||= eval(File.read("eventmachine_httpserver.gemspec.tmpl"))
end
def version
gemspec.version
end
file "eventmachine_httpserver.gemspec" => 'eventmachine_httpserver.gemspec.tmpl' do |t|
open(t.name, 'w') { |f| f.write gemspec.to_ruby }
end
desc "Generate the gemspec from template"
task :spec => "eventmachine_httpserver.gemspec"
file "eventmachine_httpserver-#{version}.gem" => :"gem:spec" do
sh "gem build eventmachine_httpserver.gemspec"
end
desc "Build the RubyGem for EventMachine HTTP Server"
task :build => "eventmachine_httpserver-#{version}.gem"
desc "run gem install on the built gem"
task :install => :build do
sh 'gem inst eventmachine_httpserver*.gem'
end
CLOBBER.include("eventmachine_httpserver.gemspec")
CLEAN.include("eventmachine_httpserver-#{version}.gem")
end
task :default => :test