Rantfile in rant-0.4.4 vs Rantfile in rant-0.4.6
- old
+ new
@@ -1,47 +1,75 @@
# Rantfile for Rant :)
import "md5"
-import %w(rubytest rubydoc rubypackage autoclean win32/rubycmdwrapper)
+import %w(rubytest rubydoc rubypackage autoclean win32/rubycmdwrapper sys/more)
task :default => :test
dist_files = sys["{bin,lib,test,doc,misc}/**/*"]
dist_files.shun("html", "coverage")
dist_files += sys["*"].no_dir.exclude("InstalledFiles", "Session.vim")
+dist_files.exclude("bench-*")
+hp_files = sys["doc/homepage/*"]
+extra_rdoc_files = sys["**/README", "NEWS", "doc/**/*.rdoc"]
+extra_rdoc_files.no_dir("pkg").no_dir("test")
# remove when compiler stuff is getting useful...
dist_files.exclude "lib/rant/compiler*", "lib/rant/import/c/program.rb"
rdoc_opts = %w(-S -c UTF-8 --title Rant --main README)
-gen RubyPackage, "rant" do |t|
+gen RubyPackage, "rant#{var :pkg_ext}" 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_extra_rdoc_files = extra_rdoc_files
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.files.concat extra_rdoc_files
g.opts = rdoc_opts + %w(-T doc/jamis.rb)
end
+html_index = "doc/html/index.html"
+api_index = html_index.sub("index", "api")
+
+enhance "doc/html/index.html" do
+ sys.rm_f api_index # remove old RDoc index page
+ make "hp2doc"
+end
+
+task "hp2doc" do
+ if test(?f, html_index) && !test(?f, api_index)
+ sys.mv html_index, api_index
+ end
+ sys.cp hp_files, "doc/html"
+end
+
+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
+
+task "publish-hp" do
+ sys "scp -r doc/homepage/* langi@rubyforge.org:/var/www/gforge-projects/make/"
+end
+
desc "Run basic tests."
gen RubyTest do |g|
g.libs << "test"
g.pattern = 'test_*.rb'
end
@@ -72,11 +100,11 @@
desc "Run all tests and generate coverage with rcov."
task :cov do
lp = File.expand_path "lib"
sys.cd "test" do
- sys %W(rcov -xtutil.rb,*.t,ts_*,tc_*,test_* -I#{lp} ts_all.rb)
+ sys %W(rcov -xtutil.rb,ts_*,tc_*,test_* -I#{lp} ts_all.rb)
end
end
desc "Test project with subdirs."
gen RubyTest, :tsubdirs do |t|
@@ -118,16 +146,10 @@
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
@@ -143,12 +165,28 @@
end
desc "Install Rant."
task :install do
sys.ruby "setup.rb"
+ # try to install man page
+ man_path = ENV["MANPATH"]
+ if man_path
+ puts "trying to install rant(1) manpage..."
+ require 'rbconfig'
+ prefix = Config::CONFIG["prefix"]
+ dirs = sys.split_path man_path
+ man_dir = dirs.find{|d| d == "#{prefix}/man" } || dirs.first
+ sys.install "doc/rant.1", "#{man_dir}/man1", :mode => 0644 if man_dir
+ end
end
if Env.on_windows?
enhance :install => (gen Win32::RubyCmdWrapper, sys["bin/*"])
+end
+
+task "svn-clean" do
+ `svn stat`.split(/\n/).each { |line|
+ sys.clean line[7..-1] if line[0] == ??
+ }
end
# vim:ft=ruby