summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-09-07 19:30:37 +0200
committerSamuel Giddins <segiddins@segiddins.me>2016-09-07 19:30:37 +0200
commit15e3a9174aca0a429c9df5bfebaac132d7e384eb (patch)
tree469977b06cae989a939287093a5d5a344959b911
parent6653e1895cb8c98ff20cebc9a5d329d03dd126a9 (diff)
downloadbundler-15e3a9174aca0a429c9df5bfebaac132d7e384eb.tar.gz
Fix checking for missing deps when theres a lockfile
-rw-r--r--lib/bundler/definition.rb1
-rw-r--r--lib/bundler/installer.rb4
-rw-r--r--spec/install/gemfile/lockfile_spec.rb19
3 files changed, 21 insertions, 3 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 9878eec493..d1cb494f59 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -169,6 +169,7 @@ module Bundler
def missing_dependencies?
missing = []
+ resolve.materialize(current_dependencies, missing)
return false if missing.empty?
Bundler.ui.debug "The definition is missing #{missing.map(&:full_name)}"
true
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 500f90f338..081ca09d7a 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -68,7 +68,7 @@ module Bundler
return
end
- resolve_if_need(options)
+ resolve_if_needed(options)
install(options)
lock unless Bundler.settings[:frozen]
@@ -181,7 +181,7 @@ module Bundler
"because of an invalid symlink. Remove the symlink so the directory can be created."
end
- def resolve_if_need(options)
+ def resolve_if_needed(options)
if Bundler.default_lockfile.exist? && !options["update"]
if @definition.new_platform?
Bundler.ui.debug "Resolving since there is a new platform in the definition"
diff --git a/spec/install/gemfile/lockfile_spec.rb b/spec/install/gemfile/lockfile_spec.rb
index 5d8c6de316..ea3acd3536 100644
--- a/spec/install/gemfile/lockfile_spec.rb
+++ b/spec/install/gemfile/lockfile_spec.rb
@@ -13,13 +13,30 @@ describe "bundle install with a lockfile present" do
end
context "gemfile evaluation" do
- let(:gf) { super() + "\n\n File.open('evals', 'a') {|f| f << %(1\n) }" }
+ let(:gf) { super() + "\n\n File.open('evals', 'a') {|f| f << %(1\n) } unless ENV['BUNDLER_SPEC_NO_APPEND']" }
+
it "does not evaluate the gemfile twice" do
bundle! :install
+ with_env_vars("BUNDLER_SPEC_NO_APPEND" => "1") { should_be_installed "rack 1.0.0" }
+
# The first eval is from the initial install, we're testing that the
# second install doesn't double-eval
expect(bundled_app("evals").read.lines.size).to eq(2)
end
+
+ context "when the gem is not installed" do
+ before { FileUtils.rm_rf ".bundle" }
+
+ it "does not evaluate the gemfile twice" do
+ bundle! :install
+
+ with_env_vars("BUNDLER_SPEC_NO_APPEND" => "1") { should_be_installed "rack 1.0.0" }
+
+ # The first eval is from the initial install, we're testing that the
+ # second install doesn't double-eval
+ expect(bundled_app("evals").read.lines.size).to eq(2)
+ end
+ end
end
end