root/trunk/tasks/project.rake

Revision 788, 2.6 kB (checked in by raggi, 8 months ago)

Merge of branches/raggi
Most notable work and patches by Aman Gupta, Roger Pack, and James Tucker.
Patches / Tickets also submitted by: Jeremy Evans, aanand, darix, mmmurf,
danielaquino, macournoyer.

  • Moved docs into docs/ dir
  • Major refactor of rakefile, added generic rakefile helpers in tasks
  • Added example CPP build rakefile in tasks/cpp.rake
  • Moved rake tests out to tasks/tests.rake
  • Added svn ignores where appropriate
  • Fixed jruby build on older java platforms
  • Gem now builds from Rakefile rather than directly via extconf
  • Gem unified for jruby, C++ and pure ruby.
  • Correction for pure C++ build, removing ruby dependency
  • Fix for CYGWIN builds on ipv6
  • Major refactor for extconf.rb
  • Working mingw builds
  • extconf optionally uses pkg_config over manual configuration
  • extconf builds for 1.9 on any system that has 1.9
  • extconf no longer links pthread explicitly
  • looks for kqueue on all *nix systems
  • better error output on std::runtime_error, now says where it came from
  • Fixed some tests on jruby
  • Added test for general send_data flaw, required for a bugfix in jruby build
  • Added timeout to epoll tests
  • Added fixes for java reactor ruby api
  • Small addition of some docs in httpclient.rb and httpcli2.rb
  • Some refactor and fixes in smtpserver.rb
  • Added parenthesis where possible to avoid excess ruby warnings
  • Refactor of $eventmachine_library logic for accuracy and maintenance, jruby
  • EM::start_server now supports unix sockets
  • EM::connect now supports unix sockets
  • EM::defer @threadqueue now handled more gracefully
  • Added better messages on exceptions raised
  • Fix edge case in timer fires
  • Explicitly require buftok.rb
  • Add protocols to autoload, rather than require them all immediately
  • Fix a bug in pr_eventmachine for outbound_q
  • Refactors to take some of the use of defer out of tests.
  • Fixes in EM.defer under start/stop conditions. Reduced scope of threads.
Line 
1 require 'rake/gempackagetask'
2 require 'rake/rdoctask'
3 require 'rake/clean'
4
5 # monkey bitchin' for windows stuffs...
6 module FileUtils
7   # If any of these methods ever clobber, try removing them.
8   # Hopefully they'll do something semantically similar.
9   abort "Err: #{__FILE__}:#{__LINE__} monkey patch windows? clobbers!" unless instance_methods.grep(/windows\?/).empty?
10   abort "Err: #{__FILE__}:#{__LINE__} monkey patch sudo clobbers!" unless instance_methods.grep(/sudo/).empty?
11   abort "Err: #{__FILE__}:#{__LINE__} monkey patch gem_cmd clobbers!" unless instance_methods.grep(/gem_cmd/).empty?
12   def windows?; RUBY_PLATFORM =~ /mswin|mingw/; end
13   def sudo(cmd)
14     if windows? || (require 'etc'; Etc.getpwuid.uid == 0)
15       sh cmd
16     else
17       sh "sudo #{cmd}"
18     end
19   end
20   def gem_cmd(action, name, *args)
21     rb = Gem.ruby rescue nil
22     rb ||= (require 'rbconfig'; File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']))
23     sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'"
24   end
25 end
26
27
28 # Setup our packaging tasks, we're just jacking the builtins.
29 Rake::GemPackageTask.new(Spec) do |pkg|
30   pkg.need_tar, pkg.need_tar_gz, pkg.need_zip = true, true, true if Package
31   pkg.gem_spec = Spec
32 end
33 Rake::Task[:clean].enhance [:clobber_package]
34
35 # Only generate rdoc if the spec says so, again, jack the builtins.
36 if Spec.has_rdoc
37   Rake::RDocTask.new do |rd|
38     rd.title = Spec.name
39     rd.rdoc_dir = 'rdoc'
40     rd.main = "docs/README" if test ?e, "docs/README"
41     rd.rdoc_files.include("lib/**/*.rb", *Spec.extra_rdoc_files)
42   end
43   Rake::Task[:clean].enhance [:clobber_rdoc]
44
45   desc 'Generate and open documentation'
46   task :docs => :rdoc do
47     case RUBY_PLATFORM
48     when /darwin/       ; sh 'open rdoc/index.html'
49     when /mswin|mingw/  ; sh 'start rdoc\index.html'
50     else
51       sh 'firefox rdoc/index.html'
52     end
53   end
54 end
55
56 if Spec.default_executable
57   desc "Run #{Spec.default_executable}"
58   task :run do ruby File.join(Spec.bindir, Spec.default_executable) end
59 end
60
61 require 'rubygems'
62
63 desc 'Install gem (and sudo if required)'
64 task :install => :package do
65   gem_cmd(:install, "pkg/#{Spec.name}-#{Spec.version}.gem")
66 end
67
68 desc 'Uninstall gem (and sudo if required)'
69 task :uninstall do
70   gem_cmd(:uninstall, "#{Spec.name}", "-v=#{Spec.version}")
71 end
72
73 # Find an scm's store directory, if we do, make a task to commit to it only
74 # after running all the tests (successfully).
75 if scm = %w(git svn bzr hg).find { |d| File.directory? ".#{d}" }
76   desc "Run tests then commit to #{scm}"
77   task :commit => :test do sh "#{scm} commit" end
78 end
Note: See TracBrowser for help on using the browser.