# Rantfile for Rant :) import %w(rubytest rubydoc rubypackage autoclean) task :default => :test lib_files = sys["lib/**/*.rb"] dist_files = sys["{bin,lib,test,doc}/**/*"].shun("html", "coverage") + sys["*"].no_dir.exclude("InstalledFiles", "Session.vim") bin_files = sys["bin/*"] rdoc_opts = %w(-S -c UTF-8 --title Rant --main README) gen RubyPackage, "rant" do |t| t.version = `#{Env::RUBY} run_rant --version`.split[1] t.summary = "Rant is a Ruby based build tool." t.files = dist_files t.bindir = "bin" t.executable %w(rant rant-import) t.author = "Stefan Lang" t.email = "langstefan@gmx.at" t.rubyforge_project = "make" t.homepage = "http://make.rubyforge.org" t.gem_extra_rdoc_files = sys["**/README", "NEWS"].no_dir("pkg").no_dir("test") + sys["doc/**/*.rdoc"] t.gem_rdoc_options = rdoc_opts desc "Create packages for distribution." t.package_task end desc "Generate documentation." gen RubyDoc do |g| g.verbose = true g.dir = "doc/html" g.files.concat sys["NEWS", "**/README"].no_dir("pkg").no_dir("test") g.files.concat sys["doc/**/*.rdoc"] g.opts = rdoc_opts + %w(-T doc/jamis.rb) end desc "Run basic tests." gen RubyTest do |g| g.libs << "test" g.pattern = 'test_*.rb' end desc "Run first test-project." gen RubyTest, :testp1 do |g| g.libs << "test" g.test_files = ["test/project1/test_project.rb"] end desc "Run second test project." gen RubyTest, :testp2 do |g| g.libs << "test" g.test_files = ["test/project2/test_project.rb"] end desc "Test small Ruby project." gen RubyTest, :testrb1 do |g| g.libs << "test" g.test_files = %w(test/project_rb1/test_project_rb1.rb) end desc "Test plugins." gen RubyTest, :testplugins do |g| g.libs << "test" g.test_files = sys["test/plugin/**/test_*"] end desc "Run all tests and generate coverage with rcov." task :cov do lp = File.expand_path "lib" sys.cd "test" do sys %W(rcov -xts_*,tc_*,test_* -I#{lp} ts_all.rb) end end desc "Test project with subdirs." gen RubyTest, :tsubdirs do |t| t.libs << "test" t.test_files = sys["test/subdirs/test_*.rb"] end desc "Test rant-import command." gen RubyTest, :trimport do |t| t.libs << "test" t.test_files = sys["test/rant-import/test_*.rb"] end desc "Test import/ libraries." gen RubyTest, :timport do |t| t.libs << "test" t.test_files = sys["test/import/**/test_*.rb"] end desc "Run all tests." gen RubyTest, :tall do |g| g.libs << "test" g.test_files = sys["test/**/test_*.rb"] end task :testall => %w(test testp1 testp2 testrb1 testplugins) desc "Remove autogenerated files." gen AutoClean, :clean var[:clean].include %w( InstalledFiles .config bench-rant bench-depsearch test/coverage ) desc "Publish html docs on make.rubyfore.org.", "Note: scp will prompt for rubyforge password." task "publish-docs" => :doc do sys "scp -r doc/html/* langi@rubyforge.org:/var/www/gforge-projects/make/" end # Just for quick visual testing of rant... task :please_fail do |t| sys "mix_nix_gibts" end task "to-win" => :package do win_dir = "/mnt/data_fat/stefan/Ruby" Dir["pkg/*"].each { |f| target = File.join(win_dir, File.basename(f)) (file target => f do |t| sys.rm_rf target if test(?e, target) sys.cp_r f, t.name end).invoke } end desc "Install Rant." install = task :install do sys.ruby "setup.rb" end if Env.on_windows? cmd_files = bin_files.find_all { |f| f !~ /\.cmd$/} cmd_files.map! { |f| "#{f}.cmd" } cmd_files.zip(bin_files).each { |cmd, bin| file cmd do |t| File.open(t.name, "w") { |f| i_bin = File.join(Env::RUBY_BINDIR, File.basename(bin)) f.puts "@#{sys.sp Env::RUBY} #{sys.sp i_bin} %*" } end install << cmd } end # vim:ft=ruby: