From f81f9a52ab6ad56c5c54610679774939ae6d2626 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 16 Feb 2009 13:51:24 -0800 Subject: [PATCH] rake tasks for use from hudson --- Rakefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Rakefile b/Rakefile index 0a1e010c..fb8d9aa4 100644 --- a/Rakefile +++ b/Rakefile @@ -12,6 +12,7 @@ File.open("bindings/java/version.properties").each { |line| } GEM = props['project.name'] +MAKE = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make' spec = Gem::Specification.new do |s| s.name = GEM @@ -42,3 +43,43 @@ task :make_spec do file.puts spec.to_ruby end end + +def in_ext() + ext = 'bindings/ruby' + Dir.chdir(ext) if File.directory? ext +end + +desc 'Build sigar extension' +task :build do + in_ext(); + unless system("ruby extconf.rb") + STDERR.puts "Failed to configure" + break + end + unless system(MAKE) + STDERR.puts 'Failed to ' + MAKE + break + end +end + +desc 'Clean sigar extension' +task :clean do + in_ext() + system(MAKE + ' clean') +end + +desc 'Dist Clean sigar extension' +task :distclean do + in_ext() + system(MAKE + ' distclean') +end + +desc 'Run sigar examples (test)' +task :examples => [:build] do + in_ext() + Dir["examples/*.rb"].each do |file| + cmd = "ruby #{file}" + print cmd + "\n" + system(cmd) + end +end