summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2022-08-19 14:03:43 +0200
committergit <[email protected]>2022-08-21 17:54:11 +0900
commit560941e711bed8e8cdd0183b76d9e2057cce6806 (patch)
tree212894e36eeba163f779a32e524ad68a2f9b2189
parentb87ddd7538220e9782274281356fd55bfd29078b (diff)
[rubygems/rubygems] Fix edge case where `bundler/inline` unintentionally skips install
If the application has the `no_install` setting set for `bundle package`, then `bundler/inline` would silently skip installing any gems. https://github.com/rubygems/rubygems/commit/7864f49b27
-rw-r--r--lib/bundler/inline.rb2
-rw-r--r--spec/bundler/runtime/inline_spec.rb14
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index 8ef580f1f0..25e055fbe4 100644
--- a/lib/bundler/inline.rb
+++ b/lib/bundler/inline.rb
@@ -54,7 +54,7 @@ def gemfile(install = false, options = {}, &gemfile)
Bundler.ui = install ? ui : Bundler::UI::Silent.new
if install || definition.missing_specs?
- Bundler.settings.temporary(:inline => true) do
+ Bundler.settings.temporary(:inline => true, :no_install => false) do
installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
installer.post_install_messages.each do |name, message|
Bundler.ui.info "Post-install message from #{name}:\n#{message}"
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index dd22c86f90..e3cf5020ec 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -355,6 +355,20 @@ RSpec.describe "bundler/inline#gemfile" do
expect(err).to be_empty
end
+ it "still installs if the application has `bundle package` no_install config set" do
+ bundle "config set --local no_install true"
+
+ script <<-RUBY
+ gemfile do
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ end
+ RUBY
+
+ expect(last_command).to be_success
+ expect(system_gem_path("gems/rack-1.0.0")).to exist
+ end
+
it "preserves previous BUNDLE_GEMFILE value" do
ENV["BUNDLE_GEMFILE"] = ""
script <<-RUBY