Rakefile in ruby-mpfr-0.0.12 vs Rakefile in ruby-mpfr-0.0.13

- old
+ new

@@ -1,30 +1,31 @@ -require 'rubygems' -gem 'hoe', '>= 2.1.0' -require 'hoe' -require 'fileutils' -require './lib/mpfr/version.rb' -# require 'rake/clean' +require "bundler/gem_tasks" -Hoe.plugin :newgem -# Hoe.plugin :website -# Hoe.plugin :cucumberfeatures +def each_extconf_directory(&block) + Dir.glob("ext/**/extconf.rb").each do |extconf| + cd File.dirname(extconf) do + yield + end + end +end -# Generate all the Rake tasks -# Run 'rake -T' to see list of generated tasks (from gem root directory) -$hoe = Hoe.spec 'ruby-mpfr' do - self.developer 'Takayuki YAMAGUCHI', 'd@ytak.info' - self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required - self.rubyforge_name = self.name # TODO this is default value - # self.extra_deps = [['activesupport','>= 2.0.2']] - self.spec_extras[:extensions] = ["ext/mpfr/extconf.rb", "ext/mpfr_matrix/mpfr/extconf.rb", - "ext/gmp/mpfr/extconf.rb"] - self.extra_rdoc_files << 'README.rdoc' - self.extra_rdoc_files << 'Example.rdoc' +desc 'Compile extended library' +task 'ext:compile' do |t| + each_extconf_directory do + sh 'ruby extconf.rb' unless File.exist?('Makefile') + sh 'make' + end end -# require 'newgem/tasks' -Dir['tasks/**/*.rake'].each { |t| load t } +desc 'Clean' +task 'ext:clean' do |t| + each_extconf_directory do + sh 'make clean' if File.exist?('Makefile') + end +end -# TODO - want other tests/tasks run by default? Add them to the list -# remove_task :default -# task :default => [:spec, :features] +desc 'Clean completely' +task 'ext:distclean' do |t| + each_extconf_directory do + sh 'make distclean' if File.exist?('Makefile') + end +end