Permalink
Browse files

Rakefile and install.rb have better gem-testers support.

Now builds the gem in a separate bucket, and if a separate bucket
is asked for, installs the tests and a Rakefile for running them.
  • Loading branch information...
1 parent 41bcde7 commit 468e1174440694c95338a48636523ef13711c8f9 @dagbrown committed Dec 27, 2010
Showing with 25 additions and 10 deletions.
  1. +12 −10 Rakefile
  2. +13 −0 install.rb
View
@@ -25,6 +25,8 @@ begin
rescue nil
end
+BuildDir = "BUILD"
+
Package = "gurgitate-mail"
Modules = %w{gurgitate/deliver.rb
@@ -43,7 +45,7 @@ Targets = %w{gurgitate-mail.rb
gurgitate-mail.man
README} + Modules
-Tests = Dir["test/test_*.rb", ".gemtest", "Rakefile"]
+Tests = Dir["test/test_*.rb"]
Gemspec = "#{Package}.gemspec"
@@ -60,32 +62,32 @@ task :tarball => Tarball
task :release => [:tag, :dist, :webpage]
task :rerelease => [:untag, :tag, :tarball, :webpage]
-task :gem => Gemfile do
- FileUtils.mv Gemfile, ".."
-end
-
+task :gem => Gemfile
task :clean => :gem_cleanup do
delete_all(*Targets+["pod2htm*~~","*.tmp",
"gurgitate-mail.text","doc","*~"])
end
task :gem_cleanup do
- delete_all "bin"
- delete_all "lib"
- delete_all "man"
+ delete_all BuildDir
delete_all "*.gem"
end
file Gemfile => [ Gemspec, :gem_install ] do
require "rubygems/builder"
gemspec = eval File.read(Gemspec)
+ FileUtils.touch File.join(BuildDir, ".gemtest")
+ olddir = Dir.pwd
+ chdir BuildDir
Gem::Builder.new(gemspec).build
+ FileUtils.mv Gemfile,olddir
+ chdir olddir
end
task :gem_install => Targets do
require "install"
- Gurgitate::Install.install "."
+ Gurgitate::Install.install BuildDir
end
task :install => Targets do
@@ -134,7 +136,7 @@ task :test => :default do
end
task :cover => :default do
- system("rcov test/runtests.rb")
+ system("rcov #{BuildDir}/test/runtests.rb")
end
task :webpage => [Tarball,"CHANGELOG","gurgitate-mail.html"] do
View
@@ -33,12 +33,14 @@ def self.install(prefix=nil)
dest = File.join prefix, "lib"; mkdir dest
mkdir File.join(prefix, "man")
mandir = File.join prefix, "man", "man1"; mkdir mandir
+ test = File.join(prefix,"test")
else
version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
sitedir = CONFIG["sitedir"]
bindir = CONFIG["bindir"]
mandir = File.join(CONFIG["mandir"],"man1")
dest = CONFIG["sitelibdir"]
+ test = nil
end
destgur = File.join(dest,"gurgitate")
@@ -61,6 +63,17 @@ def self.install(prefix=nil)
FileUtils.install(f,destdel)
}
+ if test then
+ mkdir test
+
+ Dir[File.join("test","*.rb")].each do |f|
+ puts "Installing #{f} in #{test}"
+ FileUtils.install(f, test)
+ end
+
+ FileUtils.install "Rakefile.test", File.join(prefix, "Rakefile")
+ end
+
print "Installing #{Package}.1 in #{mandir}...\n"
FileUtils.install("#{Package}.man","#{mandir}/#{Package}.1",
:mode => 0644)

0 comments on commit 468e117

Please sign in to comment.