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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
require 'rake'
require 'rake/testtask'
require 'rake/packagetask'
#require 'rake/gempackagetask'
#require 'rake/rdoctask'
#require 'rubygems'
#$:.unshift(File.dirname(__FILE__) + "/lib")
require 'mkrf'
PKG_NAME = 'mkrf'
PKG_VERSION = Mkrf::VERSION
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
RELEASE_NAME = "REL #{PKG_VERSION}"
RUBY_FORGE_PROJECT = "mkrf"
RUBY_FORGE_USER = "kevinclark"
RUBY_TEST_BIN = ENV['RUBY_TEST_BIN']
task :default => ["test:units"]
namespace :test do
desc "Run basic tests"
Rake::TestTask.new("units") { |t|
t.pattern = 'test/unit/test_*.rb'
t.verbose = true
t.warning = true
}
desc "Run integration tests"
Rake::TestTask.new("integration") { |t|
t.pattern = 'test/integration/test_*.rb'
t.verbose = true
t.warning = true
}
namespace :samples do
BASE_DIR = File.dirname(__FILE__) + '/test/sample_files'
SAMPLE_DIRS = {
:trivial => BASE_DIR + '/libtrivial/ext/',
:syck => BASE_DIR + '/syck-0.55/ext/ruby/ext/syck/',
:libxml => BASE_DIR + '/libxml-ruby-0.3.8/ext/xml/',
:cpp_bang => BASE_DIR + '/cpp_bang/ext/'
}
task :default => [:all]
desc "Try to compile all of the sample extensions"
task :all => [:trivial, :libxml, :syck, :cpp_bang]
desc "Try to compile a trivial extension"
task :trivial do
sh "cd #{SAMPLE_DIRS[:trivial]}; #{RUBY_TEST_BIN} extconf.rb; rake"
end
desc "Try to compile libxml"
task :libxml do
sh "cd #{SAMPLE_DIRS[:libxml]}; #{RUBY_TEST_BIN} extconf.rb; rake"
end
desc "Try to compile syck"
task :syck do
sh "cd #{SAMPLE_DIRS[:syck]}; #{RUBY_TEST_BIN} extconf.rb; rake"
end
desc "Try to compile cpp_bang"
task :cpp_bang do
sh "cd #{SAMPLE_DIRS[:cpp_bang]}; #{RUBY_TEST_BIN} mkrf_config.rb; rake"
end
desc "Clean up after sample tests"
task :clobber do
if ENV['PROJECT']
if File.exist?(SAMPLE_DIRS[ENV['PROJECT'].to_sym] + "/Rakefile")
sh "cd #{SAMPLE_DIRS[ENV['PROJECT'].to_sym]}; rake clobber; rm Rakefile"
end
else
SAMPLE_DIRS.each_value do |test_dir|
next unless File.exist?(test_dir + "/Rakefile")
sh "cd #{test_dir}; rake clobber; rm Rakefile"
end
end
end
end
end
#Rake::RDocTask.new do |rd|
# rd.main = "README"
# rd.rdoc_files.include("README", "lib/**/*.rb")
#end
# Create compressed packages
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = PKG_NAME
s.summary = "Generate Rakefiles to Build C Extensions to Ruby"
s.description = %q{This proposed replacement to mkmf generates Rakefiles to build C Extensions.}
s.version = PKG_VERSION
s.author = "Kevin Clark"
s.email = "kevin.clark@gmail.com"
s.rubyforge_project = RUBY_FORGE_PROJECT
s.homepage = "http://glu.ttono.us"
s.has_rdoc = true
s.rdoc_options << '--main' << 'README' << '--title' << 'mkrf'
s.requirements << 'rake'
s.require_path = 'lib'
s.autorequire = 'mkrf'
s.extra_rdoc_files = [ "README", "MIT-LICENSE", "CHANGELOG" ]
s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
#Rake::GemPackageTask.new(spec) do |p|
# p.gem_spec = spec
# p.need_tar = true
# p.need_zip = true
#end
|