File tree Expand file tree Collapse file tree 5 files changed +23
-9
lines changed
Expand file tree Collapse file tree 5 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -469,7 +469,7 @@ def path_separator
469469 end
470470
471471 def all_specs
472- Gem ::Specification . stubs . reject ( & :default_gem? ) . map do |stub |
472+ Gem ::Specification . stubs . map do |stub |
473473 StubSpecification . from_stub ( stub )
474474 end
475475 end
Original file line number Diff line number Diff line change @@ -225,7 +225,11 @@ def cached_built_in_gem(spec)
225225 cached_path = cached_path ( spec )
226226 if cached_path . nil?
227227 remote_spec = remote_specs . search ( spec ) . first
228- cached_path = fetch_gem ( remote_spec )
228+ if remote_spec
229+ cached_path = fetch_gem ( remote_spec )
230+ else
231+ 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."
232+ end
229233 end
230234 cached_path
231235 end
Original file line number Diff line number Diff line change 102102
103103 it "uses builtin gems when installing to system gems" do
104104 bundle "config set path.system true"
105- install_gemfile %(source "#{ file_uri_for ( gem_repo2 ) } "; gem 'json', '#{ default_json_version } ') , verbose : true
106- expect ( out ) . to include ( "Installing json #{ default_json_version } " )
105+ install_gemfile %(source "#{ file_uri_for ( gem_repo1 ) } "; gem 'json', '#{ default_json_version } ') , verbose : true
106+ expect ( out ) . to include ( "Using json #{ default_json_version } " )
107107 end
108108
109109 it "caches remote and builtin gems" do
143143 bundle "install --local"
144144 expect ( the_bundle ) . to include_gems ( "builtin_gem_2 1.0.2" )
145145 end
146+
147+ it "errors if the builtin gem isn't available to cache" do
148+ bundle "config set path.system true"
149+
150+ install_gemfile <<-G
151+ source "#{ file_uri_for ( gem_repo1 ) } "
152+ gem 'json', '#{ default_json_version } '
153+ G
154+
155+ bundle :cache , raise_on_error : false
156+ expect ( exitstatus ) . to_not eq ( 0 )
157+ expect ( err ) . to include ( "json-#{ default_json_version } is built in to Ruby, and can't be cached" )
158+ end
146159 end
147160
148161 describe "when there are also git sources" do
Original file line number Diff line number Diff line change 164164
165165 install_gemfile <<-G
166166 source "#{ file_uri_for ( gem_repo1 ) } "
167+ gem "json"
167168 G
168169 end
169170
Original file line number Diff line number Diff line change @@ -1281,10 +1281,6 @@ def lock_with(ruby_version = nil)
12811281
12821282 describe "with gemified standard libraries" do
12831283 it "does not load Digest" , :ruby_repo do
1284- build_repo2 do
1285- build_gem "digest"
1286- end
1287-
12881284 build_git "bar" , gemspec : false do |s |
12891285 s . write "lib/bar/version.rb" , %(BAR_VERSION = '1.0')
12901286 s . write "bar.gemspec" , <<-G
@@ -1303,7 +1299,7 @@ def lock_with(ruby_version = nil)
13031299 end
13041300
13051301 gemfile <<-G
1306- source "#{ file_uri_for ( gem_repo2 ) } "
1302+ source "#{ file_uri_for ( gem_repo1 ) } "
13071303 gem "bar", :git => "#{ lib_path ( "bar-1.0" ) } "
13081304 G
13091305
You can’t perform that action at this time.
0 commit comments