summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-07-07 12:43:57 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-07-07 17:45:23 -0500
commit50322e351af752f2577b692e654bcf0b9716a5e9 (patch)
treea5d13818b73d62dc6d291c291a95201abf50f96c
parent59190fa216210b9f236128b58dea8fd4e45f3be8 (diff)
downloadbundler-seg-inline-bundle-bin.tar.gz
[Inline] Work when BUNDLE_BIN is setseg-inline-bundle-bin
-rw-r--r--lib/bundler/inline.rb8
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--lib/bundler/installer/gem_installer.rb1
-rw-r--r--spec/bundler/installer/gem_installer_spec.rb3
-rw-r--r--spec/quality_spec.rb1
-rw-r--r--spec/runtime/inline_spec.rb15
6 files changed, 25 insertions, 5 deletions
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index 7a4a1b0801..00457d604a 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 2085f65db6..78a73eeedd 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -247,7 +247,7 @@ module Bundler
end
def resolve_if_needed(options)
- if !options["update"] && !options[:inline] && !options["force"] && Bundler.default_lockfile.file?
+ if !options["update"] && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
return if @definition.nothing_changed? && !@definition.missing_specs?
end
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 754ec537e8..f47382606f 100644
--- a/spec/bundler/installer/gem_installer_spec.rb
+++ b/spec/bundler/installer/gem_installer_spec.rb
@@ -18,8 +18,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 cd752656db..247063b3cf 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -174,6 +174,7 @@ RSpec.describe "The library itself" do
default_cli_command
gem.coc
gem.mit
+ inline
lockfile_uses_separate_rubygems_sources
warned_version
]
diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb
index 2893920e44..dcaba3ab9d 100644
--- a/spec/runtime/inline_spec.rb
+++ b/spec/runtime/inline_spec.rb
@@ -252,4 +252,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(last_command).to be_success
+ expect(last_command.stdout).to eq "1.0.0"
+ end
end