diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-10-15 13:20:25 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-10-15 17:19:02 +0900 |
commit | d386a58f6f1865aaa35eda5af55cff3ff3cca4ca (patch) | |
tree | 0665fe806540deae7f8e52095af6dba70f940aa3 /lib/bundler/rubygems_integration.rb | |
parent | 7ffd14a18c341565afaf80d259f9fe5df8a13d29 (diff) |
Merge bundler-2.2.0.rc.2
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3659
Diffstat (limited to 'lib/bundler/rubygems_integration.rb')
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 9256fa274c..17402f16f2 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -313,8 +313,13 @@ module Bundler end message = if spec.nil? + target_file = begin + Bundler.default_gemfile.basename + rescue GemfileNotFound + "inline Gemfile" + end "#{dep.name} is not part of the bundle." \ - " Add it to your #{Bundler.default_gemfile.basename}." + " Add it to your #{target_file}." else "can't activate #{dep}, already activated #{spec.full_name}. " \ "Make sure all dependencies are added to Gemfile." @@ -406,6 +411,17 @@ module Bundler # Replace or hook into RubyGems to provide a bundlerized view # of the world. def replace_entrypoints(specs) + specs_by_name = add_default_gems_to(specs) + + replace_gem(specs, specs_by_name) + stub_rubygems(specs) + replace_bin_path(specs_by_name) + + Gem.clear_paths + end + + # Add default gems not already present in specs, and return them as a hash. + def add_default_gems_to(specs) specs_by_name = specs.reduce({}) do |h, s| h[s.name] = s h @@ -420,11 +436,7 @@ module Bundler specs_by_name[default_spec_name] = default_spec end - replace_gem(specs, specs_by_name) - stub_rubygems(specs) - replace_bin_path(specs_by_name) - - Gem.clear_paths + specs_by_name end def undo_replacements |