| 1 |
require 'rake' |
|---|
| 2 |
require 'rake/testtask' |
|---|
| 3 |
require 'rake/clean' |
|---|
| 4 |
require 'rake/gempackagetask' |
|---|
| 5 |
require 'rake/rdoctask' |
|---|
| 6 |
require 'tools/rakehelp' |
|---|
| 7 |
require 'fileutils' |
|---|
| 8 |
include FileUtils |
|---|
| 9 |
|
|---|
| 10 |
setup_tests |
|---|
| 11 |
setup_clean ["ext/http11/*.{bundle,so,obj,pdb,lib,def,exp}", "ext/http11/Makefile", "pkg", "lib/*.bundle", "*.gem", "doc/site/output", ".config"] |
|---|
| 12 |
|
|---|
| 13 |
setup_rdoc ['README', 'LICENSE', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc', 'ext/http11/http11.c'] |
|---|
| 14 |
|
|---|
| 15 |
desc "Does a full compile, test run" |
|---|
| 16 |
task :default => [:compile, :test] |
|---|
| 17 |
|
|---|
| 18 |
desc "Compiles all extensions" |
|---|
| 19 |
task :compile => [:http11] do |
|---|
| 20 |
if Dir.glob(File.join("lib","http11.*")).length == 0 |
|---|
| 21 |
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
|---|
| 22 |
STDERR.puts "Gem actually failed to build. Your system is" |
|---|
| 23 |
STDERR.puts "NOT configured properly to build Mongrel." |
|---|
| 24 |
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
|---|
| 25 |
exit(1) |
|---|
| 26 |
end |
|---|
| 27 |
end |
|---|
| 28 |
|
|---|
| 29 |
task :package => [:clean,:compile,:test,:rerdoc] |
|---|
| 30 |
|
|---|
| 31 |
task :ragel do |
|---|
| 32 |
sh %{/usr/local/bin/ragel ext/http11/http11_parser.rl | /usr/local/bin/rlcodegen -G2 -o ext/http11/http11_parser.c} |
|---|
| 33 |
end |
|---|
| 34 |
|
|---|
| 35 |
task :site_webgen do |
|---|
| 36 |
sh %{pushd doc/site; webgen; ruby atom.rb > output/feed.atom; rsync -azv output/* rubyforge.org:/var/www/gforge-projects/mongrel/; popd } |
|---|
| 37 |
end |
|---|
| 38 |
|
|---|
| 39 |
task :site_rdoc do |
|---|
| 40 |
sh %{ rsync -azv doc/rdoc/* rubyforge.org:/var/www/gforge-projects/mongrel/rdoc/ } |
|---|
| 41 |
end |
|---|
| 42 |
|
|---|
| 43 |
task :site_coverage => [:rcov] do |
|---|
| 44 |
sh %{ rsync -azv test/coverage/* rubyforge.org:/var/www/gforge-projects/mongrel/coverage/ } |
|---|
| 45 |
end |
|---|
| 46 |
|
|---|
| 47 |
task :site_projects_rdoc do |
|---|
| 48 |
sh %{ cd projects/gem_plugin; rake site } |
|---|
| 49 |
end |
|---|
| 50 |
|
|---|
| 51 |
task :site => [:site_webgen, :site_rdoc, :site_coverage, :site_projects_rdoc] |
|---|
| 52 |
|
|---|
| 53 |
setup_extension("http11", "http11") |
|---|
| 54 |
|
|---|
| 55 |
name="mongrel" |
|---|
| 56 |
version="1.0.1" |
|---|
| 57 |
|
|---|
| 58 |
setup_gem(name, version) do |spec| |
|---|
| 59 |
spec.summary = "A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps." |
|---|
| 60 |
spec.description = spec.summary |
|---|
| 61 |
spec.test_files = Dir.glob('test/test_*.rb') |
|---|
| 62 |
spec.author="Zed A. Shaw" |
|---|
| 63 |
spec.executables=['mongrel_rails'] |
|---|
| 64 |
spec.files += %w(ext/http11/MANIFEST README Rakefile setup.rb lib/mongrel/mime_types.yml) |
|---|
| 65 |
|
|---|
| 66 |
spec.required_ruby_version = '>= 1.8.4' |
|---|
| 67 |
|
|---|
| 68 |
if RUBY_PLATFORM =~ /mswin/ |
|---|
| 69 |
spec.files += ['lib/http11.so'] |
|---|
| 70 |
spec.extensions.clear |
|---|
| 71 |
spec.platform = Gem::Platform::WIN32 |
|---|
| 72 |
else |
|---|
| 73 |
spec.add_dependency('daemons', '>= 1.0.3') |
|---|
| 74 |
spec.add_dependency('fastthread', '>= 0.6.2') |
|---|
| 75 |
end |
|---|
| 76 |
|
|---|
| 77 |
spec.add_dependency('gem_plugin', '>= 0.2.2') |
|---|
| 78 |
spec.add_dependency('cgi_multipart_eof_fix', '>= 1.0.0') |
|---|
| 79 |
end |
|---|
| 80 |
|
|---|
| 81 |
task :install do |
|---|
| 82 |
sub_project("gem_plugin", :install) |
|---|
| 83 |
sub_project("fastthread", :install) |
|---|
| 84 |
sh %{rake package} |
|---|
| 85 |
sh %{gem install pkg/mongrel-#{version}} |
|---|
| 86 |
sub_project("mongrel_status", :install) |
|---|
| 87 |
sub_project("mongrel_upload_progress", :install) |
|---|
| 88 |
sub_project("mongrel_console", :install) |
|---|
| 89 |
sub_project("mongrel_cluster", :install) |
|---|
| 90 |
if RUBY_PLATFORM =~ /mswin/ |
|---|
| 91 |
sub_project("mongrel_service", :install) |
|---|
| 92 |
end |
|---|
| 93 |
end |
|---|
| 94 |
|
|---|
| 95 |
task :uninstall => [:clean] do |
|---|
| 96 |
sub_project("mongrel_status", :uninstall) |
|---|
| 97 |
sub_project("mongrel_upload_progress", :uninstall) |
|---|
| 98 |
sub_project("mongrel_console", :uninstall) |
|---|
| 99 |
sh %{gem uninstall mongrel} |
|---|
| 100 |
sub_project("gem_plugin", :uninstall) |
|---|
| 101 |
sub_project("fastthread", :uninstall) |
|---|
| 102 |
if RUBY_PLATFORM =~ /mswin/ |
|---|
| 103 |
sub_project("mongrel_service", :install) |
|---|
| 104 |
end |
|---|
| 105 |
end |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
task :gem_source do |
|---|
| 109 |
mkdir_p "pkg/gems" |
|---|
| 110 |
|
|---|
| 111 |
FileList["**/*.gem"].each { |gem| mv gem, "pkg/gems" } |
|---|
| 112 |
FileList["pkg/*.tgz"].each {|tgz| rm tgz } |
|---|
| 113 |
rm_rf "pkg/#{name}-#{version}" |
|---|
| 114 |
|
|---|
| 115 |
sh %{ index_gem_repository.rb -d pkg } |
|---|
| 116 |
sh %{ scp -r ChangeLog pkg/* rubyforge.org:/var/www/gforge-projects/mongrel/releases/ } |
|---|
| 117 |
end |
|---|