Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Big ugly hack to Rakefile, FORCE_PURE is just garbage, but worked for…

… now.

git-svn-id: svn://rubyforge.org/var/svn/mongrel/branches/stable_1-0@934 19e92222-5c0b-0410-8929-a290d50e31e9
  • Loading branch information...
commit c8b62436839eb330d8c8c104b1937963ccb5e7b1 1 parent 6ac18a2
luislavena authored
Showing with 75 additions and 64 deletions.
  1. +75 −64 Rakefile
139 Rakefile
View
@@ -1,45 +1,54 @@
require 'rubygems'
-gem 'echoe', '>=2.6.4'
+gem 'echoe', '>=2.7.5'
require 'echoe'
+FORCE_PURE = ENV['FORCE_PURE'] || false
e = Echoe.new("mongrel") do |p|
p.summary = "A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps."
p.author ="Zed A. Shaw"
- 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', 'coverage']
- p.rdoc_pattern = ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
+ p.clean_pattern = ['ext/http11/*.{bundle,so,o,obj,pdb,lib,def,exp}', 'lib/*.{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', 'coverage']
+ p.rdoc_pattern = ['README', 'LICENSE', 'CHANGELOG', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/
- p.ruby_version = '>= 1.8.4'
- p.dependencies = ['gem_plugin >=0.2.3', 'cgi_multipart_eof_fix >=2.4']
-
+ p.ruby_version = '>=1.8.4'
+ p.dependencies = ['gem_plugin >=0.2.3']
+ p.extension_pattern = nil
+ p.certificate_chain = ['~/p/configuration/gem_certificates/mongrel/mongrel-public_cert.pem',
+ '~/p/configuration/gem_certificates/evan_weaver-mongrel-public_cert.pem']
+
p.need_tar_gz = false
p.need_tgz = true
- case RUBY_PLATFORM
- 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']
- end
-
- p.eval = proc do
- case RUBY_PLATFORM
+ case RUBY_PLATFORM
when /mswin/
- extensions.clear
- self.files += ['lib/http11.so']
- self.platform = Gem::Platform::WIN32
+ p.certificate_chain = [
+ '~/projects/gem_certificates/mongrel-public_cert.pem',
+ '~/projects/gem_certificates/luislavena-mongrel-public_cert.pem'
+ ]
when /java/
- extensions.clear
- self.files += ['lib/http11.jar']
- self.platform = 'jruby'
else
- add_dependency('daemons', '>= 1.0.3')
- add_dependency('fastthread', '>= 1.0.1')
+ p.extension_pattern = ["ext/**/extconf.rb"]
+ end
+
+ unless FORCE_PURE
+ p.eval = proc do
+ case RUBY_PLATFORM
+ when /mswin/
+ self.files += ['lib/http11.so']
+ self.platform = Gem::Platform::CURRENT
+ add_dependency('cgi_multipart_eof_fix', '>= 2.4')
+ when /java/
+ self.files += ['lib/http11.jar']
+ self.platform = 'jruby'
+ else
+ add_dependency('daemons', '>= 1.0.3')
+ add_dependency('fastthread', '>= 1.0.1')
+ add_dependency('cgi_multipart_eof_fix', '>= 2.4')
+ end
end
+ else
+ p.extension_pattern = ["ext/**/extconf.rb"]
end
-
end
#### Ragel builder
@@ -60,25 +69,16 @@ task :ragel do
end
end
-#### XXX Hack around JRuby test/unit interaction problems
-
-desc "Run each test suite in isolation on JRuby"
-task :test_java do
- e.test_pattern.each do |f|
- sh "/opt/local/jruby/bin/jruby -w -Ilib:ext:bin:test -e 'require \"#{f}\"'" rescue nil
- end
-end
-
-#### XXX Hack around RubyGems and Echoe for pre-compiled extensions.
+#### Pre-compiled extensions for alternative platforms
def move_extensions
- Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"].each { |file| cp file, "lib/" }
+ Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"].each { |file| mv file, "lib/" }
end
-def java_classpath_arg
+def java_classpath_arg
# A myriad of ways to discover the JRuby classpath
classpath = begin
- require 'java'
+ require 'java'
# Already running in a JRuby JVM
Java::java.lang.System.getProperty('java.class.path')
rescue LoadError
@@ -91,15 +91,23 @@ case RUBY_PLATFORM
when /mswin/
filename = "lib/http11.so"
file filename do
- Dir.chdir("ext/http11") do
+ Dir.chdir("ext/http11") do
ruby "extconf.rb"
system(PLATFORM =~ /mswin/ ? 'nmake' : 'make')
end
move_extensions
- end
+ end
task :compile => [filename]
when /java/
+
+ # Avoid JRuby in-process launching problem
+ begin
+ require 'jruby'
+ JRuby.runtime.instance_config.run_ruby_in_process = false
+ rescue LoadError
+ end
+
filename = "lib/http11.jar"
file filename do
build_dir = "ext/http11_java/classes"
@@ -107,8 +115,8 @@ when /java/
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} ."
- move_extensions
- end
+ move_extensions
+ end
task :compile => [filename]
end
@@ -118,7 +126,9 @@ end
def sub_project(project, *targets)
targets.each do |target|
Dir.chdir "projects/#{project}" do
- sh %{rake --trace #{target.to_s} }
+ unless RUBY_PLATFORM =~ /mswin/
+ sh("rake #{target.to_s}") # --trace
+ end
end
end
end
@@ -132,8 +142,11 @@ task :package_all => [:package] do
sub_project("mongrel_upload_progress", :package)
sub_project("mongrel_console", :package)
sub_project("mongrel_cluster", :package)
- sub_project("mongrel_service", :package) if RUBY_PLATFORM =~ /mswin/
+
sh("rake java package") unless RUBY_PLATFORM =~ /java/
+
+ # XXX Broken by RubyGems 0.9.5
+ # sub_project("mongrel_service", :package) if RUBY_PLATFORM =~ /mswin/
# sh("rake mswin package") unless RUBY_PLATFORM =~ /mswin/
end
@@ -150,7 +163,7 @@ task :install => [:install_requirements] do
sub_project("mongrel_status", :install)
sub_project("mongrel_upload_progress", :install)
sub_project("mongrel_console", :install)
- sub_project("mongrel_cluster", :install)
+ sub_project("mongrel_cluster", :install)
sub_project("mongrel_service", :install) if RUBY_PLATFORM =~ /mswin/
end
@@ -161,7 +174,7 @@ task :uninstall => [:clean] do
sub_project("mongrel_upload_progress", :uninstall)
sub_project("mongrel_console", :uninstall)
sub_project("gem_plugin", :uninstall)
- sub_project("fastthread", :uninstall)
+ sub_project("fastthread", :uninstall)
sub_project("mongrel_service", :uninstall) if RUBY_PLATFORM =~ /mswin/
end
@@ -173,7 +186,7 @@ task :clean do
sub_project("mongrel_status", :clean)
sub_project("mongrel_upload_progress", :clean)
sub_project("mongrel_console", :clean)
- sub_project("mongrel_cluster", :clean)
+ sub_project("mongrel_cluster", :clean)
sub_project("mongrel_service", :clean) if RUBY_PLATFORM =~ /mswin/
end
@@ -187,39 +200,37 @@ namespace :site do
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-#{e.version}-mswin32.gem pkg/gems/"
- # sh "cp ~/Downloads/mongrel_service-0.3.3-mswin32.gem pkg/gems/"
+
sh "rm -rf pkg/mongrel*"
- sh "gem generate_index -d pkg"
- sh "scp -r CHANGELOG pkg/* rubyforge.org:/var/www/gforge-projects/mongrel/releases/"
+ sh "gem generate_index -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"
+ 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
- # Requires the 'webgem' gem and the 'atom-tools' gem
- sh "cd site; webgen; webgen; ruby atom.rb > output/feed.atom; rsync -azv --no-perms --no-times output/* rubyforge.org:/var/www/gforge-projects/mongrel/"
+ # Requires the 'webgem' gem
+ sh "cd site; webgen; webgen; curl 'http://feed43.com/mongrel.xml' > output/rss.xml; rsync -azv --no-perms --no-times output/* rubyforge.org:/var/www/gforge-projects/mongrel/"
+ puts "\nMake sure to re-run the site update 6 hours later if you updated the news. This delay is required for Feed43 to pick up the site changes."
end
-
+
desc "Upload the rdocs"
task :rdoc => [:doc] do
sh "rsync -azv --no-perms --no-times doc/* rubyforge.org:/var/www/gforge-projects/mongrel/rdoc/"
sh "cd projects/gem_plugin; rake site:rdoc"
end
-
+
desc "Upload the coverage report"
task :coverage => [:rcov] do
sh "rsync -azv --no-perms --no-times test/coverage/* rubyforge.org:/var/www/gforge-projects/mongrel/coverage/" rescue nil
end
-
+
desc "Upload the website, the rdocs, and the coverage report"
task :all => [:clean, :web, :rdoc, :coverage]
-
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.