#!/usr/bin/env ruby require 'rubygems' require 'bundler' gitaly_dir = 'tmp/tests/gitaly' gitaly_ruby_bundle_path = File.expand_path(File.join('..', gitaly_dir, 'ruby', 'vendor', 'ruby', '2.3.0'), __dir__) 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 puts "Bundler.bundle_path in #{Dir.pwd}" puts Bundler.with_clean_env { Bundler.bundle_path } bundle_path = 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` puts "Bundler.bundle_path in #{File.join(gitaly_dir, 'ruby')}" puts Bundler.with_clean_env { Bundler.bundle_path } bundle_path = Bundler.with_clean_env { Bundler.bundle_path } end env = { 'HOME' => File.expand_path('tmp/tests'), # 'GEM_PATH' => gitaly_ruby_gem_path, 'GEM_PATH' => Gem.path.join(':'), 'BUNDLE_PATH' => gitaly_ruby_bundle_path } puts "env:" p env args = %W[#{gitaly_dir}/gitaly #{gitaly_dir}/config.toml] # Print the PID of the spawned process puts Bundler.with_clean_env { spawn(env, *args, [:out, :err] => 'log/gitaly-test.log') }