rake tasks for use from hudson

This commit is contained in:
Doug MacEachern 2009-02-16 13:51:24 -08:00
parent 52c3bb0191
commit f81f9a52ab
1 changed files with 41 additions and 0 deletions

View File

@ -12,6 +12,7 @@ File.open("bindings/java/version.properties").each { |line|
} }
GEM = props['project.name'] GEM = props['project.name']
MAKE = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
spec = Gem::Specification.new do |s| spec = Gem::Specification.new do |s|
s.name = GEM s.name = GEM
@ -42,3 +43,43 @@ task :make_spec do
file.puts spec.to_ruby file.puts spec.to_ruby
end end
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