update tests for Rack 1.4.1
[unicorn.git] / script / isolate_for_tests
blobdbf596cef8cae28ac00ec1788f23954e5d933e94
1 #!/usr/bin/env ruby
2 # scripts/Makefiles can read and eval the output of this script and
3 # use it as RUBYLIB
4 require 'rubygems'
5 require 'isolate'
6 fp = File.open(__FILE__, "rb")
7 fp.flock(File::LOCK_EX)
9 ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
10 opts = {
11 :system => false,
12 # we want "ruby-1.8.7" and not "ruby-1.8", so disable :multiruby
13 :multiruby => false,
14 :path => "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}",
17 pid = fork do
18 Isolate.now!(opts) do
19 gem 'sqlite3-ruby', '1.2.5'
20 gem 'raindrops', '0.8.0'
21 gem 'kgio-monkey', '0.3.0'
22 gem 'kgio', '2.6.0'
23 gem 'rack', '1.4.1'
24 end
25 end
26 _, status = Process.waitpid2(pid)
27 status.success? or abort status.inspect
28 lib_paths = Dir["#{opts[:path]}/gems/*-*/lib"].map { |x| File.expand_path(x) }
29 dst = "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}.mk"
30 File.open("#{dst}.#$$", "w") do |fp|
31 fp.puts "ISOLATE_LIBS=#{lib_paths.join(':')}"
32 end
33 File.rename("#{dst}.#$$", dst)
35 # pure Ruby gems can be shared across all Rubies
36 %w(3.0.0).each do |rails_ver|
37 opts[:path] = "tmp/isolate/rails-#{rails_ver}"
38 pid = fork do
39 Isolate.now!(opts) do
40 gem 'rake', '0.8.7'
41 gem 'rails', rails_ver
42 end
43 end
44 _, status = Process.waitpid2(pid)
45 status.success? or abort status.inspect
46 more = Dir["#{opts[:path]}/gems/*-*/lib"].map { |x| File.expand_path(x) }
47 lib_paths.concat(more)
48 end