summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-08-02 00:45:16 -0700
committerAndre Arko <andre@arko.net>2015-08-02 00:45:21 -0700
commit69475cb66c86c271494299e595b0ad3f04bbda31 (patch)
tree22fa8c6615a6f71daa6e48b5b1606c37aa575c20
parentae575fb8ca1eac9a83eb258b6b54f209d78a1cc8 (diff)
parent61fde24adbbb4c73d842e851330acde4d75ace56 (diff)
downloadbundler-69475cb66c86c271494299e595b0ad3f04bbda31.tar.gz
Merge pull request #3896 from EduardoBautista/fix-missing-source
Print a warning when a gem can't be cached due to a missing source
-rw-r--r--lib/bundler/source/rubygems.rb6
-rw-r--r--spec/cache/gems_spec.rb10
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index d15362b9aa..a9b10f5936 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -189,7 +189,11 @@ module Bundler
cached_path = cached_path(spec)
if cached_path.nil?
remote_spec = remote_specs.search(spec).first
- cached_path = fetch_gem(remote_spec)
+ if remote_spec
+ cached_path = fetch_gem(remote_spec)
+ else
+ Bundler.ui.warn "#{spec.full_name} is built in to Ruby, and can't be cached because your Gemfile doesn't have any sources that contain it."
+ end
end
cached_path
end
diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb
index 1d26f5011b..fef6e0fce6 100644
--- a/spec/cache/gems_spec.rb
+++ b/spec/cache/gems_spec.rb
@@ -116,6 +116,16 @@ describe "bundle cache" do
bundle "install --local"
should_be_installed("builtin_gem_2 1.0.2")
end
+
+ it "errors if the builtin gem isn't available to cache" do
+ install_gemfile <<-G
+ gem 'builtin_gem', '1.0.2'
+ G
+
+ bundle :cache
+ expect(exitstatus).to_not eq(0) if exitstatus
+ expect(out).to include("builtin_gem-1.0.2 is built in to Ruby, and can't be cached")
+ end
end
describe "when there are also git sources" do