summaryrefslogtreecommitdiff
path: root/scripts/gitaly-test-spawn
blob: 54313c7fe872641a81af16f3ed4da7afe657f0af (plain)
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
#!/usr/bin/env ruby

gitaly_dir = 'tmp/tests/gitaly'

puts "Gem.path: #{Gem.path.inspect}"
puts "ENV['BUNDLE_GEMFILE']: #{ENV['BUNDLE_GEMFILE'].inspect}"
puts "ENV['RUBYOPT']: #{ENV['RUBYOPT'].inspect}"

puts "bundle config in #{Dir.pwd}"
puts `bundle config`

puts "Reading ../.bundle/config"
puts File.read('../.bundle/config') rescue nil
puts "Reading ~/.bundle/config"
puts File.read(File.expand_path('~/.bundle/config')) rescue nil

Dir.chdir(File.join(gitaly_dir, 'ruby')) do
  puts "Reading #{File.join(gitaly_dir, 'ruby')}/.bundle/config"
  puts File.read('.bundle/config') rescue nil
  puts "bundle config in #{File.join(gitaly_dir, 'ruby')}"
  puts `bundle config`
end

env = {
  'HOME' => File.expand_path('tmp/tests')
}
args = %W[#{gitaly_dir}/gitaly #{gitaly_dir}/config.toml]

require 'rubygems'
require 'bundler'

# Print the PID of the spawned process
puts Bundler.with_clean_env { spawn(env, *args, [:out, :err] => 'log/gitaly-test.log') }