Changeset 227

Show
Ignore:
Timestamp:
08/07/06 09:16:37 (2 years ago)
Author:
blackhedd
Message:

started support for a pire-ruby version with the same API,
to be installed parallel to the extension.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • version_0/ext/rubymain.cpp

    r215 r227  
    213213        evma_signal_loopbreak(); 
    214214        return Qnil; 
     215} 
     216 
     217/************** 
     218t_library_type 
     219**************/ 
     220 
     221static VALUE t_library_type (VALUE self) 
     222{ 
     223        return rb_eval_string (":extension"); 
    215224} 
    216225 
     
    241250        rb_define_module_function (EmModule, "stop", (VALUE(*)(...))t_stop, 0); 
    242251        rb_define_module_function (EmModule, "signal_loopbreak", (VALUE(*)(...))t_signal_loopbreak, 0); 
     252        rb_define_module_function (EmModule, "library_type", (VALUE(*)(...))t_library_type, 0); 
    243253 
    244254        rb_define_module_function (EmModule, "get_peername", (VALUE(*)(...))t_get_peername, 1); 
  • version_0/lib/eventmachine.rb

    r222 r227  
    3535#  
    3636 
    37 require 'rubyeventmachine' 
     37 
     38#-- Select in a library based on a global variable. 
     39case $eventmachine_library 
     40when :pure_ruby 
     41  require 'pr_eventmachine' 
     42when :extension 
     43  require 'rubyeventmachine' 
     44else 
     45  # This is the case that most user code will take. 
     46  # Prefer the extension is available. 
     47  begin 
     48    require 'rubyeventmachine' 
     49  rescue LoadError 
     50    require 'pr_eventmachine' 
     51  end 
     52end 
     53 
     54 
     55require "eventmachine_version" 
    3856require 'em/deferrable' 
    3957#-- Additional requires are at the BOTTOM of this file, because they 
    4058#-- depend on stuff defined in here. Refactor that someday. 
     59 
    4160 
    4261 
     
    137156module EventMachine 
    138157 
    139   VERSION = "0.7.0" 
    140158 
    141159  # EventMachine::run initializes and runs an event loop. 
  • version_0/Rakefile

    r213 r227  
    2525 
    2626$: << "lib" 
    27 require 'eventmachine
     27require 'eventmachine_version
    2828$version = EventMachine::VERSION 
    2929$distdir  = "eventmachine-#$version" 
     
    106106end 
    107107 
    108 desc "Run the tests for #$name." 
    109 task :test do |t| 
     108 
     109 
     110# This is used by three rake tasks, that parameterize the 
     111# behavior with a global variable. This way we can test 
     112# the extension and non-extension versions with the same tests. 
     113test_runner = proc {|t, libr| 
    110114  require 'test/unit/testsuite' 
    111115  require 'test/unit/ui/console/testrunner' 
     
    113117  runner = Test::Unit::UI::Console::TestRunner 
    114118 
     119  $eventmachine_library = libr 
    115120  $LOAD_PATH.unshift('tests') 
    116121  $stderr.puts "Checking for test cases:" if t.verbose 
    117   Dir['tests/tc_*.rb'].each do |testcase| 
     122  Dir['tests/test_*.rb'].each do |testcase| 
    118123    $stderr.puts "\t#{testcase}" if t.verbose 
    119124    load testcase 
     
    127132 
    128133  runner.run(suite) 
     134} 
     135 
     136desc "Run tests for #$name." 
     137task :test do |t| 
     138  test_runner.call t, nil 
     139end 
     140 
     141desc "Run pure-ruby tests for #$name." 
     142task :testpr do |t| 
     143  test_runner.call t, :pure_ruby 
     144end 
     145 
     146desc "Run extension tests for #$name." 
     147task :testext do |t| 
     148  test_runner.call t, :extension 
    129149end 
    130150