-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
73 lines (60 loc) · 1.63 KB
/
Rakefile
File metadata and controls
73 lines (60 loc) · 1.63 KB
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
require 'rubygems'
require 'rubygems/package_task'
#require 'rake/rdoctask'
require 'rake/testtask'
require 'date'
# --------- RDoc Documentation ------
# desc "Generate rdoc documentation"
# Rake::RDocTask.new("rdoc") do |rdoc|
# end
task :default => :package
NAME="ruby_sanspleur"
desc 'Run the ruby-sanspleur test suite'
Rake::TestTask.new do |t|
t.libs << 'test'
end
require 'fileutils'
desc 'Build ruby_sanspleur.so'
task :build do
Dir.chdir('ext/ruby_sanspleur') do
unless File.exist? 'Makefile'
system(Gem.ruby + " extconf.rb")
system("make clean")
end
system("make")
FileUtils.cp 'ruby_sanspleur.so', '../../lib' if File.exist? 'lib/ruby_sanspleur.so'
FileUtils.cp 'ruby_sanspleur.bundle', '../../lib' if File.exist? 'lib/ruby_sanspleur.bundle'
end
end
file "lib/#{NAME}/#{NAME}.so" =>
Dir.glob("ext/#{NAME}/*{.rb,.c}") do
Dir.chdir("ext/#{NAME}") do
# this does essentially the same thing
# as what RubyGems does
ruby "extconf.rb"
sh "make"
end
cp "ext/#{NAME}/#{NAME}.so", "lib/#{NAME}"
end
task :test => :build
desc 'clean stuff'
task :cleanr do
FileUtils.rm 'lib/ruby_sanspleur.so' if File.exist? 'lib/ruby_sanspleur.so'
FileUtils.rm 'lib/ruby_sanspleur.bundle' if File.exist? 'lib/ruby_sanspleur.bundle'
Dir.chdir('ext/ruby_sanspleur') do
if File.exist? 'Makefile'
system("make clean")
FileUtils.rm 'Makefile'
end
Dir.glob('*~') do |file|
FileUtils.rm file
end
end
system("rm -rf pkg")
end
task :clean => :cleanr
# rubygem package_task tasks
spec = eval(File.read('ruby-sanspleur.gemspec'))
Gem::PackageTask.new(spec) do |p|
p.gem_spec = spec
end