diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-01-14 19:43:02 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-01-14 20:19:08 -0600 |
commit | 6fd5a43d0b5f79a15768ae6a6838363068908073 (patch) | |
tree | 83eb93d1f075550591510f5a14c4143c0cdb7f2c | |
parent | 3f0075896a60ba1771913fc1118ecc9b91db98bb (diff) | |
download | bundler-seg-inline-empty-bundle-gemfile.tar.gz |
[Inline] Support running when BUNDLE_GEMFILE=""seg-inline-empty-bundle-gemfile
-rw-r--r-- | lib/bundler.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/check.rb | 2 | ||||
-rw-r--r-- | lib/bundler/inline.rb | 2 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 2 | ||||
-rw-r--r-- | spec/runtime/inline_spec.rb | 18 |
5 files changed, 22 insertions, 4 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 9b96075ca9..d483752441 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -135,7 +135,7 @@ module Bundler @locked_gems ||= if defined?(@definition) && @definition definition.locked_gems - elsif Bundler.default_lockfile.exist? + elsif Bundler.default_lockfile.file? lock = Bundler.read_file(Bundler.default_lockfile) LockfileParser.new(lock) end diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb index 3f504ff621..057a7e5695 100644 --- a/lib/bundler/cli/check.rb +++ b/lib/bundler/cli/check.rb @@ -28,7 +28,7 @@ module Bundler not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" } Bundler.ui.warn "Install missing gems with `bundle install`" exit 1 - elsif !Bundler.default_lockfile.exist? && Bundler.settings[:frozen] + elsif !Bundler.default_lockfile.file? && Bundler.settings[:frozen] Bundler.ui.error "This bundle has been frozen, but there is no #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} present" exit 1 else diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index c0f5bd0e4f..4d3791bfb2 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -39,7 +39,7 @@ def gemfile(install = false, options = {}, &gemfile) def Bundler.root Bundler::SharedHelpers.pwd.expand_path end - ENV["BUNDLE_GEMFILE"] ||= "Gemfile" + ENV["BUNDLE_GEMFILE"] = "Gemfile" Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins? builder = Bundler::Dsl.new diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 46131ea8f6..4aa337a073 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -212,7 +212,7 @@ module Bundler end def resolve_if_need(options) - if Bundler.default_lockfile.exist? && !options["update"] && !options[:inline] + if !options["update"] && !options[:inline] && Bundler.default_lockfile.file? local = Bundler.ui.silence do begin tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil) diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index 15f3723693..215b528b4d 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -232,4 +232,22 @@ describe "bundler/inline#gemfile" do expect(err).to be_empty expect(exitstatus).to be_zero if exitstatus end + + it "installs inline gems when BUNDLE_GEMFILE is set to an empty string" do + ENV["BUNDLE_GEMFILE"] = "" + + in_app_root do + script <<-RUBY + gemfile do + source "file://#{gem_repo1}" + gem "rack" + end + + puts RACK + RUBY + end + + expect(err).to be_empty + expect(exitstatus).to be_zero if exitstatus + end end |