2018-11-03 02:07:56 +03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-06-01 12:49:40 +03:00
|
|
|
require_relative "shared_helpers"
|
2018-11-03 02:07:56 +03:00
|
|
|
|
|
|
|
if Bundler::SharedHelpers.in_bundle?
|
2019-06-01 12:49:40 +03:00
|
|
|
require_relative "../bundler"
|
2018-11-03 02:07:56 +03:00
|
|
|
|
|
|
|
if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"]
|
|
|
|
begin
|
2019-11-11 11:57:45 +03:00
|
|
|
Bundler.ui.silence { Bundler.setup }
|
2018-11-03 02:07:56 +03:00
|
|
|
rescue Bundler::BundlerError => e
|
2021-07-26 16:21:18 +03:00
|
|
|
Bundler.ui.error e.message
|
2019-04-14 09:01:35 +03:00
|
|
|
Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
|
2018-11-03 02:07:56 +03:00
|
|
|
if e.is_a?(Bundler::GemNotFound)
|
2023-03-02 21:11:19 +03:00
|
|
|
suggested_cmd = "bundle install"
|
|
|
|
original_gemfile = Bundler.original_env["BUNDLE_GEMFILE"]
|
|
|
|
suggested_cmd += " --gemfile #{original_gemfile}" if original_gemfile
|
|
|
|
Bundler.ui.warn "Run `#{suggested_cmd}` to install missing gems."
|
2018-11-03 02:07:56 +03:00
|
|
|
end
|
|
|
|
exit e.status_code
|
|
|
|
end
|
|
|
|
else
|
2019-11-11 11:57:45 +03:00
|
|
|
Bundler.ui.silence { Bundler.setup }
|
2018-11-03 02:07:56 +03:00
|
|
|
end
|
2019-12-18 08:53:19 +03:00
|
|
|
|
|
|
|
# We might be in the middle of shelling out to rubygems
|
|
|
|
# (RUBYOPT=-rbundler/setup), so we need to give rubygems the opportunity of
|
|
|
|
# not being silent.
|
|
|
|
Gem::DefaultUserInteraction.ui = nil
|
2018-11-03 02:07:56 +03:00
|
|
|
end
|