diff --git a/internal/linguist/linguist.go b/internal/linguist/linguist.go index 9c7feeb2f78c9d5b9e47a5365a93bbf193646346..d2d1d3c17dc969984cfce844bf57bb90665857f9 100644 --- a/internal/linguist/linguist.go +++ b/internal/linguist/linguist.go @@ -86,6 +86,8 @@ func openLanguagesJSON() (io.ReadCloser, error) { rubyScript := `FileUtils.ln_sf(Bundler.rubygems.find_name('github-linguist').first.full_gem_path, ARGV.first)` cmd := exec.Command("bundle", "exec", "ruby", "-rfileutils", "-e", rubyScript, linguistPathSymlink.Name()) cmd.Dir = config.Config.Ruby.Dir + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { if exitError, ok := err.(*exec.ExitError); ok { diff --git a/ruby/Gemfile b/ruby/Gemfile index 2b752992fecdf62c258337e619aaa24e9dc6019d..9b6924f86d051181aab8d071db1ac5be79ab35ea 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -1,5 +1,6 @@ source 'https://rubygems.org' +gem 'bundler', '~> 1.16.4' gem 'rugged', '~> 0.27.4' gem 'github-linguist', '~> 6.1', require: 'linguist' gem 'gitlab-markup', '~> 1.6.4' diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index d76ba86c398adf51853bc27336484f860550d830..d7071aa9617feef00c667f226561fc7cf2fa96eb 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -146,6 +146,7 @@ PLATFORMS DEPENDENCIES activesupport (~> 5.0.2) + bundler (~> 1.16.4) faraday (~> 0.12) gitaly-proto (~> 0.116.0) github-linguist (~> 6.1) @@ -162,4 +163,4 @@ DEPENDENCIES sentry-raven (~> 2.7.2) BUNDLED WITH - 1.16.4 + 1.16.6 diff --git a/ruby/spec/integration_helper.rb b/ruby/spec/integration_helper.rb index 57e22b9b63cc8b38186bada03ca6cd4c79bcc4fb..4ac7c0e92ab63c40479c560bc95376cc6c7a6765 100644 --- a/ruby/spec/integration_helper.rb +++ b/ruby/spec/integration_helper.rb @@ -42,8 +42,20 @@ def start_gitaly test_log = File.join(TMP_DIR, 'gitaly-rspec-test.log') options = { out: test_log, err: test_log, chdir: TMP_DIR } - gitaly_pid = spawn(File.join(build_dir, 'bin/gitaly'), config_path, options) + gemfile = File.expand_path('../../Gemfile', __FILE__) + env = { + 'GEM_PATH' => Gem.path.join(':'), + 'BUNDLE_APP_CONFIG' => File.join(File.dirname(gemfile), '.bundle/config'), + 'BUNDLE_GEMFILE' => gemfile, + 'RUBYOPT' => nil + } + + gitaly_pid = spawn(env, File.join(build_dir, 'bin/gitaly'), config_path, options) + +sleep 1; spawn("tail -f #{test_log}") + at_exit { Process.kill('KILL', gitaly_pid) } + wait_ready!(File.join('tmp', SOCKET_PATH)) end