Skip to content

Commit

Permalink
inform user about bundler problem
Browse files Browse the repository at this point in the history
  • Loading branch information
CamJN committed Dec 6, 2024
1 parent 55ba110 commit 1255dc5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,17 @@ def run_load_path_setup_code(options)
#
# The existence of Gemfile/gems.rb indicates whether (2) is true:
elsif File.exist?('Gemfile') || File.exist?('gems.rb')
# Bundler 2.5.12+ throws a hissy fit if you don't have the
# version of bundler installed with which the Gemfile.lock was
# created. This causes extremely inscrutible error messages such
# as `/usr/bin/ruby doesn't exist`, so we cause RubyGems to raise
# an intelligible error here instead.
if File.exist?('Gemfile.lock')
lockfile_contents = File.read('Gemfile.lock').lines.map(&:strip)
index = lockfile_contents.index 'BUNDLED WITH'
bundler_version = lockfile_contents[index + 1] unless index.nil?
found = Gem::Specification.find_by_name('bundler', "= #{bundler_version}") unless bundler_version.nil?
end
# In case of Rails 3+, config/boot.rb already calls Bundler.setup.
# However older versions of Rails may not so loading boot.rb might
# not be the correct thing to do. To be on the safe side we
Expand Down

0 comments on commit 1255dc5

Please sign in to comment.