2006-01-28 14:03:53 -05:00
|
|
|
|
2007-10-11 14:14:26 -04:00
|
|
|
require 'rubygems'
|
|
|
|
gem 'echoe', '>=2.6.4'
|
2007-09-22 23:09:56 -04:00
|
|
|
require 'echoe'
|
|
|
|
|
2007-10-17 04:21:58 -04:00
|
|
|
e = Echoe.new("mongrel") do |p|
|
2007-09-22 23:09:56 -04:00
|
|
|
p.summary = "A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps."
|
|
|
|
p.author ="Zed A. Shaw"
|
2007-10-21 00:17:44 -04:00
|
|
|
p.clean_pattern = ['ext/http11/*.{bundle,so,o,obj,pdb,lib,def,exp}', 'ext/http11/Makefile', 'pkg', 'lib/*.bundle', '*.gem', 'site/output', '.config', 'lib/http11.jar', 'ext/http11_java/classes']
|
2007-09-22 23:09:56 -04:00
|
|
|
p.rdoc_pattern = ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc', 'ext/http11/http11.c']
|
2007-09-25 17:42:39 -04:00
|
|
|
p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/
|
2007-09-22 23:09:56 -04:00
|
|
|
p.ruby_version = '>= 1.8.4'
|
2007-10-11 03:00:43 -04:00
|
|
|
p.dependencies = ['gem_plugin >=0.2.3', 'cgi_multipart_eof_fix >=2.4']
|
2007-09-22 23:09:56 -04:00
|
|
|
|
|
|
|
p.need_tar_gz = false
|
|
|
|
p.need_tgz = true
|
|
|
|
|
2007-10-16 20:39:25 -04:00
|
|
|
case RUBY_PLATFORM
|
2007-10-16 23:27:51 -04:00
|
|
|
when /mswin/
|
|
|
|
p.certificate_chain = ['~/gem_certificates/mongrel-public_cert.pem',
|
|
|
|
'~/gem_certificates/luislavena-mongrel-public_cert.pem']
|
|
|
|
else
|
|
|
|
p.certificate_chain = ['~/p/configuration/gem_certificates/mongrel/mongrel-public_cert.pem',
|
|
|
|
'~/p/configuration/gem_certificates/evan_weaver-mongrel-public_cert.pem']
|
2007-09-25 20:17:31 -04:00
|
|
|
end
|
|
|
|
|
2007-09-22 23:09:56 -04:00
|
|
|
p.eval = proc do
|
2007-10-16 20:39:25 -04:00
|
|
|
case RUBY_PLATFORM
|
2007-10-16 23:27:51 -04:00
|
|
|
when /mswin/
|
|
|
|
extensions.clear
|
|
|
|
self.files += ['lib/http11.so']
|
|
|
|
self.platform = Gem::Platform::WIN32
|
2007-10-17 01:17:17 -04:00
|
|
|
when /java/
|
2007-10-16 23:27:51 -04:00
|
|
|
extensions.clear
|
|
|
|
self.files += ['lib/http11.jar']
|
2007-10-17 01:17:17 -04:00
|
|
|
self.platform = 'jruby'
|
2007-10-16 23:27:51 -04:00
|
|
|
else
|
|
|
|
add_dependency('daemons', '>= 1.0.3')
|
|
|
|
add_dependency('fastthread', '>= 1.0.1')
|
|
|
|
end
|
2007-09-22 23:09:56 -04:00
|
|
|
end
|
2007-10-16 23:27:51 -04:00
|
|
|
|
2007-09-22 23:09:56 -04:00
|
|
|
end
|
2006-01-28 14:03:53 -05:00
|
|
|
|
2007-10-17 02:57:40 -04:00
|
|
|
#### Ragel builder
|
|
|
|
|
2007-10-21 00:39:13 -04:00
|
|
|
desc "Rebuild the Ragel sources"
|
2007-10-17 02:57:40 -04:00
|
|
|
task :ragel do
|
|
|
|
Dir.chdir "ext/http11" do
|
|
|
|
target = "http11_parser.c"
|
|
|
|
File.unlink target if File.exist? target
|
|
|
|
sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}"
|
|
|
|
raise "Failed to build C source" unless File.exist? target
|
|
|
|
end
|
2007-10-17 03:10:43 -04:00
|
|
|
Dir.chdir "ext/http11" do
|
|
|
|
target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
|
2007-10-17 02:57:40 -04:00
|
|
|
File.unlink target if File.exist? target
|
2007-10-17 03:10:43 -04:00
|
|
|
sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}"
|
2007-10-17 02:57:40 -04:00
|
|
|
raise "Failed to build Java source" unless File.exist? target
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-10-17 04:21:58 -04:00
|
|
|
#### XXX Hack around JRuby test/unit interaction problems
|
|
|
|
|
2007-10-21 00:39:13 -04:00
|
|
|
desc "Run each test suite in isolation on JRuby"
|
2007-10-17 04:21:58 -04:00
|
|
|
task :test_java do
|
|
|
|
e.test_pattern.each do |f|
|
2007-10-20 19:15:19 -04:00
|
|
|
sh "/opt/local/jruby/bin/jruby -w -Ilib:ext:bin:test -e 'require \"#{f}\"'" rescue nil
|
2007-10-17 04:21:58 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#### XXX Hack around RubyGems and Echoe for pre-compiled extensions.
|
2007-09-25 19:09:51 -04:00
|
|
|
|
2007-10-16 20:39:25 -04:00
|
|
|
def move_extensions
|
2007-10-16 23:34:09 -04:00
|
|
|
Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"].each { |file| cp file, "lib/" }
|
2007-10-16 23:27:51 -04:00
|
|
|
end
|
|
|
|
|
2007-10-17 02:31:45 -04:00
|
|
|
def java_classpath_arg
|
|
|
|
# A myriad of ways to discover the JRuby classpath
|
|
|
|
classpath = begin
|
|
|
|
require 'java'
|
|
|
|
# Already running in a JRuby JVM
|
|
|
|
Java::java.lang.System.getProperty('java.class.path')
|
|
|
|
rescue LoadError
|
|
|
|
ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
|
|
|
|
end
|
|
|
|
classpath ? "-cp #{classpath}" : ""
|
|
|
|
end
|
|
|
|
|
2007-10-16 23:27:51 -04:00
|
|
|
case RUBY_PLATFORM
|
|
|
|
when /mswin/
|
|
|
|
filename = "lib/http11.so"
|
|
|
|
file filename do
|
2007-10-16 23:34:09 -04:00
|
|
|
Dir.chdir("ext/http11") do
|
2007-10-18 21:35:32 -04:00
|
|
|
ruby "extconf.rb"
|
2007-10-18 21:37:35 -04:00
|
|
|
system(PLATFORM =~ /mswin/ ? 'nmake' : 'make')
|
2007-10-16 23:27:51 -04:00
|
|
|
end
|
|
|
|
move_extensions
|
|
|
|
end
|
|
|
|
task :compile => [filename]
|
|
|
|
|
2007-10-17 01:17:17 -04:00
|
|
|
when /java/
|
2007-10-16 23:27:51 -04:00
|
|
|
filename = "lib/http11.jar"
|
|
|
|
file filename do
|
2007-10-17 02:31:45 -04:00
|
|
|
build_dir = "ext/http11_java/classes"
|
|
|
|
mkdir_p build_dir
|
|
|
|
sources = FileList['ext/http11_java/**/*.java'].join(' ')
|
|
|
|
sh "javac -target 1.4 -source 1.4 -d #{build_dir} #{java_classpath_arg} #{sources}"
|
|
|
|
sh "jar cf lib/http11.jar -C #{build_dir} ."
|
2007-10-16 23:27:51 -04:00
|
|
|
move_extensions
|
|
|
|
end
|
|
|
|
task :compile => [filename]
|
2007-10-17 01:17:17 -04:00
|
|
|
|
2007-10-16 20:39:25 -04:00
|
|
|
end
|
2006-05-21 10:46:42 -04:00
|
|
|
|
2007-09-22 23:09:56 -04:00
|
|
|
#### Project-wide install and uninstall tasks
|
2006-03-10 01:46:45 -05:00
|
|
|
|
2007-09-22 23:09:56 -04:00
|
|
|
def sub_project(project, *targets)
|
|
|
|
targets.each do |target|
|
|
|
|
Dir.chdir "projects/#{project}" do
|
|
|
|
sh %{rake --trace #{target.to_s} }
|
|
|
|
end
|
2006-02-15 18:17:23 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-10-21 00:39:13 -04:00
|
|
|
desc "Package Mongrel and all subprojects"
|
2007-10-15 15:11:37 -04:00
|
|
|
task :package_all => [:package] do
|
2007-10-22 04:27:42 -04:00
|
|
|
sub_project("gem_plugin", :package)
|
|
|
|
sub_project("cgi_multipart_eof_fix", :package)
|
|
|
|
sub_project("fastthread", :package)
|
|
|
|
sub_project("mongrel_status", :package)
|
|
|
|
sub_project("mongrel_upload_progress", :package)
|
|
|
|
sub_project("mongrel_console", :package)
|
|
|
|
sub_project("mongrel_cluster", :package)
|
2007-10-15 14:57:59 -04:00
|
|
|
if RUBY_PLATFORM =~ /mswin/
|
2007-10-22 04:27:42 -04:00
|
|
|
sub_project("mongrel_service", :package)
|
2007-10-15 14:57:59 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-09-22 23:09:56 -04:00
|
|
|
task :install_requirements do
|
|
|
|
# These run before Mongrel is installed
|
2006-03-11 11:35:53 -05:00
|
|
|
sub_project("gem_plugin", :install)
|
2007-09-22 23:09:56 -04:00
|
|
|
sub_project("cgi_multipart_eof_fix", :install)
|
2006-11-20 11:52:46 -05:00
|
|
|
sub_project("fastthread", :install)
|
2007-09-22 23:09:56 -04:00
|
|
|
end
|
|
|
|
|
2007-10-21 00:39:13 -04:00
|
|
|
desc "for Mongrel and all subprojects"
|
2007-09-22 23:09:56 -04:00
|
|
|
task :install => [:install_requirements] do
|
|
|
|
# These run after Mongrel is installed
|
2006-03-11 11:35:53 -05:00
|
|
|
sub_project("mongrel_status", :install)
|
2006-06-25 10:49:46 -04:00
|
|
|
sub_project("mongrel_upload_progress", :install)
|
2006-03-19 00:18:11 -05:00
|
|
|
sub_project("mongrel_console", :install)
|
2006-08-16 17:51:38 -04:00
|
|
|
sub_project("mongrel_cluster", :install)
|
2006-06-16 17:01:12 -04:00
|
|
|
if RUBY_PLATFORM =~ /mswin/
|
|
|
|
sub_project("mongrel_service", :install)
|
|
|
|
end
|
2006-03-11 11:35:53 -05:00
|
|
|
end
|
|
|
|
|
2007-10-21 00:39:13 -04:00
|
|
|
desc "for Mongrel and all its subprojects"
|
2006-03-11 11:35:53 -05:00
|
|
|
task :uninstall => [:clean] do
|
|
|
|
sub_project("mongrel_status", :uninstall)
|
2007-09-22 23:09:56 -04:00
|
|
|
sub_project("cgi_multipart_eof_fix", :uninstall)
|
2006-06-25 10:49:46 -04:00
|
|
|
sub_project("mongrel_upload_progress", :uninstall)
|
2006-03-19 00:18:11 -05:00
|
|
|
sub_project("mongrel_console", :uninstall)
|
2006-03-11 11:35:53 -05:00
|
|
|
sub_project("gem_plugin", :uninstall)
|
2006-11-20 11:52:46 -05:00
|
|
|
sub_project("fastthread", :uninstall)
|
2006-06-16 17:01:12 -04:00
|
|
|
if RUBY_PLATFORM =~ /mswin/
|
|
|
|
sub_project("mongrel_service", :install)
|
|
|
|
end
|
2006-03-11 11:35:53 -05:00
|
|
|
end
|
2006-03-12 14:40:35 -05:00
|
|
|
|
2007-10-22 04:27:42 -04:00
|
|
|
desc "for Mongrel and all its subprojects"
|
|
|
|
task :clean do
|
|
|
|
sub_project("gem_plugin", :clean)
|
|
|
|
sub_project("cgi_multipart_eof_fix", :clean)
|
|
|
|
sub_project("fastthread", :clean)
|
|
|
|
sub_project("mongrel_status", :clean)
|
|
|
|
sub_project("mongrel_upload_progress", :clean)
|
|
|
|
sub_project("mongrel_console", :clean)
|
|
|
|
sub_project("mongrel_cluster", :clean)
|
|
|
|
if RUBY_PLATFORM =~ /mswin/
|
|
|
|
sub_project("mongrel_service", :clean)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-10-21 00:39:13 -04:00
|
|
|
#### Site upload tasks
|
|
|
|
|
|
|
|
namespace :site do
|
|
|
|
|
|
|
|
desc "Package and upload .gem files and .tgz files for Mongrel and all subprojects to http://mongrel.rubyforge.org/releases/"
|
|
|
|
task :source => [:package_all] do
|
|
|
|
rm_rf "pkg/gems"
|
|
|
|
rm_rf "pkg/tars"
|
|
|
|
mkdir_p "pkg/gems"
|
|
|
|
mkdir_p "pkg/tars"
|
|
|
|
|
|
|
|
FileList["**/*.gem"].each { |gem| mv gem, "pkg/gems" }
|
|
|
|
FileList["**/*.tgz"].each {|tgz| mv tgz, "pkg/tars" }
|
|
|
|
|
|
|
|
# XXX Hack, because only Luis can package for Win32 right now
|
|
|
|
sh "cp ~/Downloads/mongrel-1.0.2-mswin32.gem pkg/gems/"
|
|
|
|
sh "cp ~/Downloads/mongrel_service-0.3.3-mswin32.gem pkg/gems/"
|
|
|
|
sh "rm -rf pkg/mongrel*"
|
|
|
|
sh "index_gem_repository.rb -d pkg"
|
|
|
|
sh "scp -r CHANGELOG pkg/* rubyforge.org:/var/www/gforge-projects/mongrel/releases/"
|
|
|
|
sh "svn log -v > SVN_LOG"
|
|
|
|
sh "scp -r SVN_LOG pkg/* rubyforge.org:/var/www/gforge-projects/mongrel/releases/"
|
|
|
|
rm "SVN_LOG"
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Upload the website"
|
|
|
|
task :web do
|
2007-10-21 00:42:52 -04:00
|
|
|
# Requires the 'webgem' gem and the 'atom-tools' gem
|
|
|
|
sh "cd site; webgen; ruby atom.rb > output/feed.atom; rsync -azv --no-perms --no-times output/* rubyforge.org:/var/www/gforge-projects/mongrel/"
|
2007-10-21 00:39:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Upload the rdocs"
|
|
|
|
task :rdoc => [:redoc] do
|
|
|
|
sh "rsync -azv doc/* rubyforge.org:/var/www/gforge-projects/mongrel/rdoc/"
|
|
|
|
sh "cd projects/gem_plugin; rake site"
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Upload the coverage report"
|
|
|
|
task :coverage => [:rcov] do
|
|
|
|
sh "rsync -azv test/coverage/* rubyforge.org:/var/www/gforge-projects/mongrel/coverage/"
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Upload the website, the rdocs, and the coverage report"
|
|
|
|
task :all => [:web, :rdoc, :coverage]
|
2007-10-15 15:11:37 -04:00
|
|
|
|
2007-09-22 23:09:56 -04:00
|
|
|
end
|