unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob 7b3dd0b5e04563aaed4fd49db48ee7599040721e 1418 bytes (raw)
$ git show v4.2.1:script/isolate_for_tests	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
#!/usr/bin/env ruby
# scripts/Makefiles can read and eval the output of this script and
# use it as RUBYLIB
require 'rubygems'
require 'isolate'
fp = File.open(__FILE__, "rb")
fp.flock(File::LOCK_EX)

ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
opts = {
  :system => false,
  # we want "ruby-1.8.7" and not "ruby-1.8", so disable :multiruby
  :multiruby => false,
  :path => "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}",
}

pid = fork do
  Isolate.now!(opts) do
    if RUBY_VERSION.to_f < 2.0
      gem 'sqlite3-ruby', '1.2.5'
    end
    gem 'raindrops', '0.8.0'
    gem 'kgio-monkey', '0.3.0'
    gem 'kgio', '2.7.4'
    gem 'rack', '1.4.1'
  end
end
_, status = Process.waitpid2(pid)
status.success? or abort status.inspect
lib_paths = Dir["#{opts[:path]}/gems/*-*/lib"].map { |x| File.expand_path(x) }
dst = "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}.mk"
File.open("#{dst}.#$$", "w") do |fp|
  fp.puts "ISOLATE_LIBS=#{lib_paths.join(':')}"
end
File.rename("#{dst}.#$$", dst)

# pure Ruby gems can be shared across all Rubies
%w(3.0.0).each do |rails_ver|
  opts[:path] = "tmp/isolate/rails-#{rails_ver}"
  pid = fork do
    Isolate.now!(opts) do
      gem 'rake', '0.8.7'
      gem 'rails', rails_ver
    end
  end
  _, status = Process.waitpid2(pid)
  status.success? or abort status.inspect
  more = Dir["#{opts[:path]}/gems/*-*/lib"].map { |x| File.expand_path(x) }
  lib_paths.concat(more)
end

git clone https://yhbt.net/unicorn.git