|
13 | 13 | end |
14 | 14 |
|
15 | 15 | RSpec.describe "bundle cache with git" do |
| 16 | + it "does not copy repository to vendor cache when cache_all set to false" do |
| 17 | + git = build_git "foo" |
| 18 | + ref = git.ref_for("main", 11) |
| 19 | + |
| 20 | + install_gemfile <<-G |
| 21 | + source "https://gem.repo1" |
| 22 | + gem "foo", :git => '#{lib_path("foo-1.0")}' |
| 23 | + G |
| 24 | + |
| 25 | + bundle "config cache_all false" |
| 26 | + bundle :cache |
| 27 | + expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).not_to exist |
| 28 | + |
| 29 | + expect(the_bundle).to include_gems "foo 1.0" |
| 30 | + end |
| 31 | + |
16 | 32 | it "copies repository to vendor cache and uses it" do |
17 | 33 | git = build_git "foo" |
18 | 34 | ref = git.ref_for("main", 11) |
|
22 | 38 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
23 | 39 | G |
24 | 40 |
|
25 | | - bundle "config set cache_all true" |
26 | 41 | bundle :cache |
27 | 42 | expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist |
28 | 43 | expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist |
|
43 | 58 |
|
44 | 59 | bundle "config set --local path vendor/bundle" |
45 | 60 | bundle "install" |
46 | | - bundle "config set cache_all true" |
47 | 61 | bundle :cache |
48 | 62 |
|
49 | 63 | expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist |
|
61 | 75 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
62 | 76 | G |
63 | 77 |
|
64 | | - bundle "config set cache_all true" |
65 | 78 | bundle :cache |
66 | 79 | bundle :cache |
67 | 80 |
|
|
79 | 92 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
80 | 93 | G |
81 | 94 |
|
82 | | - bundle "config set cache_all true" |
83 | 95 | bundle :cache |
84 | 96 |
|
85 | 97 | update_git "foo" do |s| |
|
109 | 121 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
110 | 122 | G |
111 | 123 |
|
112 | | - bundle "config set cache_all true" |
113 | 124 | bundle :cache |
114 | 125 |
|
115 | 126 | update_git "foo" do |s| |
|
140 | 151 |
|
141 | 152 | bundle %(config set local.foo #{lib_path("foo-1.0")}) |
142 | 153 | bundle "install" |
143 | | - bundle "config set cache_all true" |
144 | 154 | bundle :cache |
145 | 155 |
|
146 | 156 | expect(bundled_app("vendor/cache/foo-invalid-#{ref}")).to exist |
|
179 | 189 | source "https://gem.repo1" |
180 | 190 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
181 | 191 | G |
182 | | - bundle "config set cache_all true" |
183 | 192 | bundle :cache, "all-platforms" => true |
184 | 193 |
|
185 | 194 | pristine_system_gems |
|
196 | 205 | source "https://gem.repo1" |
197 | 206 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
198 | 207 | G |
199 | | - bundle "config set cache_all true" |
200 | 208 | bundle :cache, "all-platforms" => true |
201 | 209 |
|
202 | 210 | pristine_system_gems |
|
213 | 221 | source "https://gem.repo1" |
214 | 222 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
215 | 223 | G |
216 | | - bundle "config set cache_all true" |
217 | 224 | bundle :cache, "all-platforms" => true |
218 | 225 |
|
219 | 226 | pristine_system_gems |
|
242 | 249 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
243 | 250 | G |
244 | 251 | bundle "config set global_gem_cache false" |
245 | | - bundle "config set cache_all true" |
246 | 252 | bundle "config path vendor/bundle" |
247 | 253 | bundle :install |
248 | 254 |
|
|
274 | 280 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
275 | 281 | G |
276 | 282 | bundle "config set global_gem_cache false" |
277 | | - bundle "config set cache_all true" |
278 | 283 | bundle "config path vendor/bundle" |
279 | 284 | bundle :install |
280 | 285 |
|
|
304 | 309 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
305 | 310 | G |
306 | 311 | bundle "config set global_gem_cache false" |
307 | | - bundle "config set cache_all true" |
308 | 312 | bundle "config path vendor/bundle" |
309 | 313 | bundle :install |
310 | 314 |
|
|
342 | 346 | G |
343 | 347 |
|
344 | 348 | ref = git.ref_for("main", 11) |
345 | | - bundle "config set cache_all true" |
346 | 349 | bundle :cache |
347 | 350 |
|
348 | 351 | expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}")).to exist |
|
362 | 365 | source "https://gem.repo1" |
363 | 366 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
364 | 367 | G |
365 | | - bundle "config set cache_all true" |
366 | 368 | bundle :cache |
367 | 369 |
|
368 | 370 | ref = git.ref_for("main", 11) |
|
377 | 379 | source "https://gem.repo1" |
378 | 380 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
379 | 381 | G |
380 | | - bundle "config set cache_all true" |
381 | 382 | bundle :cache, "all-platforms" => true, :install => false |
382 | 383 |
|
383 | 384 | pristine_system_gems |
|
436 | 437 | source "https://gem.repo1" |
437 | 438 | gem "foo", :git => '#{lib_path("foo-1.0")}' |
438 | 439 | G |
439 | | - bundle "config set cache_all true" |
440 | 440 |
|
441 | 441 | # The algorithm for the cache location for a git checkout is |
442 | 442 | # in Bundle::Source::Git#cache_path |
|
498 | 498 | end |
499 | 499 |
|
500 | 500 | FileUtils.mkdir_p(bundled_app("vendor/cache")) |
501 | | - bundle "config set cache_all all" |
502 | 501 |
|
503 | 502 | install_gemfile <<-G |
504 | 503 | source "https://gem.repo1" |
|
0 commit comments