summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli/check.rb2
-rw-r--r--lib/bundler/definition.rb6
-rw-r--r--lib/bundler/source.rb2
-rw-r--r--lib/bundler/source/rubygems.rb6
-rw-r--r--lib/bundler/source_list.rb4
-rw-r--r--spec/bundler/commands/check_spec.rb16
6 files changed, 35 insertions, 1 deletions
diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb
index 4221fc7f2b..65c51337d2 100644
--- a/lib/bundler/cli/check.rb
+++ b/lib/bundler/cli/check.rb
@@ -15,7 +15,7 @@ module Bundler
definition.validate_runtime!
begin
- definition.resolve_with_cache!
+ definition.resolve_only_locally!
not_installed = definition.missing_specs
rescue GemNotFound, VersionConflict
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 621bda686e..2bd1290cdd 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -166,6 +166,12 @@ module Bundler
@multisource_allowed
end
+ def resolve_only_locally!
+ @remote = false
+ sources.local_only!
+ resolve
+ end
+
def resolve_with_cache!
sources.cached!
resolve
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 7bf493d73d..434112ac8a 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -36,6 +36,8 @@ module Bundler
def local!; end
+ def local_only!; end
+
def cached!; end
def remote!; end
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 298ff98e24..2e0ecb1aa6 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -26,6 +26,12 @@ module Bundler
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
end
+ def local_only!
+ @specs = nil
+ @allow_local = true
+ @allow_remote = false
+ end
+
def local!
return if @allow_local
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index b97206f497..d6310b78c0 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -136,6 +136,10 @@ module Bundler
different_sources?(lock_sources, replacement_sources)
end
+ def local_only!
+ all_sources.each(&:local_only!)
+ end
+
def cached!
all_sources.each(&:cached!)
end
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index c48220f8df..7eb3fec2e5 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -137,6 +137,22 @@ RSpec.describe "bundle check" do
expect(exitstatus).to eq(1)
end
+ it "ensures that gems are actually installed and not just cached in applications' cache" do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ G
+
+ bundle "config set --local path vendor/bundle"
+ bundle :cache
+
+ gem_command "uninstall rack", :env => { "GEM_HOME" => vendored_gems.to_s }
+
+ bundle "check", :raise_on_error => false
+ expect(err).to include("* rack (1.0.0)")
+ expect(exitstatus).to eq(1)
+ end
+
it "ignores missing gems restricted to other platforms" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"