|
262 | 262 | end |
263 | 263 | end |
264 | 264 |
|
265 | | - it "installs the ruby variant but Bundler.setup still complains when only an incompatible platform-specific variant is locked" do |
| 265 | + it "adds and installs the ruby variant when only an incompatible platform-specific variant was locked" do |
266 | 266 | build_repo4 do |
267 | 267 | build_gem "nokogiri", "1.18.10" |
268 | 268 | build_gem "nokogiri", "1.18.10" do |s| |
|
294 | 294 | L |
295 | 295 |
|
296 | 296 | simulate_platform "x86_64-linux" do |
297 | | - bundle "install --verbose", env: { "BUNDLE_FROZEN" => "true" }, raise_on_error: false |
298 | | - expect(exitstatus).to eq(0) |
299 | | - expect(out).to include("Fetching nokogiri 1.18.10\n") |
300 | | - expect(out).to include("Installing nokogiri 1.18.10\n") |
| 297 | + bundle "install --verbose" |
| 298 | + expect(out).to include("Installing nokogiri 1.18.10") |
| 299 | + expect(the_bundle).to include_gem("nokogiri 1.18.10") |
| 300 | + end |
| 301 | + |
| 302 | + expect(lockfile).to eq <<~L |
| 303 | + GEM |
| 304 | + remote: https://gem.repo4/ |
| 305 | + specs: |
| 306 | + nokogiri (1.18.10) |
| 307 | + nokogiri (1.18.10-x86_64-linux) |
| 308 | +
|
| 309 | + PLATFORMS |
| 310 | + x86_64-linux |
| 311 | +
|
| 312 | + DEPENDENCIES |
| 313 | + nokogiri |
| 314 | +
|
| 315 | + BUNDLED WITH |
| 316 | + #{Bundler::VERSION} |
| 317 | + L |
| 318 | + end |
| 319 | + |
| 320 | + it "fails at install time when only an incompatible platform-specific variant is locked" do |
| 321 | + build_repo4 do |
| 322 | + build_gem "nokogiri", "1.18.10" |
| 323 | + build_gem "nokogiri", "1.18.10" do |s| |
| 324 | + s.platform = "x86_64-linux" |
| 325 | + s.required_ruby_version = "< #{Gem.ruby_version}" |
| 326 | + end |
| 327 | + end |
| 328 | + |
| 329 | + gemfile <<~G |
| 330 | + source "https://gem.repo4" |
| 331 | +
|
| 332 | + gem "nokogiri" |
| 333 | + G |
| 334 | + |
| 335 | + lockfile <<-L |
| 336 | + GEM |
| 337 | + remote: https://gem.repo4/ |
| 338 | + specs: |
| 339 | + nokogiri (1.18.10-x86_64-linux) |
| 340 | +
|
| 341 | + PLATFORMS |
| 342 | + x86_64-linux |
| 343 | +
|
| 344 | + DEPENDENCIES |
| 345 | + nokogiri |
| 346 | +
|
| 347 | + BUNDLED WITH |
| 348 | + #{Bundler::VERSION} |
| 349 | + L |
301 | 350 |
|
302 | | - # FIXME: We should not install an alternative and then refuse to use it. |
303 | | - ruby "require 'bundler'; Bundler.setup", env: { "BUNDLE_FROZEN" => "true" }, raise_on_error: false |
| 351 | + simulate_platform "x86_64-linux" do |
| 352 | + bundle "install --verbose", env: { "BUNDLE_FROZEN" => "true" }, raise_on_error: false |
304 | 353 | expect(exitstatus).not_to eq(0) |
305 | | - expect(err).to include("Could not find nokogiri-1.18.10-x86_64-linux in locally installed gems") |
| 354 | + expect(err).to include("nokogiri-1.18.10-x86_64-linux requires ruby version < #{Gem.ruby_version}") |
306 | 355 | end |
307 | 356 | end |
308 | 357 | end |
|
810 | 859 | bundle "update --conservative nokogiri" |
811 | 860 | end |
812 | 861 |
|
| 862 | + checksums.checksum gem_repo4, "nokogiri", "1.13.0" |
| 863 | + |
813 | 864 | expect(lockfile).to eq <<~L |
814 | 865 | GEM |
815 | 866 | remote: https://gem.repo4/ |
816 | 867 | specs: |
| 868 | + nokogiri (1.13.0) |
817 | 869 | nokogiri (1.13.0-x86_64-darwin) |
818 | 870 | sorbet-static (0.5.10601-x86_64-darwin) |
819 | 871 |
|
|
829 | 881 | L |
830 | 882 | end |
831 | 883 |
|
| 884 | + it "locks ruby fallback variant dependencies without adding the ruby platform" do |
| 885 | + build_repo4 do |
| 886 | + build_gem "native_tool", "1.0" do |s| |
| 887 | + s.add_dependency "rake" |
| 888 | + end |
| 889 | + |
| 890 | + build_gem "native_tool", "1.0" do |s| |
| 891 | + s.platform = "x86_64-linux" |
| 892 | + end |
| 893 | + |
| 894 | + build_gem "rake" |
| 895 | + |
| 896 | + build_gem "sorbet-static", "0.5.10601" do |s| |
| 897 | + s.platform = "x86_64-linux" |
| 898 | + end |
| 899 | + end |
| 900 | + |
| 901 | + simulate_platform "x86_64-linux" do |
| 902 | + install_gemfile <<~G |
| 903 | + source "https://gem.repo4" |
| 904 | +
|
| 905 | + gem "native_tool" |
| 906 | + gem "sorbet-static" |
| 907 | + G |
| 908 | + end |
| 909 | + |
| 910 | + checksums = checksums_section_when_enabled do |c| |
| 911 | + c.checksum gem_repo4, "native_tool", "1.0" |
| 912 | + c.checksum gem_repo4, "native_tool", "1.0", "x86_64-linux" |
| 913 | + c.checksum gem_repo4, "rake", "1.0" |
| 914 | + c.checksum gem_repo4, "sorbet-static", "0.5.10601", "x86_64-linux" |
| 915 | + end |
| 916 | + |
| 917 | + expect(lockfile).to eq <<~L |
| 918 | + GEM |
| 919 | + remote: https://gem.repo4/ |
| 920 | + specs: |
| 921 | + native_tool (1.0) |
| 922 | + rake |
| 923 | + native_tool (1.0-x86_64-linux) |
| 924 | + rake (1.0) |
| 925 | + sorbet-static (0.5.10601-x86_64-linux) |
| 926 | +
|
| 927 | + PLATFORMS |
| 928 | + x86_64-linux |
| 929 | +
|
| 930 | + DEPENDENCIES |
| 931 | + native_tool |
| 932 | + sorbet-static |
| 933 | + #{checksums} |
| 934 | + BUNDLED WITH |
| 935 | + #{Bundler::VERSION} |
| 936 | + L |
| 937 | + end |
| 938 | + |
832 | 939 | it "automatically fixes the lockfile if only ruby platform is locked and some gem has no ruby variant available" do |
833 | 940 | build_repo4 do |
834 | 941 | build_gem("sorbet-static-and-runtime", "0.5.10160") do |s| |
|
0 commit comments