diff options
author | The Bundler Bot <bot@bundler.io> | 2017-07-08 07:36:11 +0000 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-07-17 12:28:04 -0500 |
commit | 9225b3b19d0aff13628a26c199894b5f4246e62f (patch) | |
tree | 554e007902a2054d4dabcc498afb0b7ff665465f | |
parent | 94d2057d39238e1adc1939f2788fcb9c09a1f8f7 (diff) | |
download | bundler-9225b3b19d0aff13628a26c199894b5f4246e62f.tar.gz |
Auto merge of #5848 - bundler:seg-inline-bundle-bin, r=colby-swandale
[Inline] Work when BUNDLE_BIN is set
### What was the end-user problem that led to this PR?
The problem was that `bundler/inline` would fail when `$BUNDLE_BIN` was set.
Closes #5847.
### What was your diagnosis of the problem?
My diagnosis was we needed to skip installing binstubs when doing an inline install.
### What is your fix for the problem, implemented in this PR?
My fix sets a temporary setting for `:inline` and skips installing binstubs when that's true.
### Why did you choose this fix out of the possible options?
I chose this fix because it was minimally intrusive.
(cherry picked from commit 1075e4454c771782c7a00dda676d17bcca66d401)
# Conflicts:
# lib/bundler/installer.rb
# spec/quality_spec.rb
-rw-r--r-- | lib/bundler/inline.rb | 8 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 2 | ||||
-rw-r--r-- | lib/bundler/installer/gem_installer.rb | 1 | ||||
-rw-r--r-- | spec/bundler/installer/gem_installer_spec.rb | 3 | ||||
-rw-r--r-- | spec/quality_spec.rb | 1 | ||||
-rw-r--r-- | spec/runtime/inline_spec.rb | 15 |
6 files changed, 25 insertions, 5 deletions
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 4d3791bfb2..38dcda6b5b 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -60,9 +60,11 @@ def gemfile(install = false, options = {}, &gemfile) Bundler.ui = ui if install if install || missing_specs.call - installer = Bundler::Installer.install(Bundler.root, definition, :system => true, :inline => true) - installer.post_install_messages.each do |name, message| - Bundler.ui.info "Post-install message from #{name}:\n#{message}" + Bundler.settings.temporary(:inline => true) 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}" + end end end diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index a1d864e67d..bce0e46393 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -212,7 +212,7 @@ module Bundler end def resolve_if_need(options) - if !options["update"] && !options[:inline] && !options["force"] && Bundler.default_lockfile.file? + if !options["update"] && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file? local = Bundler.ui.silence do begin tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil) diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb index 10e7c7fcd7..a4d9bcaa07 100644 --- a/lib/bundler/installer/gem_installer.rb +++ b/lib/bundler/installer/gem_installer.rb @@ -65,6 +65,7 @@ module Bundler end def generate_executable_stubs + return if Bundler.settings[:inline] if Bundler.settings[:bin] && standalone installer.generate_standalone_bundler_executable_stubs(spec) elsif Bundler.settings[:bin] diff --git a/spec/bundler/installer/gem_installer_spec.rb b/spec/bundler/installer/gem_installer_spec.rb index de5189eecd..e2f30cdd70 100644 --- a/spec/bundler/installer/gem_installer_spec.rb +++ b/spec/bundler/installer/gem_installer_spec.rb @@ -19,8 +19,9 @@ RSpec.describe Bundler::GemInstaller do context "spec_settings is build option" do it "invokes install method with build_args", :rubygems => ">= 2" do allow(Bundler.settings).to receive(:[]).with(:bin) + allow(Bundler.settings).to receive(:[]).with(:inline) allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy") - allow(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy"]) + expect(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy"]) subject.install_from_spec end end diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index c2a4ae536b..f2853a5d54 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -195,6 +195,7 @@ RSpec.describe "The library itself" do exemptions = %w( gem.coc gem.mit + inline warned_version ) diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index 022b123dc3..e816799d08 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -250,4 +250,19 @@ RSpec.describe "bundler/inline#gemfile" do expect(err).to be_empty expect(exitstatus).to be_zero if exitstatus end + + it "installs inline gems when BUNDLE_BIN is set" do + ENV["BUNDLE_BIN"] = "/usr/local/bundle/bin" + + script <<-RUBY + gemfile do + source "file://#{gem_repo1}" + gem "rack" # has the rackup executable + end + + puts RACK + RUBY + expect(exitstatus).to eq(0) if exitstatus + expect(out).to eq "1.0.0" + end end |