require 'rubygems' require 'rake/gempackagetask' require 'fileutils' def read_version m = /\#define\s+HEAPSHOW\_VERSION +"(\d+\.\d+\.\d+)"/.match(IO.read('ext/cheapshow.c')) return m[1] if m end task :default => [:init_spec, :package] task :test do ENV['RUBYLIB'] = File.expand_path(LIB) + File::PATH_SEPARATOR + ENV['RUBYLIB'] Dir.chdir TEST system 'ruby test.rb' end task :init_spec do spec = Gem::Specification.new do |s| s.authors = 'art' s.email = 'art@example.com' s.platform = Gem::Platform::RUBY s.extensions << 'ext/extconf.rb' s.required_ruby_version = ">= 1.8.7" s.summary = 'TODO: ' s.name = 'heapshow' s.homepage = 'http://heapshow.rubyforge.org/' s.version = read_version s.requirements << 'none' s.require_path = 'lib' s.files = FileList['lib/**/*.rb', 'samples/**/*.rb', 'ext/*.c', 'ext/*.h', 'ext/depend', 'test/*.rb', '*.txt', 'ChangeLog'] s.test_file = 'test/test.rb' s.has_rdoc = true s.description = 'TODO:' end Rake::GemPackageTask.new(spec) do |pkg| pkg.gem_spec = spec pkg.need_zip = false pkg.need_tar = false end end