diff options
author | David RodrÃguez <[email protected]> | 2024-06-28 16:12:29 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-28 10:12:29 -0400 |
commit | 98c923ff4bbeeb4a8f9f63ea2695a38471da42c2 (patch) | |
tree | 46dcbbfb81eec22b88efa8d46a0de99d81247813 | |
parent | 1652c194c849468659baa566a2422a308d6eac0c (diff) |
Synchronize Bundler & RubyGems (#11071)
120 files changed, 4392 insertions, 4237 deletions
diff --git a/lib/bundler/self_manager.rb b/lib/bundler/self_manager.rb index 3cef0197c0..ea7c014f3c 100644 --- a/lib/bundler/self_manager.rb +++ b/lib/bundler/self_manager.rb @@ -70,8 +70,23 @@ module Bundler configured_gem_home = ENV["GEM_HOME"] configured_gem_path = ENV["GEM_PATH"] - cmd = [$PROGRAM_NAME, *ARGV] - cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME) + # Bundler specs need some stuff to be required before Bundler starts + # running, for example, for faking the compact index API. However, these + # flags are lost when we reexec to a different version of Bundler. In the + # future, we may be able to properly reconstruct the original Ruby + # invocation (see https://bugs.ruby-lang.org/issues/6648), but for now + # there's no way to do it, so we need to be explicit about how to re-exec. + # This may be a feature end users request at some point, but maybe by that + # time, we have builtin tools to do. So for now, we use an undocumented + # ENV variable only for our specs. + bundler_spec_original_cmd = ENV["BUNDLER_SPEC_ORIGINAL_CMD"] + if bundler_spec_original_cmd + require "shellwords" + cmd = [*Shellwords.shellsplit(bundler_spec_original_cmd), *ARGV] + else + cmd = [$PROGRAM_NAME, *ARGV] + cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME) + end Bundler.with_original_env do Kernel.exec( diff --git a/lib/bundler/vendored_net_http.rb b/lib/bundler/vendored_net_http.rb index 0dcabaa7d7..8ff2ccd1fe 100644 --- a/lib/bundler/vendored_net_http.rb +++ b/lib/bundler/vendored_net_http.rb @@ -1,12 +1,23 @@ # frozen_string_literal: true -begin - require "rubygems/vendored_net_http" -rescue LoadError +# This defined? guard can be removed once RubyGems 3.4 support is dropped. +# +# Bundler specs load this code from `spec/support/vendored_net_http.rb` to avoid +# activating the Bundler gem too early. Without this guard, we get redefinition +# warnings once Bundler is actually activated and +# `lib/bundler/vendored_net_http.rb` is required. This is not an issue in +# RubyGems versions including `rubygems/vendored_net_http` since `require` takes +# care of avoiding the double load. +# +unless defined?(Gem::Net) begin - require "rubygems/net/http" + require "rubygems/vendored_net_http" rescue LoadError - require "net/http" - Gem::Net = Net + begin + require "rubygems/net/http" + rescue LoadError + require "net/http" + Gem::Net = Net + end end end diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb index 4cd21375b5..2c8453da4d 100644 --- a/spec/bundler/bundler/bundler_spec.rb +++ b/spec/bundler/bundler/bundler_spec.rb @@ -227,8 +227,8 @@ RSpec.describe Bundler do describe "#mkdir_p" do it "creates a folder at the given path" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G allow(Bundler).to receive(:root).and_return(bundled_app) diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index c71fc8e9e7..b2cc1ccfef 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -101,30 +101,30 @@ RSpec.describe "bundle executable" do context "when ENV['BUNDLE_GEMFILE'] is set to an empty string" do it "ignores it" do gemfile bundled_app_gemfile, <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle :install, env: { "BUNDLE_GEMFILE" => "" } - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end context "with --verbose" do it "prints the running command" do - gemfile "source \"#{file_uri_for(gem_repo1)}\"" + gemfile "source 'https://gem.repo1'" bundle "info bundler", verbose: true expect(out).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}") end it "doesn't print defaults" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", verbose: true + install_gemfile "source 'https://gem.repo1'", verbose: true expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}") end it "doesn't print defaults" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", verbose: true + install_gemfile "source 'https://gem.repo1'", verbose: true expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}") end end @@ -138,8 +138,8 @@ RSpec.describe "bundle executable" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", '0.9.1' + source "https://gem.repo1" + gem "myrack", '0.9.1' G end @@ -149,8 +149,8 @@ RSpec.describe "bundle executable" do it "prints a message when there are outdated gems" do run_command - expect(out).to include("Gem Current Latest Requested Groups") - expect(out).to include("rack 0.9.1 1.0.0 = 0.9.1 default") + expect(out).to include("Gem Current Latest Requested Groups") + expect(out).to include("myrack 0.9.1 1.0.0 = 0.9.1 default") end end @@ -160,7 +160,7 @@ RSpec.describe "bundle executable" do it "prints a message when there are outdated gems" do run_command - expect(out).to include("rack (newest 1.0.0, installed 0.9.1, requested = 0.9.1)") + expect(out).to include("myrack (newest 1.0.0, installed 0.9.1, requested = 0.9.1)") end end @@ -170,7 +170,7 @@ RSpec.describe "bundle executable" do it "prints a simplified message when there are outdated gems" do run_command - expect(out).to include("rack (newest 1.0.0, installed 0.9.1, requested = 0.9.1)") + expect(out).to include("myrack (newest 1.0.0, installed 0.9.1, requested = 0.9.1)") end end end diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb index 28c04e0860..28d770daa0 100644 --- a/spec/bundler/bundler/definition_spec.rb +++ b/spec/bundler/bundler/definition_spec.rb @@ -45,17 +45,17 @@ RSpec.describe Bundler::Definition do build_lib "foo", "1.0", path: lib_path("foo") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" G build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", "1.0" + s.add_dependency "myrack", "1.0" end checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" - c.checksum gem_repo1, "rack", "1.0.0" + c.checksum gem_repo1, "myrack", "1.0.0" end bundle :install, env: { "DEBUG" => "1" } @@ -66,12 +66,12 @@ RSpec.describe Bundler::Definition do remote: #{lib_path("foo")} specs: foo (1.0) - rack (= 1.0) + myrack (= 1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} @@ -91,7 +91,7 @@ RSpec.describe Bundler::Definition do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "ffi" G @@ -104,17 +104,17 @@ RSpec.describe Bundler::Definition do it "for a path gem with deps and no changes" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", "1.0" + s.add_dependency "myrack", "1.0" s.add_development_dependency "net-ssh", "1.0" end checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" - c.checksum gem_repo1, "rack", "1.0.0" + c.checksum gem_repo1, "myrack", "1.0.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" G @@ -123,12 +123,12 @@ RSpec.describe Bundler::Definition do remote: #{lib_path("foo")} specs: foo (1.0) - rack (= 1.0) + myrack (= 1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} @@ -154,7 +154,7 @@ RSpec.describe Bundler::Definition do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "only_java", platform: :jruby G @@ -164,7 +164,7 @@ RSpec.describe Bundler::Definition do expect(out).to match(/using resolution from the lockfile/) expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: only_java (1.1-java) @@ -185,7 +185,7 @@ RSpec.describe Bundler::Definition do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" G @@ -194,7 +194,7 @@ RSpec.describe Bundler::Definition do expect(out).to match(/using resolution from the lockfile/) expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: foo (1.0) @@ -215,13 +215,13 @@ RSpec.describe Bundler::Definition do context "eager unlock" do let(:source_list) do Bundler::SourceList.new.tap do |source_list| - source_list.add_global_rubygems_remote(file_uri_for(gem_repo4)) + source_list.add_global_rubygems_remote("https://gem.repo4") end end before do gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'isolated_owner' gem 'shared_owner_a' @@ -230,7 +230,7 @@ RSpec.describe Bundler::Definition do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: isolated_dep (2.0.1) isolated_owner (1.0.1) diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb index c15aa9af67..e0ab0a45e3 100644 --- a/spec/bundler/bundler/env_spec.rb +++ b/spec/bundler/bundler/env_spec.rb @@ -70,16 +70,16 @@ RSpec.describe Bundler::Env do context "when there is a Gemfile and a lockfile and print_gemfile is true" do before do - gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem 'rack', '1.0.0'" + gemfile "source 'https://gem.repo1'; gem 'myrack', '1.0.0'" lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) DEPENDENCIES - rack + myrack BUNDLED WITH 1.10.0 @@ -92,12 +92,12 @@ RSpec.describe Bundler::Env do it "prints the Gemfile" do expect(output).to include("Gemfile") - expect(output).to include("'rack', '1.0.0'") + expect(output).to include("'myrack', '1.0.0'") end it "prints the lockfile" do expect(output).to include("Gemfile.lock") - expect(output).to include("rack (1.0.0)") + expect(output).to include("myrack (1.0.0)") end end @@ -148,7 +148,7 @@ RSpec.describe Bundler::Env do end before do - gemfile("source \"#{file_uri_for(gem_repo1)}\"; gemspec") + gemfile("source 'https://gem.repo1'; gemspec") File.open(bundled_app("foo.gemspec"), "wb") do |f| f.write(gemspec) @@ -167,10 +167,10 @@ RSpec.describe Bundler::Env do context "when eval_gemfile is used" do it "prints all gemfiles" do - create_file bundled_app("other/Gemfile-other"), "gem 'rack'" - create_file bundled_app("other/Gemfile"), "eval_gemfile 'Gemfile-other'" - create_file bundled_app("Gemfile-alt"), <<-G - source "#{file_uri_for(gem_repo1)}" + gemfile bundled_app("other/Gemfile-other"), "gem 'myrack'" + gemfile bundled_app("other/Gemfile"), "eval_gemfile 'Gemfile-other'" + gemfile bundled_app("Gemfile-alt"), <<-G + source "https://gem.repo1" eval_gemfile "other/Gemfile" G gemfile "eval_gemfile #{bundled_app("Gemfile-alt").to_s.dump}" @@ -190,7 +190,7 @@ RSpec.describe Bundler::Env do ### Gemfile-alt ```ruby - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "other/Gemfile" ``` @@ -203,7 +203,7 @@ RSpec.describe Bundler::Env do ### other/Gemfile-other ```ruby - gem 'rack' + gem 'myrack' ``` ### Gemfile.lock diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb index cda2ef31de..255019f40a 100644 --- a/spec/bundler/bundler/friendly_errors_spec.rb +++ b/spec/bundler/bundler/friendly_errors_spec.rb @@ -18,8 +18,8 @@ RSpec.describe Bundler, "friendly errors" do it "reports a relevant friendly error message" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle :install, env: { "DEBUG" => "true" } diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb index 187dab0e7c..94f66537d3 100644 --- a/spec/bundler/bundler/gem_helper_spec.rb +++ b/spec/bundler/bundler/gem_helper_spec.rb @@ -286,7 +286,7 @@ RSpec.describe Bundler::GemHelper do let(:repo) { build_git("foo", bare: true) } before do - git("remote add origin #{file_uri_for(repo.path)}", app_path) + git("remote add origin #{repo.path}", app_path) git('commit -a -m "initial commit"', app_path) end diff --git a/spec/bundler/bundler/plugin/index_spec.rb b/spec/bundler/bundler/plugin/index_spec.rb index 5a7047459f..e1f10a0db7 100644 --- a/spec/bundler/bundler/plugin/index_spec.rb +++ b/spec/bundler/bundler/plugin/index_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Bundler::Plugin::Index do before do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) - gemfile "source \"#{file_uri_for(gem_repo1)}\"" + gemfile "source 'https://gem.repo1'" path = lib_path(plugin_name) index.register_plugin("new-plugin", path.to_s, [path.join("lib").to_s], commands, sources, hooks) end diff --git a/spec/bundler/bundler/plugin/installer_spec.rb b/spec/bundler/bundler/plugin/installer_spec.rb index ed40029f5a..8e1879395a 100644 --- a/spec/bundler/bundler/plugin/installer_spec.rb +++ b/spec/bundler/bundler/plugin/installer_spec.rb @@ -57,7 +57,7 @@ RSpec.describe Bundler::Plugin::Installer do end let(:result) do - installer.install(["ga-plugin"], git: file_uri_for(lib_path("ga-plugin"))) + installer.install(["ga-plugin"], git: lib_path("ga-plugin").to_s) end it "returns the installed spec after installing" do diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb index 768372c608..b7db548cf9 100644 --- a/spec/bundler/bundler/settings_spec.rb +++ b/spec/bundler/bundler/settings_spec.rb @@ -316,8 +316,8 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow let(:settings) { described_class.new(bundled_app(".bundle")) } it "converts older keys without double underscore" do - config("BUNDLE_MY__PERSONAL.RACK" => "~/Work/git/rack") - expect(settings["my.personal.rack"]).to eq("~/Work/git/rack") + config("BUNDLE_MY__PERSONAL.MYRACK" => "~/Work/git/myrack") + expect(settings["my.personal.myrack"]).to eq("~/Work/git/myrack") end it "converts older keys without trailing slashes and double underscore" do diff --git a/spec/bundler/cache/cache_path_spec.rb b/spec/bundler/cache/cache_path_spec.rb index 12385427b1..d5bd14965b 100644 --- a/spec/bundler/cache/cache_path_spec.rb +++ b/spec/bundler/cache/cache_path_spec.rb @@ -3,15 +3,15 @@ RSpec.describe "bundle package" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end context "with --cache-path" do it "caches gems at given path" do bundle :cache, "cache-path" => "vendor/cache-foo" - expect(bundled_app("vendor/cache-foo/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache-foo/myrack-1.0.0.gem")).to exist end end @@ -19,14 +19,14 @@ RSpec.describe "bundle package" do it "caches gems at given path" do bundle "config set cache_path vendor/cache-foo" bundle :cache - expect(bundled_app("vendor/cache-foo/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache-foo/myrack-1.0.0.gem")).to exist end end context "with absolute --cache-path" do it "caches gems at given path" do - bundle :cache, "cache-path" => "/tmp/cache-foo" - expect(bundled_app("/tmp/cache-foo/rack-1.0.0.gem")).to exist + bundle :cache, "cache-path" => bundled_app("vendor/cache-foo") + expect(bundled_app("vendor/cache-foo/myrack-1.0.0.gem")).to exist end end end diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb index 3c734b79c3..6d430308a0 100644 --- a/spec/bundler/cache/gems_spec.rb +++ b/spec/bundler/cache/gems_spec.rb @@ -4,23 +4,23 @@ RSpec.describe "bundle cache" do shared_examples_for "when there are only gemsources" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G - system_gems "rack-1.0.0", path: path + system_gems "myrack-1.0.0", path: path bundle :cache end it "copies the .gem file to vendor/cache" do - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end it "uses the cache as a source when installing gems" do build_gem "omg", path: bundled_app("vendor/cache") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "omg" G @@ -31,44 +31,44 @@ RSpec.describe "bundle cache" do system_gems [], path: default_bundle_path bundle "install --local" - expect(the_bundle).to include_gems("rack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0") end it "does not reinstall gems from the cache if they exist on the system" do - build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0", path: bundled_app("vendor/cache") do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - expect(the_bundle).to include_gems("rack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0") end it "does not reinstall gems from the cache if they exist in the bundle" do - system_gems "rack-1.0.0", path: default_bundle_path + system_gems "myrack-1.0.0", path: default_bundle_path gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0", path: bundled_app("vendor/cache") do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end bundle :install, local: true - expect(the_bundle).to include_gems("rack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0") end it "creates a lockfile" do - cache_gems "rack-1.0.0" + cache_gems "myrack-1.0.0" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "cache" @@ -105,25 +105,25 @@ RSpec.describe "bundle cache" do it "uses remote gems when installing to system gems" do bundle "config set path.system true" - install_gemfile %(source "#{file_uri_for(gem_repo2)}"; gem 'json', '#{default_json_version}'), verbose: true + install_gemfile %(source "https://gem.repo2"; gem 'json', '#{default_json_version}'), verbose: true expect(out).to include("Installing json #{default_json_version}") end it "caches remote and builtin gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'json', '#{default_json_version}' - gem 'rack', '1.0.0' + gem 'myrack', '1.0.0' G bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/json-#{default_json_version}.gem")).to exist end it "caches builtin gems when cache_all_platforms is set" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "json" G @@ -139,7 +139,7 @@ RSpec.describe "bundle cache" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'builtin_gem_2', '1.0.2' G @@ -151,7 +151,7 @@ RSpec.describe "bundle cache" do context "when a remote gem is not available for caching" do it "uses builtin gems when installing to system gems" do bundle "config set path.system true" - install_gemfile %(source "#{file_uri_for(gem_repo1)}"; gem 'json', '#{default_json_version}'), verbose: true + install_gemfile %(source "https://gem.repo1"; gem 'json', '#{default_json_version}'), verbose: true expect(out).to include("Using json #{default_json_version}") end @@ -159,7 +159,7 @@ RSpec.describe "bundle cache" do bundle "config set path.system true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'json', '#{default_json_version}' G @@ -173,14 +173,14 @@ RSpec.describe "bundle cache" do describe "when there are also git sources" do before do build_git "foo" - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem 'foo' end - gem 'rack' + gem 'myrack' G end @@ -190,7 +190,7 @@ RSpec.describe "bundle cache" do system_gems [] bundle "install --local" - expect(the_bundle).to include_gems("rack 1.0.0", "foo 1.0") + expect(the_bundle).to include_gems("myrack 1.0.0", "foo 1.0") end it "should not explode if the lockfile is not present" do @@ -206,38 +206,38 @@ RSpec.describe "bundle cache" do before :each do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" gem "actionpack" G bundle :cache - expect(cached_gem("rack-1.0.0")).to exist + expect(cached_gem("myrack-1.0.0")).to exist expect(cached_gem("actionpack-2.3.2")).to exist expect(cached_gem("activesupport-2.3.2")).to exist end it "re-caches during install" do - cached_gem("rack-1.0.0").rmtree + cached_gem("myrack-1.0.0").rmtree bundle :install expect(out).to include("Updating files in vendor/cache") - expect(cached_gem("rack-1.0.0")).to exist + expect(cached_gem("myrack-1.0.0")).to exist end it "adds and removes when gems are updated" do update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end end bundle "update", all: true - expect(cached_gem("rack-1.2")).to exist - expect(cached_gem("rack-1.0.0")).not_to exist + expect(cached_gem("myrack-1.2")).to exist + expect(cached_gem("myrack-1.0.0")).not_to exist end it "adds new gems and dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails" G expect(cached_gem("rails-2.3.2")).to exist @@ -246,23 +246,23 @@ RSpec.describe "bundle cache" do it "removes .gems for removed gems and dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" G - expect(cached_gem("rack-1.0.0")).to exist + expect(cached_gem("myrack-1.0.0")).to exist expect(cached_gem("actionpack-2.3.2")).not_to exist expect(cached_gem("activesupport-2.3.2")).not_to exist end it "removes .gems when gem changes to git source" do - build_git "rack" + build_git "myrack" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack", :git => "#{lib_path("rack-1.0")}" + source "https://gem.repo2" + gem "myrack", :git => "#{lib_path("myrack-1.0")}" gem "actionpack" G - expect(cached_gem("rack-1.0.0")).not_to exist + expect(cached_gem("myrack-1.0.0")).not_to exist expect(cached_gem("actionpack-2.3.2")).to exist expect(cached_gem("activesupport-2.3.2")).to exist end @@ -270,7 +270,7 @@ RSpec.describe "bundle cache" do it "doesn't remove gems that are for another platform" do simulate_platform "java" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -280,7 +280,7 @@ RSpec.describe "bundle cache" do simulate_new_machine install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -288,62 +288,78 @@ RSpec.describe "bundle cache" do expect(cached_gem("platform_specific-1.0-java")).to exist end - it "doesn't remove gems with mismatched :rubygems_version or :date" do - cached_gem("rack-1.0.0").rmtree - build_gem "rack", "1.0.0", - path: bundled_app("vendor/cache"), + it "doesn't remove gems cached gems that don't match their remote counterparts, but also refuses to install and prints an error" do + cached_myrack = cached_gem("myrack-1.0.0") + cached_myrack.rmtree + build_gem "myrack", "1.0.0", + path: cached_myrack.parent, rubygems_version: "1.3.2" - # This test is only really valid if the checksum isn't saved. It otherwise can't be the same gem. Tested below. - bundled_app_lock.write remove_checksums_from_lockfile(bundled_app_lock.read, "rack (1.0.0)") + simulate_new_machine - bundle :install - expect(cached_gem("rack-1.0.0")).to exist + bundle :install, raise_on_error: false + + expect(err).to eq <<~E.strip + Bundler found mismatched checksums. This is a potential security risk. + #{checksum_to_lock(gem_repo2, "myrack", "1.0.0")} + from the API at https://gem.repo2/ + #{checksum_from_package(cached_myrack, "myrack", "1.0.0")} + from the gem at #{cached_myrack} + + If you trust the API at https://gem.repo2/, to resolve this issue you can: + 1. remove the gem at #{cached_myrack} + 2. run `bundle install` + + To ignore checksum security warnings, disable checksum validation with + `bundle config set --local disable_checksum_validation true` + E + + expect(cached_gem("myrack-1.0.0")).to exist end - it "raises an error when the gem is altered and produces a different checksum" do - cached_gem("rack-1.0.0").rmtree - build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") + it "raises an error when a cached gem is altered and produces a different checksum than the remote gem" do + cached_gem("myrack-1.0.0").rmtree + build_gem "myrack", "1.0.0", path: bundled_app("vendor/cache") checksums = checksums_section do |c| - c.checksum gem_repo1, "rack", "1.0.0" + c.checksum gem_repo1, "myrack", "1.0.0" end simulate_new_machine lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) #{checksums} L bundle :install, raise_on_error: false expect(exitstatus).to eq(37) expect(err).to include("Bundler found mismatched checksums.") - expect(err).to include("1. remove the gem at #{cached_gem("rack-1.0.0")}") + expect(err).to include("1. remove the gem at #{cached_gem("myrack-1.0.0")}") - expect(cached_gem("rack-1.0.0")).to exist - cached_gem("rack-1.0.0").rmtree + expect(cached_gem("myrack-1.0.0")).to exist + cached_gem("myrack-1.0.0").rmtree bundle :install - expect(cached_gem("rack-1.0.0")).to exist + expect(cached_gem("myrack-1.0.0")).to exist end - it "installs a modified gem with a non-matching checksum when checksums is not opted in" do - cached_gem("rack-1.0.0").rmtree - build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") + it "installs a modified gem with a non-matching checksum when the API implementation does not provide checksums" do + cached_gem("myrack-1.0.0").rmtree + build_gem "myrack", "1.0.0", path: bundled_app("vendor/cache") simulate_new_machine lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) L - bundle :install - expect(cached_gem("rack-1.0.0")).to exist + bundle :install, artifice: "endpoint", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + expect(cached_gem("myrack-1.0.0")).to exist end it "handles directories and non .gem files in the cache" do @@ -354,8 +370,8 @@ RSpec.describe "bundle cache" do it "does not say that it is removing gems when it isn't actually doing so" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "cache" bundle "install" @@ -364,8 +380,8 @@ RSpec.describe "bundle cache" do it "does not warn about all if it doesn't have any git/path dependency" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "cache" expect(out).not_to match(/\-\-all/) @@ -376,7 +392,7 @@ RSpec.describe "bundle cache" do path: bundled_app("vendor/cache") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo-bundler" G diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb index 51897ebe20..81b0fd1d31 100644 --- a/spec/bundler/cache/git_spec.rb +++ b/spec/bundler/cache/git_spec.rb @@ -18,7 +18,7 @@ RSpec.describe "bundle cache with git" do ref = git.ref_for("main", 11) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G @@ -37,7 +37,7 @@ RSpec.describe "bundle cache with git" do ref = git.ref_for("main", 11) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G @@ -57,7 +57,7 @@ RSpec.describe "bundle cache with git" do build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G @@ -75,7 +75,7 @@ RSpec.describe "bundle cache with git" do old_ref = git.ref_for("main", 11) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G @@ -105,7 +105,7 @@ RSpec.describe "bundle cache with git" do old_ref = git.ref_for("main", 11) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G @@ -134,7 +134,7 @@ RSpec.describe "bundle cache with git" do ref = git.ref_for("main", 11) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :main G @@ -168,7 +168,7 @@ RSpec.describe "bundle cache with git" do git "commit -m \"submodulator\"", lib_path("has_submodule-1.0") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("has_submodule-1.0")}", :submodules => true do gem "has_submodule" end @@ -192,7 +192,7 @@ RSpec.describe "bundle cache with git" do update_git("foo") {|s| s.write "foo.gemspec", spec_lines.join("\n") } install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G bundle "config set cache_all true" @@ -207,7 +207,7 @@ RSpec.describe "bundle cache with git" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G bundle "config set cache_all true" @@ -226,7 +226,7 @@ RSpec.describe "bundle cache with git" do ref = git.ref_for("main", 11) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G bundle "config set cache_all true" diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb index 2c8a52617a..966cb6f531 100644 --- a/spec/bundler/cache/path_spec.rb +++ b/spec/bundler/cache/path_spec.rb @@ -5,7 +5,7 @@ RSpec.describe "bundle cache with path" do build_lib "foo", path: bundled_app("lib/foo") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{bundled_app("lib/foo")}' G @@ -19,7 +19,7 @@ RSpec.describe "bundle cache with path" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' G @@ -38,7 +38,7 @@ RSpec.describe "bundle cache with path" do build_lib libname, path: libpath install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "#{libname}", :path => '#{libpath}' G @@ -54,7 +54,7 @@ RSpec.describe "bundle cache with path" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' G @@ -77,7 +77,7 @@ RSpec.describe "bundle cache with path" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' G @@ -89,7 +89,7 @@ RSpec.describe "bundle cache with path" do build_lib "bar" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :path => '#{lib_path("bar-1.0")}' G @@ -101,7 +101,7 @@ RSpec.describe "bundle cache with path" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' G @@ -114,7 +114,7 @@ RSpec.describe "bundle cache with path" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' G @@ -127,7 +127,7 @@ RSpec.describe "bundle cache with path" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' G @@ -136,7 +136,7 @@ RSpec.describe "bundle cache with path" do build_lib "bar" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' gem "bar", :path => '#{lib_path("bar-1.0")}' G @@ -149,7 +149,7 @@ RSpec.describe "bundle cache with path" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' G @@ -158,7 +158,7 @@ RSpec.describe "bundle cache with path" do build_lib "baz" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => '#{lib_path("foo-1.0")}' gem "baz", :path => '#{lib_path("baz-1.0")}' G diff --git a/spec/bundler/cache/platform_spec.rb b/spec/bundler/cache/platform_spec.rb index 36db954c79..71c0eaee8e 100644 --- a/spec/bundler/cache/platform_spec.rb +++ b/spec/bundler/cache/platform_spec.rb @@ -3,10 +3,10 @@ RSpec.describe "bundle cache with multiple platforms" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" platforms :mri, :rbx do - gem "rack", "1.0.0" + gem "myrack", "1.0.0" end platforms :jruby do @@ -16,9 +16,9 @@ RSpec.describe "bundle cache with multiple platforms" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) activesupport (2.3.5) PLATFORMS @@ -26,24 +26,24 @@ RSpec.describe "bundle cache with multiple platforms" do java DEPENDENCIES - rack (1.0.0) + myrack (1.0.0) activesupport (2.3.5) G - cache_gems "rack-1.0.0", "activesupport-2.3.5" + cache_gems "myrack-1.0.0", "activesupport-2.3.5" end it "ensures that a successful bundle install does not delete gems for other platforms" do bundle "install" - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist end it "ensures that a successful bundle update does not delete gems for other platforms" do bundle "update", all: true - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist end end diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb index 36e286793b..f549e4f8bc 100644 --- a/spec/bundler/commands/add_spec.rb +++ b/spec/bundler/commands/add_spec.rb @@ -15,7 +15,7 @@ RSpec.describe "bundle add" do build_git "foo", "2.0" gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "weakling", "~> 0.0.1" G end @@ -104,9 +104,9 @@ RSpec.describe "bundle add" do describe "with --source" do it "adds dependency with specified source" do - bundle "add 'foo' --source='#{file_uri_for(gem_repo2)}'" + bundle "add 'foo' --source='https://gem.repo2'" - expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :source => "#{file_uri_for(gem_repo2)}"/) + expect(bundled_app_gemfile.read).to match(%r{gem "foo", "~> 2.0", :source => "https://gem.repo2"}) expect(the_bundle).to include_gems "foo 2.0" end end @@ -152,7 +152,7 @@ RSpec.describe "bundle add" do end describe "with --github" do - it "adds dependency with specified github source", :realworld do + it "adds dependency with specified github source" do bundle "add rake --github=ruby/rake" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.\d+", :github => "ruby\/rake"}) @@ -160,7 +160,7 @@ RSpec.describe "bundle add" do end describe "with --github and --branch" do - it "adds dependency with specified github source and branch", :realworld do + it "adds dependency with specified github source and branch" do bundle "add rake --github=ruby/rake --branch=master" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.\d+", :github => "ruby\/rake", :branch => "master"}) @@ -168,7 +168,7 @@ RSpec.describe "bundle add" do end describe "with --github and --ref" do - it "adds dependency with specified github source and ref", :realworld do + it "adds dependency with specified github source and ref" do bundle "add rake --github=ruby/rake --ref=5c60da8" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.\d+", :github => "ruby\/rake", :ref => "5c60da8"}) @@ -207,7 +207,7 @@ RSpec.describe "bundle add" do end describe "with --github and --glob" do - it "adds dependency with specified github source", :realworld do + it "adds dependency with specified github source" do bundle "add rake --github=ruby/rake --glob='./*.gemspec'" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.\d+", :github => "ruby\/rake", :glob => "\.\/\*\.gemspec"}) @@ -215,7 +215,7 @@ RSpec.describe "bundle add" do end describe "with --github and --branch --and glob" do - it "adds dependency with specified github source and branch", :realworld do + it "adds dependency with specified github source and branch" do bundle "add rake --github=ruby/rake --branch=master --glob='./*.gemspec'" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.\d+", :github => "ruby\/rake", :branch => "master", :glob => "\.\/\*\.gemspec"}) @@ -223,7 +223,7 @@ RSpec.describe "bundle add" do end describe "with --github and --ref and --glob" do - it "adds dependency with specified github source and ref", :realworld do + it "adds dependency with specified github source and ref" do bundle "add rake --github=ruby/rake --ref=5c60da8 --glob='./*.gemspec'" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.\d+", :github => "ruby\/rake", :ref => "5c60da8", :glob => "\.\/\*\.gemspec"}) @@ -240,8 +240,8 @@ RSpec.describe "bundle add" do end it "using combination of short form options works like long form" do - bundle "add 'foo' -s='#{file_uri_for(gem_repo2)}' -g='development' -v='~>1.0'" - expect(bundled_app_gemfile.read).to include %(gem "foo", "~> 1.0", :group => :development, :source => "#{file_uri_for(gem_repo2)}") + bundle "add 'foo' -s='https://gem.repo2' -g='development' -v='~>1.0'" + expect(bundled_app_gemfile.read).to include %(gem "foo", "~> 1.0", :group => :development, :source => "https://gem.repo2") expect(the_bundle).to include_gems "foo 1.1" end @@ -255,12 +255,12 @@ RSpec.describe "bundle add" do bundle "add 'werk_it'", raise_on_error: false expect(err).to match("Could not find gem 'werk_it' in") - bundle "add 'werk_it' -s='#{file_uri_for(gem_repo2)}'", raise_on_error: false + bundle "add 'werk_it' -s='https://gem.repo2'", raise_on_error: false expect(err).to match("Could not find gem 'werk_it' in rubygems repository") end it "shows error message when source cannot be reached" do - bundle "add 'baz' --source='http://badhostasdf'", raise_on_error: false + bundle "add 'baz' --source='http://badhostasdf'", raise_on_error: false, artifice: "fail" expect(err).to include("Could not reach host badhostasdf. Check your network connection and try again.") bundle "add 'baz' --source='file://does/not/exist'", raise_on_error: false @@ -318,41 +318,41 @@ RSpec.describe "bundle add" do describe "when a gem is added which is already specified in Gemfile with version" do it "shows an error when added with different version requirement" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack", "1.0" + source "https://gem.repo2" + gem "myrack", "1.0" G - bundle "add 'rack' --version=1.1", raise_on_error: false + bundle "add 'myrack' --version=1.1", raise_on_error: false expect(err).to include("You cannot specify the same gem twice with different version requirements") - expect(err).to include("If you want to update the gem version, run `bundle update rack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive") + expect(err).to include("If you want to update the gem version, run `bundle update myrack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive") end it "shows error when added without version requirements" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack", "1.0" + source "https://gem.repo2" + gem "myrack", "1.0" G - bundle "add 'rack'", raise_on_error: false + bundle "add 'myrack'", raise_on_error: false expect(err).to include("Gem already added.") expect(err).to include("You cannot specify the same gem twice with different version requirements") - expect(err).not_to include("If you want to update the gem version, run `bundle update rack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive") + expect(err).not_to include("If you want to update the gem version, run `bundle update myrack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive") end end describe "when a gem is added which is already specified in Gemfile without version" do it "shows an error when added with different version requirement" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" G - bundle "add 'rack' --version=1.1", raise_on_error: false + bundle "add 'myrack' --version=1.1", raise_on_error: false expect(err).to include("You cannot specify the same gem twice with different version requirements") - expect(err).to include("If you want to update the gem version, run `bundle update rack`.") + expect(err).to include("If you want to update the gem version, run `bundle update myrack`.") expect(err).not_to include("You may also need to change the version requirement specified in the Gemfile if it's too restrictive") end end @@ -361,8 +361,8 @@ RSpec.describe "bundle add" do it "caches all new dependencies added for the specified gem" do bundle :cache - bundle "add 'rack' --version=1.0.0" - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + bundle "add 'myrack' --version=1.0.0" + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end end end diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb index 6c3dc7bb2d..74582226f8 100644 --- a/spec/bundler/commands/binstubs_spec.rb +++ b/spec/bundler/commands/binstubs_spec.rb @@ -4,44 +4,44 @@ RSpec.describe "bundle binstubs <gem>" do context "when the gem exists in the lockfile" do it "sets up the binstub" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack" + bundle "binstubs myrack" - expect(bundled_app("bin/rackup")).to exist + expect(bundled_app("bin/myrackup")).to exist end it "does not install other binstubs" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "rails" G bundle "binstubs rails" - expect(bundled_app("bin/rackup")).not_to exist + expect(bundled_app("bin/myrackup")).not_to exist expect(bundled_app("bin/rails")).to exist end it "does install multiple binstubs" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "rails" G - bundle "binstubs rails rack" + bundle "binstubs rails myrack" - expect(bundled_app("bin/rackup")).to exist + expect(bundled_app("bin/myrackup")).to exist expect(bundled_app("bin/rails")).to exist end it "allows installing all binstubs" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -53,20 +53,20 @@ RSpec.describe "bundle binstubs <gem>" do it "allows installing binstubs for all platforms" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack --all-platforms" + bundle "binstubs myrack --all-platforms" - expect(bundled_app("bin/rackup")).to exist - expect(bundled_app("bin/rackup.cmd")).to exist + expect(bundled_app("bin/myrackup")).to exist + expect(bundled_app("bin/myrackup.cmd")).to exist end it "displays an error when used without any gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "binstubs", raise_on_error: false @@ -76,11 +76,11 @@ RSpec.describe "bundle binstubs <gem>" do it "displays an error when used with --all and gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack", all: true, raise_on_error: false + bundle "binstubs myrack", all: true, raise_on_error: false expect(last_command).to be_failure expect(err).to include("Cannot specify --all with specific gems") end @@ -88,17 +88,17 @@ RSpec.describe "bundle binstubs <gem>" do context "when generating bundle binstub outside bundler" do it "should abort" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack" + bundle "binstubs myrack" File.open(bundled_app("bin/bundle"), "wb") do |file| file.print "OMG" end - sys_exec "bin/rackup", raise_on_error: false + sys_exec "bin/myrackup", raise_on_error: false expect(err).to include("was not generated by Bundler") end @@ -108,8 +108,8 @@ RSpec.describe "bundle binstubs <gem>" do before do pristine_system_gems "bundler-#{system_bundler_version}" build_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "prints_loaded_gems", "1.0" do |s| @@ -120,25 +120,29 @@ RSpec.describe "bundle binstubs <gem>" do puts specs.map(&:full_name).sort.inspect R end + + build_bundler locked_bundler_version end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" gem "prints_loaded_gems" G - bundle "binstubs bundler rack prints_loaded_gems" + bundle "binstubs bundler myrack prints_loaded_gems" end let(:system_bundler_version) { Bundler::VERSION } + let(:locked_bundler_version) { nil } + let(:lockfile_content) { lockfile.gsub(system_bundler_version, locked_bundler_version) } it "runs bundler" do - sys_exec "bin/bundle install", env: { "DEBUG" => "1" } + bundle "install --verbose", bundle_bin: "bin/bundle" expect(out).to include %(Using bundler #{system_bundler_version}\n) end context "when BUNDLER_VERSION is set" do it "runs the correct version of bundler" do - sys_exec "bin/bundle install", env: { "BUNDLER_VERSION" => "999.999.999" }, raise_on_error: false + bundle "install", env: { "BUNDLER_VERSION" => "999.999.999" }, raise_on_error: false, bundle_bin: "bin/bundle" expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (999.999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`") @@ -147,19 +151,21 @@ RSpec.describe "bundle binstubs <gem>" do it "runs the correct version of bundler even if a higher version is installed" do system_gems "bundler-999.999.998", "bundler-999.999.999" - sys_exec "bin/bundle install", env: { "BUNDLER_VERSION" => "999.999.998", "DEBUG" => "1" }, raise_on_error: false + bundle "install --verbose", env: { "BUNDLER_VERSION" => "999.999.998" }, raise_on_error: false, bundle_bin: "bin/bundle" expect(out).to include %(Using bundler 999.999.998\n) end end context "when a lockfile exists with a locked bundler version" do + let(:locked_bundler_version) { "999.999" } + context "and the version is newer" do before do - lockfile lockfile.gsub(system_bundler_version, "999.999") + lockfile lockfile_content end it "runs the correct version of bundler" do - sys_exec "bin/bundle install", raise_on_error: false + bundle "install", raise_on_error: false, bundle_bin: "bin/bundle" expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") @@ -169,11 +175,11 @@ RSpec.describe "bundle binstubs <gem>" do context "and the version is newer when given `gems.rb` and `gems.locked`" do before do gemfile bundled_app("gems.rb"), gemfile - lockfile bundled_app("gems.locked"), lockfile.gsub(system_bundler_version, "999.999") + lockfile bundled_app("gems.locked"), lockfile_content end it "runs the correct version of bundler" do - sys_exec "bin/bundle install", env: { "BUNDLE_GEMFILE" => "gems.rb" }, raise_on_error: false + bundle "install", env: { "BUNDLE_GEMFILE" => "gems.rb" }, raise_on_error: false, bundle_bin: "bin/bundle" expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). @@ -183,13 +189,14 @@ RSpec.describe "bundle binstubs <gem>" do context "and the version is older and a different major" do let(:system_bundler_version) { "55" } + let(:locked_bundler_version) { "44" } before do - lockfile lockfile.gsub(/BUNDLED WITH\n .*$/m, "BUNDLED WITH\n 44.0") + lockfile lockfile_content end it "runs the correct version of bundler" do - sys_exec "bin/bundle install", raise_on_error: false + bundle "install", raise_on_error: false, bundle_bin: "bin/bundle" expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 44.0) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`") @@ -198,14 +205,15 @@ RSpec.describe "bundle binstubs <gem>" do context "and the version is older and a different major when given `gems.rb` and `gems.locked`" do let(:system_bundler_version) { "55" } + let(:locked_bundler_version) { "44" } before do gemfile bundled_app("gems.rb"), gemfile - lockfile bundled_app("gems.locked"), lockfile.gsub(/BUNDLED WITH\n .*$/m, "BUNDLED WITH\n 44.0") + lockfile bundled_app("gems.locked"), lockfile_content end it "runs the correct version of bundler" do - sys_exec "bin/bundle install", env: { "BUNDLE_GEMFILE" => "gems.rb" }, raise_on_error: false + bundle "install", env: { "BUNDLE_GEMFILE" => "gems.rb" }, raise_on_error: false, bundle_bin: "bin/bundle" expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 44.0) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`") @@ -214,13 +222,14 @@ RSpec.describe "bundle binstubs <gem>" do context "and the version is older and the same major" do let(:system_bundler_version) { "2.999.999" } + let(:locked_bundler_version) { "2.3.0" } before do - lockfile lockfile.gsub(/BUNDLED WITH\n .*$/m, "BUNDLED WITH\n 2.3.0") + lockfile lockfile_content end - it "installs and runs the exact version of bundler", rubygems: ">= 3.3.0.dev", realworld: true do - sys_exec "bin/bundle install --verbose", artifice: "vcr" + it "installs and runs the exact version of bundler", rubygems: ">= 3.3.0.dev" do + bundle "install --verbose", bundle_bin: "bin/bundle" expect(exitstatus).not_to eq(42) expect(out).to include("Bundler 2.999.999 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version.") expect(out).to include("Using bundler 2.3.0") @@ -228,7 +237,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the available version of bundler", rubygems: "< 3.3.0.dev" do - sys_exec "bin/bundle install --verbose" + bundle "install --verbose", bundle_bin: "bin/bundle" expect(exitstatus).not_to eq(42) expect(out).not_to include("Bundler 2.999.999 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version.") expect(out).to include("Using bundler 2.999.999") @@ -238,13 +247,14 @@ RSpec.describe "bundle binstubs <gem>" do context "and the version is a pre-releaser" do let(:system_bundler_version) { "55" } + let(:locked_bundler_version) { "2.12.0.a" } before do - lockfile lockfile.gsub(/BUNDLED WITH\n .*$/m, "BUNDLED WITH\n 2.12.0.a") + lockfile lockfile_content end it "runs the correct version of bundler when the version is a pre-release" do - sys_exec "bin/bundle install", raise_on_error: false + bundle "install", raise_on_error: false, bundle_bin: "bin/bundle" expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 2.12.a) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 2.12.a'`") @@ -253,10 +263,8 @@ RSpec.describe "bundle binstubs <gem>" do end context "when update --bundler is called" do - before { lockfile.gsub(system_bundler_version, "1.1.1") } - - it "calls through to the latest bundler version", :realworld do - sys_exec "bin/bundle update --bundler", env: { "DEBUG" => "1" } + it "calls through to the latest bundler version" do + bundle "update --bundler --verbose", bundle_bin: "bin/bundle" using_bundler_line = /Using bundler ([\w\.]+)\n/.match(out) expect(using_bundler_line).to_not be_nil latest_version = using_bundler_line[1] @@ -264,7 +272,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "calls through to the explicit bundler version" do - sys_exec "bin/bundle update --bundler=999.999.999", raise_on_error: false + bundle "update --bundler=999.999.999", raise_on_error: false, bundle_bin: "bin/bundle" expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (999.999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`") @@ -274,7 +282,7 @@ RSpec.describe "bundle binstubs <gem>" do context "without a lockfile" do it "falls back to the latest installed bundler" do FileUtils.rm bundled_app_lock - sys_exec "bin/bundle install", env: { "DEBUG" => "1" } + bundle "install --verbose", bundle_bin: "bin/bundle" expect(out).to include "Using bundler #{system_bundler_version}\n" end end @@ -282,14 +290,14 @@ RSpec.describe "bundle binstubs <gem>" do context "using another binstub" do it "loads all gems" do sys_exec bundled_app("bin/print_loaded_gems").to_s - expect(out).to eq %(["bundler-#{Bundler::VERSION}", "prints_loaded_gems-1.0", "rack-1.2"]) + expect(out).to eq %(["bundler-#{Bundler::VERSION}", "myrack-1.2", "prints_loaded_gems-1.0"]) end context "when requesting a different bundler version" do before { lockfile lockfile.gsub(Bundler::VERSION, "999.999.999") } it "attempts to load that version" do - sys_exec bundled_app("bin/rackup").to_s, raise_on_error: false + sys_exec bundled_app("bin/myrackup").to_s, raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") @@ -305,7 +313,7 @@ RSpec.describe "bundle binstubs <gem>" do s.executables = %w[foo] end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo")}" G @@ -321,7 +329,7 @@ RSpec.describe "bundle binstubs <gem>" do s.executables = %w[foo] end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" G @@ -333,12 +341,12 @@ RSpec.describe "bundle binstubs <gem>" do it "sets correct permissions for binstubs" do with_umask(0o002) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack" - binary = bundled_app("bin/rackup") + bundle "binstubs myrack" + binary = bundled_app("bin/myrackup") expect(File.stat(binary).mode.to_s(8)).to eq(Gem.win_platform? ? "100644" : "100775") end end @@ -346,12 +354,12 @@ RSpec.describe "bundle binstubs <gem>" do context "when using --shebang" do it "sets the specified shebang for the binstub" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack --shebang jruby" - expect(File.readlines(bundled_app("bin/rackup")).first).to eq("#!/usr/bin/env jruby\n") + bundle "binstubs myrack --shebang jruby" + expect(File.readlines(bundled_app("bin/myrackup")).first).to eq("#!/usr/bin/env jruby\n") end end end @@ -359,7 +367,7 @@ RSpec.describe "bundle binstubs <gem>" do context "when the gem doesn't exist" do it "displays an error with correct status" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G bundle "binstubs doesnt_exist", raise_on_error: false @@ -372,23 +380,23 @@ RSpec.describe "bundle binstubs <gem>" do context "--path" do it "sets the binstubs dir" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack --path exec" + bundle "binstubs myrack --path exec" - expect(bundled_app("exec/rackup")).to exist + expect(bundled_app("exec/myrackup")).to exist end it "setting is saved for bundle install", bundler: "< 3" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "rails" G - bundle "binstubs rack", path: "exec" + bundle "binstubs myrack", path: "exec" bundle :install expect(bundled_app("exec/rails")).to exist @@ -398,34 +406,34 @@ RSpec.describe "bundle binstubs <gem>" do context "with --standalone option" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "rails" G end it "generates a standalone binstub" do - bundle "binstubs rack --standalone" - expect(bundled_app("bin/rackup")).to exist + bundle "binstubs myrack --standalone" + expect(bundled_app("bin/myrackup")).to exist end it "generates a binstub that does not depend on rubygems or bundler" do - bundle "binstubs rack --standalone" - expect(File.read(bundled_app("bin/rackup"))).to_not include("Gem.bin_path") + bundle "binstubs myrack --standalone" + expect(File.read(bundled_app("bin/myrackup"))).to_not include("Gem.bin_path") end context "when specified --path option" do it "generates a standalone binstub at the given path" do - bundle "binstubs rack --standalone --path foo" - expect(bundled_app("foo/rackup")).to exist + bundle "binstubs myrack --standalone --path foo" + expect(bundled_app("foo/myrackup")).to exist end end context "when specified --all-platforms option" do it "generates standalone binstubs for all platforms" do - bundle "binstubs rack --standalone --all-platforms" - expect(bundled_app("bin/rackup")).to exist - expect(bundled_app("bin/rackup.cmd")).to exist + bundle "binstubs myrack --standalone --all-platforms" + expect(bundled_app("bin/myrackup")).to exist + expect(bundled_app("bin/myrackup.cmd")).to exist end end @@ -441,7 +449,7 @@ RSpec.describe "bundle binstubs <gem>" do context "when specified --all option" do it "generates standalone binstubs for all gems except bundler" do bundle "binstubs --standalone --all" - expect(bundled_app("bin/rackup")).to exist + expect(bundled_app("bin/myrackup")).to exist expect(bundled_app("bin/rails")).to exist expect(bundled_app("bin/bundle")).not_to exist expect(bundled_app("bin/bundler")).not_to exist @@ -453,39 +461,39 @@ RSpec.describe "bundle binstubs <gem>" do context "when the bin already exists" do it "doesn't overwrite and warns" do FileUtils.mkdir_p(bundled_app("bin")) - File.open(bundled_app("bin/rackup"), "wb") do |file| + File.open(bundled_app("bin/myrackup"), "wb") do |file| file.print "OMG" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack" + bundle "binstubs myrack" - expect(bundled_app("bin/rackup")).to exist - expect(File.read(bundled_app("bin/rackup"))).to eq("OMG") - expect(err).to include("Skipped rackup") + expect(bundled_app("bin/myrackup")).to exist + expect(File.read(bundled_app("bin/myrackup"))).to eq("OMG") + expect(err).to include("Skipped myrackup") expect(err).to include("overwrite skipped stubs, use --force") end context "when using --force" do it "overwrites the binstub" do FileUtils.mkdir_p(bundled_app("bin")) - File.open(bundled_app("bin/rackup"), "wb") do |file| + File.open(bundled_app("bin/myrackup"), "wb") do |file| file.print "OMG" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "binstubs rack --force" + bundle "binstubs myrack --force" - expect(bundled_app("bin/rackup")).to exist - expect(File.read(bundled_app("bin/rackup"))).not_to eq("OMG") + expect(bundled_app("bin/myrackup")).to exist + expect(File.read(bundled_app("bin/myrackup"))).not_to eq("OMG") end end end @@ -493,18 +501,18 @@ RSpec.describe "bundle binstubs <gem>" do context "when the gem has no bins" do it "suggests child gems if they have bins" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack-obama" G - bundle "binstubs rack-obama" - expect(err).to include("rack-obama has no executables") - expect(err).to include("rack has: rackup") + bundle "binstubs myrack-obama" + expect(err).to include("myrack-obama has no executables") + expect(err).to include("myrack has: myrackup") end it "works if child gems don't have bins" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "actionpack" G @@ -520,7 +528,7 @@ RSpec.describe "bundle binstubs <gem>" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "with_development_dependency" G @@ -532,25 +540,25 @@ RSpec.describe "bundle binstubs <gem>" do context "when BUNDLE_INSTALL is specified" do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "config set auto_install 1" - bundle "binstubs rack" - expect(out).to include("Installing rack 1.0.0") - expect(the_bundle).to include_gems "rack 1.0.0" + bundle "binstubs myrack" + expect(out).to include("Installing myrack 1.0.0") + expect(the_bundle).to include_gems "myrack 1.0.0" end it "does nothing when already up to date" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "config set auto_install 1" - bundle "binstubs rack", env: { "BUNDLE_INSTALL" => "1" } - expect(out).not_to include("Installing rack 1.0.0") + bundle "binstubs myrack", env: { "BUNDLE_INSTALL" => "1" } + expect(out).not_to include("Installing myrack 1.0.0") end end end diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb index 37d8b3ac1a..f6ea29a6b9 100644 --- a/spec/bundler/commands/cache_spec.rb +++ b/spec/bundler/commands/cache_spec.rb @@ -3,8 +3,8 @@ RSpec.describe "bundle cache" do it "doesn't update the cache multiple times, even if it already exists" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle :cache @@ -17,14 +17,14 @@ RSpec.describe "bundle cache" do context "with --gemfile" do it "finds the gemfile" do gemfile bundled_app("NotGemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle "cache --gemfile=NotGemfile" ENV["BUNDLE_GEMFILE"] = "NotGemfile" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end @@ -32,15 +32,15 @@ RSpec.describe "bundle cache" do context "without a gemspec" do it "caches all dependencies except bundler itself" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' gem 'bundler' D bundle "config set cache_all true" bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/bundler-0.9.gem")).to_not exist end end @@ -63,15 +63,15 @@ RSpec.describe "bundle cache" do it "caches all dependencies except bundler and the gemspec specified gem" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' gemspec D bundle "config set cache_all true" bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist expect(bundled_app("vendor/cache/mygem-0.1.1.gem")).to_not exist expect(bundled_app("vendor/cache/bundler-0.9.gem")).to_not exist @@ -95,15 +95,15 @@ RSpec.describe "bundle cache" do it "caches all dependencies except bundler and the gemspec specified gem" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' gemspec D bundle "config set cache_all true" bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist expect(bundled_app("vendor/cache/mygem-0.1.1.gem")).to_not exist expect(bundled_app("vendor/cache/bundler-0.9.gem")).to_not exist @@ -139,8 +139,8 @@ RSpec.describe "bundle cache" do it "caches all dependencies except bundler and the gemspec specified gems" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' gemspec :name => 'mygem' gemspec :name => 'mygem_test' D @@ -148,7 +148,7 @@ RSpec.describe "bundle cache" do bundle "config set cache_all true" bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist expect(bundled_app("vendor/cache/weakling-0.0.3.gem")).to exist expect(bundled_app("vendor/cache/mygem-0.1.1.gem")).to_not exist @@ -161,13 +161,13 @@ RSpec.describe "bundle cache" do context "with --path", bundler: "< 3" do it "sets root directory for gems" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' D bundle "cache --path #{bundled_app("test")}" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(bundled_app("test/vendor/cache/")).to exist end end @@ -175,60 +175,60 @@ RSpec.describe "bundle cache" do context "with --no-install" do it "puts the gems in vendor/cache but does not install them" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' D bundle "cache --no-install" - expect(the_bundle).not_to include_gems "rack 1.0.0" - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(the_bundle).not_to include_gems "myrack 1.0.0" + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end it "does not prevent installing gems with bundle install" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' D bundle "cache --no-install" bundle "install" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "does not prevent installing gems with bundle update" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" D bundle "cache --no-install" bundle "update --all" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end context "with --all-platforms" do it "puts the gems in vendor/cache even for other rubies", bundler: ">= 2.4.0" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack', :platforms => [:ruby_20, :windows_20] + source "https://gem.repo1" + gem 'myrack', :platforms => [:ruby_20, :windows_20] D bundle "cache --all-platforms" - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end it "puts the gems in vendor/cache even for legacy windows rubies", bundler: ">= 2.4.0" do gemfile <<-D - source "#{file_uri_for(gem_repo1)}" - gem 'rack', :platforms => [:ruby_20, :x64_mingw_20] + source "https://gem.repo1" + gem 'myrack', :platforms => [:ruby_20, :x64_mingw_20] D bundle "cache --all-platforms" - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end it "does not attempt to install gems in without groups" do @@ -241,39 +241,39 @@ RSpec.describe "bundle cache" do end bundle "config set --local without wo" - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + install_gemfile <<-G, artifice: "compact_index_extra_api" + source "https://main.repo" + gem "myrack" group :wo do gem "weakling" - gem "uninstallable", :source => "#{file_uri_for(gem_repo4)}" + gem "uninstallable", :source => "https://main.repo/extra" end G - bundle :cache, "all-platforms" => true + bundle :cache, "all-platforms" => true, artifice: "compact_index_extra_api" expect(bundled_app("vendor/cache/weakling-0.0.3.gem")).to exist expect(bundled_app("vendor/cache/uninstallable-2.0.gem")).to exist - expect(the_bundle).to include_gem "rack 1.0" + expect(the_bundle).to include_gem "myrack 1.0" expect(the_bundle).not_to include_gems "weakling", "uninstallable" bundle "config set --local without wo" - bundle :install - expect(the_bundle).to include_gem "rack 1.0" - expect(the_bundle).not_to include_gems "weakling", "uninstallable" + bundle :install, artifice: "compact_index_extra_api" + expect(the_bundle).to include_gem "myrack 1.0" + expect(the_bundle).not_to include_gems "weakling" end it "does not fail to cache gems in excluded groups when there's a lockfile but gems not previously installed" do bundle "config set --local without wo" gemfile <<-G - source "https://my.gem.repo.1" - gem "rack" + source "https://gem.repo1" + gem "myrack" group :wo do gem "weakling" end G - bundle :lock, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } - bundle :cache, "all-platforms" => true, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } + bundle :lock + bundle :cache, "all-platforms" => true expect(bundled_app("vendor/cache/weakling-0.0.3.gem")).to exist end end @@ -281,8 +281,8 @@ RSpec.describe "bundle cache" do context "with frozen configured" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "install" end @@ -295,15 +295,15 @@ RSpec.describe "bundle cache" do it "tries to install with frozen" do bundle "config set deployment true" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G subject expect(exitstatus).to eq(16) expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") - expect(err).to include("* rack-obama") + expect(err).to include("* myrack-obama") bundle "env" expect(out).to include("frozen").or include("deployment") end @@ -315,12 +315,12 @@ RSpec.describe "bundle cache" do build_gem "racc", "2.0" do |s| s.add_dependency "rake" s.extensions << "Rakefile" - s.write "Rakefile", "task(:default) { puts 'INSTALLING rack' }" + s.write "Rakefile", "task(:default) { puts 'INSTALLING myrack' }" end end gemfile <<~G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "racc" G @@ -339,8 +339,8 @@ RSpec.describe "bundle install with gem sources" do it "does not hit the remote at all" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" G bundle :cache @@ -348,14 +348,14 @@ RSpec.describe "bundle install with gem sources" do FileUtils.rm_rf gem_repo2 bundle "install --local" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "does not hit the remote at all in frozen mode" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" G bundle :cache @@ -365,14 +365,14 @@ RSpec.describe "bundle install with gem sources" do bundle "config set --local deployment true" bundle "config set --local path vendor/bundle" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "does not hit the remote at all when cache_all_platforms configured" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" G bundle :cache @@ -383,7 +383,7 @@ RSpec.describe "bundle install with gem sources" do bundle "config set --local path vendor/bundle" bundle "install --local" expect(out).not_to include("Fetching gem metadata") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "uses cached gems for secondary sources when cache_all_platforms configured" do @@ -398,20 +398,20 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<~G - source "https://gems.repo2" + source "https://gem.repo2" - source "https://gems.repo4" do + source "https://gem.repo4" do gem "foo" end G lockfile <<~L GEM - remote: https://gems.repo2/ + remote: https://gem.repo2/ specs: GEM - remote: https://gems.repo4/ + remote: https://gem.repo4/ specs: foo (1.0.0-x86_64-linux) foo (1.0.0-arm64-darwin) @@ -448,24 +448,24 @@ RSpec.describe "bundle install with gem sources" do it "does not reinstall already-installed gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle :cache - build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") do |s| - s.write "lib/rack.rb", "raise 'omg'" + build_gem "myrack", "1.0.0", path: bundled_app("vendor/cache") do |s| + s.write "lib/myrack.rb", "raise 'omg'" end bundle :install expect(err).to be_empty - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end it "ignores cached gems for the wrong platform" do simulate_platform "java" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G bundle :cache @@ -476,7 +476,7 @@ RSpec.describe "bundle install with gem sources" do bundle "config set --local force_ruby_platform true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" @@ -485,8 +485,8 @@ RSpec.describe "bundle install with gem sources" do it "does not update the cache if --no-cache is passed" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundled_app("vendor/cache").mkpath expect(bundled_app("vendor/cache").children).to be_empty diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb index 4bad16a55e..7da9635d9f 100644 --- a/spec/bundler/commands/check_spec.rb +++ b/spec/bundler/commands/check_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "bundle check" do it "returns success when the Gemfile is satisfied" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -13,7 +13,7 @@ RSpec.describe "bundle check" do it "works with the --gemfile flag when not in the directory" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -23,7 +23,7 @@ RSpec.describe "bundle check" do it "creates a Gemfile.lock by default if one does not exist" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -36,7 +36,7 @@ RSpec.describe "bundle check" do it "does not create a Gemfile.lock if --dry-run was passed" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -51,7 +51,7 @@ RSpec.describe "bundle check" do system_gems ["rails-2.3.2"] gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -61,7 +61,7 @@ RSpec.describe "bundle check" do it "prints a generic error if a Gemfile.lock does not exist and a toplevel dependency does not exist" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -78,12 +78,12 @@ RSpec.describe "bundle check" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'rails' G gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails" gem "rails_pinned_to_old_activesupport" G @@ -94,9 +94,9 @@ RSpec.describe "bundle check" do it "remembers --without option from install", bundler: "< 3" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :foo do - gem "rack" + gem "myrack" end G @@ -108,9 +108,9 @@ RSpec.describe "bundle check" do it "uses the without setting" do bundle "config set without foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :foo do - gem "rack" + gem "myrack" end G @@ -120,63 +120,63 @@ RSpec.describe "bundle check" do it "ensures that gems are actually installed and not just cached" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :group => :foo + source "https://gem.repo1" + gem "myrack", :group => :foo G bundle "config set --local without foo" bundle :install gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "check", raise_on_error: false - expect(err).to include("* rack (1.0.0)") + expect(err).to include("* myrack (1.0.0)") 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" + source "https://gem.repo1" + gem "myrack" G bundle "config set --local path vendor/bundle" bundle :cache - gem_command "uninstall rack", env: { "GEM_HOME" => vendored_gems.to_s } + gem_command "uninstall myrack", env: { "GEM_HOME" => vendored_gems.to_s } bundle "check", raise_on_error: false - expect(err).to include("* rack (1.0.0)") + expect(err).to include("* myrack (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)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" platforms :#{not_local_tag} do gem "activesupport" end G - system_gems "rack-1.0.0", path: default_bundle_path + system_gems "myrack-1.0.0", path: default_bundle_path lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: activesupport (2.3.5) - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{generic_local_platform} #{not_local} DEPENDENCIES - rack + myrack activesupport G @@ -186,28 +186,28 @@ RSpec.describe "bundle check" do it "works with env conditionals" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" env :NOT_GOING_TO_BE_SET do gem "activesupport" end G - system_gems "rack-1.0.0", path: default_bundle_path + system_gems "myrack-1.0.0", path: default_bundle_path lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: activesupport (2.3.5) - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{generic_local_platform} #{not_local} DEPENDENCIES - rack + myrack activesupport G @@ -229,7 +229,7 @@ RSpec.describe "bundle check" do it "fails when there's no lock file and frozen is set" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" G @@ -245,7 +245,7 @@ RSpec.describe "bundle check" do context "after installing gems in the proper directory" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G bundle "install --path vendor/bundle" @@ -267,7 +267,7 @@ RSpec.describe "bundle check" do context "after installing gems on a different directory" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -283,10 +283,10 @@ RSpec.describe "bundle check" do describe "when locked" do before :each do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0" + source "https://gem.repo1" + gem "myrack", "1.0" G end @@ -300,26 +300,26 @@ RSpec.describe "bundle check" do simulate_new_machine bundle :check, raise_on_error: false expect(err).to match(/The following gems are missing/) - expect(err).to include("* rack (1.0") + expect(err).to include("* myrack (1.0") end end describe "when locked with multiple dependents with different requirements" do before :each do build_repo4 do - build_gem "depends_on_rack" do |s| - s.add_dependency "rack", ">= 1.0" + build_gem "depends_on_myrack" do |s| + s.add_dependency "myrack", ">= 1.0" end - build_gem "also_depends_on_rack" do |s| - s.add_dependency "rack", "~> 1.0" + build_gem "also_depends_on_myrack" do |s| + s.add_dependency "myrack", "~> 1.0" end - build_gem "rack" + build_gem "myrack" end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem "depends_on_rack" - gem "also_depends_on_rack" + source "https://gem.repo4" + gem "depends_on_myrack" + gem "also_depends_on_myrack" G bundle "lock" @@ -328,33 +328,33 @@ RSpec.describe "bundle check" do it "shows what is missing with the current Gemfile without duplications" do bundle :check, raise_on_error: false expect(err).to match(/The following gems are missing/) - expect(err).to include("* rack (1.0").once + expect(err).to include("* myrack (1.0").once end end describe "when locked under multiple platforms" do before :each do build_repo4 do - build_gem "rack" + build_gem "myrack" end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (1.0) + myrack (1.0) PLATFORMS ruby #{local_platform} DEPENDENCIES - rack + myrack BUNDLED WITH #{Bundler::VERSION} @@ -364,22 +364,22 @@ RSpec.describe "bundle check" do it "shows what is missing with the current Gemfile without duplications" do bundle :check, raise_on_error: false expect(err).to match(/The following gems are missing/) - expect(err).to include("* rack (1.0").once + expect(err).to include("* myrack (1.0").once end end describe "when using only scoped rubygems sources" do before do gemfile <<~G - source "#{file_uri_for(gem_repo2)}" - source "#{file_uri_for(gem_repo1)}" do - gem "rack" + source "https://gem.repo2" + source "https://gem.repo1" do + gem "myrack" end G end it "returns success when the Gemfile is satisfied" do - system_gems "rack-1.0.0", path: default_bundle_path + system_gems "myrack-1.0.0", path: default_bundle_path bundle :check expect(out).to include("The Gemfile's dependencies are satisfied") end @@ -388,48 +388,48 @@ RSpec.describe "bundle check" do describe "when using only scoped rubygems sources with indirect dependencies" do before do build_repo4 do - build_gem "depends_on_rack" do |s| - s.add_dependency "rack" + build_gem "depends_on_myrack" do |s| + s.add_dependency "myrack" end - build_gem "rack" + build_gem "myrack" end gemfile <<~G - source "#{file_uri_for(gem_repo1)}" - source "#{file_uri_for(gem_repo4)}" do - gem "depends_on_rack" + source "https://gem.repo1" + source "https://gem.repo4" do + gem "depends_on_myrack" end G end it "returns success when the Gemfile is satisfied and generates a correct lockfile" do - system_gems "depends_on_rack-1.0", "rack-1.0", gem_repo: gem_repo4, path: default_bundle_path + system_gems "depends_on_myrack-1.0", "myrack-1.0", gem_repo: gem_repo4, path: default_bundle_path bundle :check checksums = checksums_section_when_existing do |c| - c.no_checksum "depends_on_rack", "1.0" - c.no_checksum "rack", "1.0" + c.no_checksum "depends_on_myrack", "1.0" + c.no_checksum "myrack", "1.0" end expect(out).to include("The Gemfile's dependencies are satisfied") expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - depends_on_rack (1.0) - rack - rack (1.0) + depends_on_myrack (1.0) + myrack + myrack (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - depends_on_rack! + depends_on_myrack! #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -510,15 +510,15 @@ RSpec.describe "bundle check" do def lock_with(bundler_version = nil) lock = <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack L if bundler_version @@ -532,8 +532,8 @@ RSpec.describe "bundle check" do bundle "config set --local path vendor/bundle" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index 0b559a87c8..c27766835e 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "bundle clean" do it "removes unused gems that are different" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "foo" @@ -30,7 +30,7 @@ RSpec.describe "bundle clean" do bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" G @@ -40,17 +40,17 @@ RSpec.describe "bundle clean" do expect(out).to include("Removing foo (1.0)") - should_have_gems "thin-1.0", "rack-1.0.0" + should_have_gems "thin-1.0", "myrack-1.0.0" should_not_have_gems "foo-1.0" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "removes old version of gem if unused" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "0.9.1" + gem "myrack", "0.9.1" gem "foo" G @@ -59,28 +59,28 @@ RSpec.describe "bundle clean" do bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" gem "foo" G bundle "install" bundle :clean - expect(out).to include("Removing rack (0.9.1)") + expect(out).to include("Removing myrack (0.9.1)") - should_have_gems "foo-1.0", "rack-1.0.0" - should_not_have_gems "rack-0.9.1" + should_have_gems "foo-1.0", "myrack-1.0.0" + should_not_have_gems "myrack-0.9.1" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "removes new version of gem if unused" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" gem "foo" G @@ -89,31 +89,31 @@ RSpec.describe "bundle clean" do bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "0.9.1" + gem "myrack", "0.9.1" gem "foo" G - bundle "update rack" + bundle "update myrack" bundle :clean - expect(out).to include("Removing rack (1.0.0)") + expect(out).to include("Removing myrack (1.0.0)") - should_have_gems "foo-1.0", "rack-0.9.1" - should_not_have_gems "rack-1.0.0" + should_have_gems "foo-1.0", "myrack-0.9.1" + should_not_have_gems "myrack-1.0.0" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "removes gems in bundle without groups" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" group :test_group do - gem "rack", "1.0.0" + gem "myrack", "1.0.0" end G @@ -123,12 +123,12 @@ RSpec.describe "bundle clean" do bundle "install" bundle :clean - expect(out).to include("Removing rack (1.0.0)") + expect(out).to include("Removing myrack (1.0.0)") should_have_gems "foo-1.0" - should_not_have_gems "rack-1.0.0" + should_not_have_gems "myrack-1.0.0" - expect(vendored_gems("bin/rackup")).to_not exist + expect(vendored_gems("bin/myrackup")).to_not exist end it "does not remove cached git dir if it's being used" do @@ -137,9 +137,9 @@ RSpec.describe "bundle clean" do git_path = lib_path("foo-1.0") gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" git "#{git_path}", :ref => "#{revision}" do gem "foo" end @@ -161,9 +161,9 @@ RSpec.describe "bundle clean" do revision = revision_for(git_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" git "#{git_path}", :ref => "#{revision}" do gem "foo" end @@ -173,9 +173,9 @@ RSpec.describe "bundle clean" do bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G bundle "install" @@ -183,14 +183,14 @@ RSpec.describe "bundle clean" do expect(out).to include("Removing foo (#{revision[0..11]})") - expect(vendored_gems("gems/rack-1.0.0")).to exist + expect(vendored_gems("gems/myrack-1.0.0")).to exist expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).not_to exist digest = Digest(:SHA1).hexdigest(git_path.to_s) expect(vendored_gems("cache/bundler/git/foo-#{digest}")).not_to exist - expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist + expect(vendored_gems("specifications/myrack-1.0.0.gemspec")).to exist - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "keeps used git gems even if installed to a symlinked location" do @@ -199,9 +199,9 @@ RSpec.describe "bundle clean" do revision = revision_for(git_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" git "#{git_path}", :ref => "#{revision}" do gem "foo" end @@ -225,9 +225,9 @@ RSpec.describe "bundle clean" do revision = revision_for(lib_path("foo-bar")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" git "#{lib_path("foo-bar")}" do gem "foo-bar" end @@ -244,13 +244,13 @@ RSpec.describe "bundle clean" do expect(out).to include("Removing foo-bar (#{revision[0..11]})") - expect(vendored_gems("gems/rack-1.0.0")).to exist + expect(vendored_gems("gems/myrack-1.0.0")).to exist expect(vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}")).not_to exist expect(vendored_gems("bundler/gems/foo-bar-#{revision2[0..11]}")).to exist - expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist + expect(vendored_gems("specifications/myrack-1.0.0.gemspec")).to exist - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "does not remove nested gems in a git repo" do @@ -261,7 +261,7 @@ RSpec.describe "bundle clean" do revision = revision_for(lib_path("rails")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport", :git => "#{lib_path("rails")}", :ref => '#{revision}' G @@ -279,9 +279,9 @@ RSpec.describe "bundle clean" do revision = revision_for(git_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" group :test do git "#{git_path}", :ref => "#{revision}" do gem "foo" @@ -302,9 +302,9 @@ RSpec.describe "bundle clean" do it "does not blow up when using without groups" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" group :development do gem "foo" @@ -321,9 +321,9 @@ RSpec.describe "bundle clean" do it "displays an error when used without --path" do bundle "config set path.system true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G bundle :clean, raise_on_error: false @@ -335,7 +335,7 @@ RSpec.describe "bundle clean" do # handling bundle clean upgrade path from the pre's it "removes .gem/.gemspec file even if there's no corresponding gem dir" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "foo" @@ -345,63 +345,63 @@ RSpec.describe "bundle clean" do bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" G bundle "install" - FileUtils.rm(vendored_gems("bin/rackup")) + FileUtils.rm(vendored_gems("bin/myrackup")) FileUtils.rm_rf(vendored_gems("gems/thin-1.0")) - FileUtils.rm_rf(vendored_gems("gems/rack-1.0.0")) + FileUtils.rm_rf(vendored_gems("gems/myrack-1.0.0")) bundle :clean - should_not_have_gems "thin-1.0", "rack-1.0" + should_not_have_gems "thin-1.0", "myrack-1.0" should_have_gems "foo-1.0" - expect(vendored_gems("bin/rackup")).not_to exist + expect(vendored_gems("bin/myrackup")).not_to exist end it "does not call clean automatically when using system gems" do bundle "config set path.system true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" - gem "rack" + gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G gem_command :list - expect(out).to include("rack (1.0.0)").and include("thin (1.0)") + expect(out).to include("myrack (1.0.0)").and include("thin (1.0)") end it "--clean should override the bundle setting on install", bundler: "< 3" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" - gem "rack" + gem "myrack" G bundle "config set path vendor/bundle" bundle "config set clean false" bundle "install --clean true" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G bundle "install" - should_have_gems "rack-1.0.0" + should_have_gems "myrack-1.0.0" should_not_have_gems "thin-1.0" end @@ -409,7 +409,7 @@ RSpec.describe "bundle clean" do build_repo2 gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "foo" G @@ -431,7 +431,7 @@ RSpec.describe "bundle clean" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "foo" G @@ -453,29 +453,29 @@ RSpec.describe "bundle clean" do it "does not clean automatically on --path" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" - gem "rack" + gem "myrack" G bundle "config set path vendor/bundle" bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G bundle "install" - should_have_gems "rack-1.0.0", "thin-1.0" + should_have_gems "myrack-1.0.0", "thin-1.0" end it "does not clean on bundle update with --path" do build_repo2 gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "foo" G @@ -496,7 +496,7 @@ RSpec.describe "bundle clean" do build_repo2 gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "foo" G @@ -515,17 +515,17 @@ RSpec.describe "bundle clean" do bundle "config set path.system true" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" - gem "rack" + gem "myrack" G bundle :install gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G bundle :install bundle "clean --force" @@ -533,7 +533,7 @@ RSpec.describe "bundle clean" do expect(out).to include("Removing foo (1.0)") gem_command :list expect(out).not_to include("foo (1.0)") - expect(out).to include("rack (1.0.0)") + expect(out).to include("myrack (1.0.0)") end describe "when missing permissions", :permissions do @@ -544,17 +544,17 @@ RSpec.describe "bundle clean" do end it "returns a helpful error message" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" - gem "rack" + gem "myrack" G bundle :install gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G bundle :install @@ -567,7 +567,7 @@ RSpec.describe "bundle clean" do gem_command :list expect(out).to include("foo (1.0)") - expect(out).to include("rack (1.0.0)") + expect(out).to include("myrack (1.0.0)") end end @@ -576,7 +576,7 @@ RSpec.describe "bundle clean" do revision = revision_for(lib_path("foo-1.0")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -612,7 +612,7 @@ RSpec.describe "bundle clean" do end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "bindir" G @@ -637,7 +637,7 @@ RSpec.describe "bundle clean" do realworld_system_gems "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" G bundle "clean --force", env: { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } @@ -654,7 +654,7 @@ RSpec.describe "bundle clean" do end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" gem "bar", "1.0", :path => "#{relative_path}" @@ -667,7 +667,7 @@ RSpec.describe "bundle clean" do it "doesn't remove gems in dry-run mode with path set" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "foo" @@ -678,7 +678,7 @@ RSpec.describe "bundle clean" do bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" G @@ -690,14 +690,14 @@ RSpec.describe "bundle clean" do expect(out).not_to include("Removing foo (1.0)") expect(out).to include("Would have removed foo (1.0)") - should_have_gems "thin-1.0", "rack-1.0.0", "foo-1.0" + should_have_gems "thin-1.0", "myrack-1.0.0", "foo-1.0" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "doesn't remove gems in dry-run mode with no path set" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "foo" @@ -708,7 +708,7 @@ RSpec.describe "bundle clean" do bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" G @@ -720,14 +720,14 @@ RSpec.describe "bundle clean" do expect(out).not_to include("Removing foo (1.0)") expect(out).to include("Would have removed foo (1.0)") - should_have_gems "thin-1.0", "rack-1.0.0", "foo-1.0" + should_have_gems "thin-1.0", "myrack-1.0.0", "foo-1.0" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "doesn't store dry run as a config setting" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "foo" @@ -739,7 +739,7 @@ RSpec.describe "bundle clean" do bundle "config set dry_run false" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" G @@ -751,15 +751,15 @@ RSpec.describe "bundle clean" do expect(out).to include("Removing foo (1.0)") expect(out).not_to include("Would have removed foo (1.0)") - should_have_gems "thin-1.0", "rack-1.0.0" + should_have_gems "thin-1.0", "myrack-1.0.0" should_not_have_gems "foo-1.0" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "foo" @@ -770,7 +770,7 @@ RSpec.describe "bundle clean" do bundle "install" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "weakling" @@ -779,7 +779,7 @@ RSpec.describe "bundle clean" do bundle "config set auto_install 1" bundle :clean expect(out).to include("Installing weakling 0.0.3") - should_have_gems "thin-1.0", "rack-1.0.0", "weakling-0.0.3" + should_have_gems "thin-1.0", "myrack-1.0.0", "weakling-0.0.3" should_not_have_gems "foo-1.0" end @@ -789,7 +789,7 @@ RSpec.describe "bundle clean" do revision = revision_for(lib_path("very_simple_git_binary-1.0")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}", :ref => "#{revision}" G @@ -808,7 +808,7 @@ RSpec.describe "bundle clean" do it "removes extension directories" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "very_simple_binary" @@ -828,7 +828,7 @@ RSpec.describe "bundle clean" do expect(simple_binary_extensions_dir).to exist gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "simple_binary" @@ -849,7 +849,7 @@ RSpec.describe "bundle clean" do short_revision = revision[0..11] gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}", :ref => "#{revision}" @@ -864,7 +864,7 @@ RSpec.describe "bundle clean" do expect(very_simple_binary_extensions_dir).to exist gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}", :ref => "#{revision}" G @@ -874,7 +874,7 @@ RSpec.describe "bundle clean" do expect(very_simple_binary_extensions_dir).to exist gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G bundle "install" @@ -891,7 +891,7 @@ RSpec.describe "bundle clean" do short_revision = revision[0..11] gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :development do gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}", :ref => "#{revision}" diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb index d6a30eae5b..1392b17315 100644 --- a/spec/bundler/commands/config_spec.rb +++ b/spec/bundler/commands/config_spec.rb @@ -38,8 +38,8 @@ RSpec.describe ".bundle/config" do describe "location with a gemfile" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" G end @@ -56,7 +56,7 @@ RSpec.describe ".bundle/config" do expect(bundled_app(".bundle")).not_to exist expect(tmp("foo/bar/config")).to exist - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "can provide a relative path with the environment variable" do @@ -68,7 +68,7 @@ RSpec.describe ".bundle/config" do expect(bundled_app(".bundle")).not_to exist expect(bundled_app("../foo/config")).to exist - expect(the_bundle).to include_gems "rack 1.0.0", dir: bundled_app("omg") + expect(the_bundle).to include_gems "myrack 1.0.0", dir: bundled_app("omg") end end @@ -123,8 +123,8 @@ RSpec.describe ".bundle/config" do describe "global" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" G end @@ -215,8 +215,8 @@ RSpec.describe ".bundle/config" do describe "local" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" G end @@ -271,8 +271,8 @@ RSpec.describe ".bundle/config" do describe "env" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" G end @@ -344,8 +344,8 @@ RSpec.describe ".bundle/config" do describe "gem mirrors" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" G end @@ -367,7 +367,7 @@ E end describe "quoting" do - before(:each) { gemfile "source \"#{file_uri_for(gem_repo1)}\"" } + before(:each) { gemfile "source 'https://gem.repo1'" } let(:long_string) do "--with-xml2-include=/usr/pkg/include/libxml2 --with-xml2-lib=/usr/pkg/lib " \ "--with-xslt-dir=/usr/pkg" @@ -417,8 +417,8 @@ E describe "very long lines" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" G end @@ -580,8 +580,8 @@ RSpec.describe "setting gemfile via config" do context "when only the non-default Gemfile exists" do it "persists the gemfile location to .bundle/config" do gemfile bundled_app("NotGemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle "config set --local gemfile #{bundled_app("NotGemfile")}" diff --git a/spec/bundler/commands/console_spec.rb b/spec/bundler/commands/console_spec.rb index a41432b88a..8b02e7aa1b 100644 --- a/spec/bundler/commands/console_spec.rb +++ b/spec/bundler/commands/console_spec.rb @@ -38,16 +38,16 @@ RSpec.describe "bundle console", bundler: "< 3", readline: true do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development G end it "starts IRB with the default group loaded" do bundle "console" do |input, _, _| - input.puts("puts RACK") + input.puts("puts MYRACK") input.puts("exit") end expect(out).to include("0.9.1") @@ -63,7 +63,7 @@ RSpec.describe "bundle console", bundler: "< 3", readline: true do it "starts another REPL if configured as such" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "pry" G bundle "config set console pry" @@ -105,7 +105,7 @@ RSpec.describe "bundle console", bundler: "< 3", readline: true do it "loads the default group" do bundle "console test" do |input, _, _| - input.puts("puts RACK") + input.puts("puts MYRACK") input.puts("exit") end expect(out).to include("0.9.1") @@ -113,7 +113,7 @@ RSpec.describe "bundle console", bundler: "< 3", readline: true do it "doesn't load other groups" do bundle "console test" do |input, _, _| - input.puts("puts RACK_MIDDLEWARE") + input.puts("puts MYRACK_MIDDLEWARE") input.puts("exit") end expect(out).to include("NameError") @@ -122,10 +122,10 @@ RSpec.describe "bundle console", bundler: "< 3", readline: true do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development gem "foo" G diff --git a/spec/bundler/commands/doctor_spec.rb b/spec/bundler/commands/doctor_spec.rb index 666b23a141..744510cd40 100644 --- a/spec/bundler/commands/doctor_spec.rb +++ b/spec/bundler/commands/doctor_spec.rb @@ -8,8 +8,8 @@ require "bundler/cli/doctor" RSpec.describe "bundle doctor" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G @stdout = StringIO.new @@ -52,7 +52,7 @@ RSpec.describe "bundle doctor" do it "exits with no message if the installed gem's C extension dylib breakage is fine" do doctor = Bundler::CLI::Doctor.new({}) - expect(doctor).to receive(:bundles_for_gem).exactly(2).times.and_return ["/path/to/rack/rack.bundle"] + expect(doctor).to receive(:bundles_for_gem).exactly(2).times.and_return ["/path/to/myrack/myrack.bundle"] expect(doctor).to receive(:dylibs).exactly(2).times.and_return ["/usr/lib/libSystem.dylib"] allow(Fiddle).to receive(:dlopen).with("/usr/lib/libSystem.dylib").and_return(true) expect { doctor.run }.not_to raise_error @@ -61,13 +61,13 @@ RSpec.describe "bundle doctor" do it "exits with a message if one of the linked libraries is missing" do doctor = Bundler::CLI::Doctor.new({}) - expect(doctor).to receive(:bundles_for_gem).exactly(2).times.and_return ["/path/to/rack/rack.bundle"] + expect(doctor).to receive(:bundles_for_gem).exactly(2).times.and_return ["/path/to/myrack/myrack.bundle"] expect(doctor).to receive(:dylibs).exactly(2).times.and_return ["/usr/local/opt/icu4c/lib/libicui18n.57.1.dylib"] allow(Fiddle).to receive(:dlopen).with("/usr/local/opt/icu4c/lib/libicui18n.57.1.dylib").and_raise(Fiddle::DLError) expect { doctor.run }.to raise_error(Bundler::ProductionError, <<~E.strip), @stdout.string The following gems are missing OS dependencies: * bundler: /usr/local/opt/icu4c/lib/libicui18n.57.1.dylib - * rack: /usr/local/opt/icu4c/lib/libicui18n.57.1.dylib + * myrack: /usr/local/opt/icu4c/lib/libicui18n.57.1.dylib E end end diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 1da8f626fa..832a28e361 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true RSpec.describe "bundle exec" do - let(:system_gems_to_install) { %w[rack-1.0.0 rack-0.9.1] } + let(:system_gems_to_install) { %w[myrack-1.0.0 myrack-0.9.1] } it "works with --gemfile flag" do system_gems(system_gems_to_install, path: default_bundle_path) - create_file "CustomGemfile", <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + gemfile "CustomGemfile", <<-G + source "https://gem.repo1" + gem "myrack", "1.0.0" G - bundle "exec --gemfile CustomGemfile rackup" + bundle "exec --gemfile CustomGemfile myrackup" expect(out).to eq("1.0.0") end @@ -19,11 +19,11 @@ RSpec.describe "bundle exec" do system_gems(system_gems_to_install, path: default_bundle_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G - bundle "exec rackup" + bundle "exec myrackup" expect(out).to eq("0.9.1") end @@ -31,86 +31,69 @@ RSpec.describe "bundle exec" do system_gems(system_gems_to_install, path: default_bundle_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G - bundle "exec rackup", env: { "HOME" => "/" } + bundle "exec myrackup", env: { "HOME" => "/" } expect(out).to eq("0.9.1") expect(err).to be_empty end it "works when the bins are in ~/.bundle" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "exec rackup" + bundle "exec myrackup" expect(out).to eq("1.0.0") end it "works when running from a random directory" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "exec 'cd #{tmp("gems")} && rackup'" + bundle "exec 'cd #{tmp("gems")} && myrackup'" expect(out).to eq("1.0.0") end it "works when exec'ing something else" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\"" + install_gemfile "source \"https://gem.repo1\"; gem \"myrack\"" bundle "exec echo exec" expect(out).to eq("exec") end it "works when exec'ing to ruby" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\"" + install_gemfile "source \"https://gem.repo1\"; gem \"myrack\"" bundle "exec ruby -e 'puts %{hi}'" expect(out).to eq("hi") end it "works when exec'ing to rubygems" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\"" + install_gemfile "source \"https://gem.repo1\"; gem \"myrack\"" bundle "exec #{gem_cmd} --version" expect(out).to eq(Gem::VERSION) end it "works when exec'ing to rubygems through sh -c" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\"" + install_gemfile "source \"https://gem.repo1\"; gem \"myrack\"" bundle "exec sh -c '#{gem_cmd} --version'" expect(out).to eq(Gem::VERSION) end - it "works when exec'ing back to bundler with a lockfile that doesn't include the current platform" do + it "works when exec'ing back to bundler to run a remote resolve" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G - # simulate lockfile generated with old version not including specific platform - lockfile <<-L - GEM - remote: #{file_uri_for(gem_repo1)}/ - specs: - rack (0.9.1) + bundle "exec bundle lock", env: { "BUNDLER_VERSION" => Bundler::VERSION } - PLATFORMS - RUBY - - DEPENDENCIES - rack (= 0.9.1) - - BUNDLED WITH - 2.1.4 - L - - bundle "exec bundle cache", env: { "BUNDLER_VERSION" => Bundler::VERSION } - - expect(out).to include("Updating files in vendor/cache") + expect(out).to include("Writing lockfile") end it "respects custom process title when loading through ruby" do @@ -120,20 +103,20 @@ RSpec.describe "bundle exec" do Process.setproctitle("1-2-3-4-5-6-7") puts `ps -ocommand= -p#{$$}` RUBY - create_file "Gemfile", "source \"#{file_uri_for(gem_repo1)}\"" + gemfile "Gemfile", "source \"https://gem.repo1\"" create_file "a.rb", script_that_changes_its_own_title_and_checks_if_picked_up_by_ps_unix_utility bundle "exec ruby a.rb" expect(out).to eq("1-2-3-4-5-6-7") end it "accepts --verbose" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\"" + install_gemfile "source \"https://gem.repo1\"; gem \"myrack\"" bundle "exec --verbose echo foobar" expect(out).to eq("foobar") end it "passes --verbose to command if it is given after the command" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\"" + install_gemfile "source \"https://gem.repo1\"; gem \"myrack\"" bundle "exec echo --verbose" expect(out).to eq("--verbose") end @@ -157,7 +140,7 @@ RSpec.describe "bundle exec" do end G - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source \"https://gem.repo1\"" sys_exec "#{Gem.ruby} #{command.path}" expect(out).to be_empty @@ -165,7 +148,7 @@ RSpec.describe "bundle exec" do end it "accepts --keep-file-descriptors" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source \"https://gem.repo1\"" bundle "exec --keep-file-descriptors echo foobar" expect(err).to be_empty @@ -174,7 +157,7 @@ RSpec.describe "bundle exec" do it "can run a command named --verbose" do skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"; gem \"rack\"" + install_gemfile "source \"https://gem.repo1\"; gem \"myrack\"" File.open(bundled_app("--verbose"), "w") do |f| f.puts "#!/bin/sh" f.puts "echo foobar" @@ -188,26 +171,26 @@ RSpec.describe "bundle exec" do it "handles different versions in different bundles" do build_repo2 do - build_gem "rack_two", "1.0.0" do |s| - s.executables = "rackup" + build_gem "myrack_two", "1.0.0" do |s| + s.executables = "myrackup" end end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G install_gemfile bundled_app2("Gemfile"), <<-G, dir: bundled_app2 - source "#{file_uri_for(gem_repo2)}" - gem "rack_two", "1.0.0" + source "https://gem.repo2" + gem "myrack_two", "1.0.0" G - bundle "exec rackup" + bundle "exec myrackup" expect(out).to eq("0.9.1") - bundle "exec rackup", dir: bundled_app2 + bundle "exec myrackup", dir: bundled_app2 expect(out).to eq("1.0.0") end @@ -218,7 +201,7 @@ RSpec.describe "bundle exec" do before do skip "irb isn't a default gem" if default_irb_version.empty? - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source \"https://gem.repo1\"" end it "uses version provided by ruby" do @@ -241,7 +224,7 @@ RSpec.describe "bundle exec" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "irb", "#{specified_irb_version}" G end @@ -271,7 +254,7 @@ RSpec.describe "bundle exec" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "gem_depending_on_old_irb" G @@ -287,54 +270,54 @@ RSpec.describe "bundle exec" do it "warns about executable conflicts" do build_repo2 do - build_gem "rack_two", "1.0.0" do |s| - s.executables = "rackup" + build_gem "myrack_two", "1.0.0" do |s| + s.executables = "myrackup" end end bundle "config set --global path.system true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G install_gemfile bundled_app2("Gemfile"), <<-G, dir: bundled_app2 - source "#{file_uri_for(gem_repo2)}" - gem "rack_two", "1.0.0" + source "https://gem.repo2" + gem "myrack_two", "1.0.0" G - bundle "exec rackup" + bundle "exec myrackup" expect(last_command.stderr).to eq( - "Bundler is using a binstub that was created for a different gem (rack).\n" \ - "You should run `bundle binstub rack_two` to work around a system/bundle conflict." + "Bundler is using a binstub that was created for a different gem (myrack).\n" \ + "You should run `bundle binstub myrack_two` to work around a system/bundle conflict." ) end it "handles gems installed with --without" do bundle "config set --local without middleware" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" # rack 0.9.1 and 1.0 exist + source "https://gem.repo1" + gem "myrack" # myrack 0.9.1 and 1.0 exist group :middleware do - gem "rack_middleware" # rack_middleware depends on rack 0.9.1 + gem "myrack_middleware" # myrack_middleware depends on myrack 0.9.1 end G - bundle "exec rackup" + bundle "exec myrackup" expect(out).to eq("0.9.1") - expect(the_bundle).not_to include_gems "rack_middleware 1.0" + expect(the_bundle).not_to include_gems "myrack_middleware 1.0" end it "does not duplicate already exec'ed RUBYOPT" do skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundler_setup_opt = "-r#{lib_dir}/bundler/setup" @@ -352,8 +335,8 @@ RSpec.describe "bundle exec" do skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G rubylib = ENV["RUBYLIB"] @@ -369,8 +352,8 @@ RSpec.describe "bundle exec" do it "errors nicely when the argument doesn't exist" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "exec foobarbaz", raise_on_error: false @@ -381,8 +364,8 @@ RSpec.describe "bundle exec" do it "errors nicely when the argument is not executable" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "exec touch foo" @@ -393,8 +376,8 @@ RSpec.describe "bundle exec" do it "errors nicely when no arguments are passed" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "exec", raise_on_error: false @@ -405,15 +388,15 @@ RSpec.describe "bundle exec" do it "raises a helpful error when exec'ing to something outside of the bundle" do system_gems(system_gems_to_install, path: default_bundle_path) - bundle "config set clean false" # want to keep the rackup binstub + bundle "config set clean false" # want to keep the myrackup binstub install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" G [true, false].each do |l| bundle "config set disable_exec_load #{l}" - bundle "exec rackup", raise_on_error: false - expect(err).to include "can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?" + bundle "exec myrackup", raise_on_error: false + expect(err).to include "can't find executable myrackup for gem myrack. myrack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?" end end @@ -427,8 +410,8 @@ RSpec.describe "bundle exec" do skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G create_file("print_args", <<-'RUBY') @@ -512,19 +495,19 @@ RSpec.describe "bundle exec" do describe "run from a random directory" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end it "works when unlocked" do - bundle "exec 'cd #{tmp("gems")} && rackup'" + bundle "exec 'cd #{tmp("gems")} && myrackup'" expect(out).to eq("1.0.0") end it "works when locked" do expect(the_bundle).to be_locked - bundle "exec 'cd #{tmp("gems")} && rackup'" + bundle "exec 'cd #{tmp("gems")} && myrackup'" expect(out).to eq("1.0.0") end end @@ -536,7 +519,7 @@ RSpec.describe "bundle exec" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "fizz", :path => "#{File.expand_path(home("fizz"))}" G end @@ -561,7 +544,7 @@ RSpec.describe "bundle exec" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "fizz_git", :git => "#{lib_path("fizz_git-1.0")}" G end @@ -585,7 +568,7 @@ RSpec.describe "bundle exec" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "fizz_no_gemspec", "1.0", :git => "#{lib_path("fizz_no_gemspec-1.0")}" G end @@ -605,13 +588,13 @@ RSpec.describe "bundle exec" do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" gem "foo" G bundle "config set auto_install 1" - bundle "exec rackup" + bundle "exec myrackup" expect(out).to include("Installing foo 1.0") end @@ -620,14 +603,14 @@ RSpec.describe "bundle exec" do s.executables = "foo" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" gem "foo", :git => "#{lib_path("foo-1.0")}" G bundle "config set auto_install 1" bundle "exec foo" - expect(out).to include("Fetching rack 0.9.1") + expect(out).to include("Fetching myrack 0.9.1") expect(out).to include("Fetching #{lib_path("foo-1.0")}") expect(out.lines).to end_with("1.0") end @@ -653,7 +636,7 @@ RSpec.describe "bundle exec" do bundle "config set --local path vendor/bundle" gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "fastlane" G @@ -680,7 +663,7 @@ RSpec.describe "bundle exec" do end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo-1.0")}" G @@ -696,7 +679,7 @@ RSpec.describe "bundle exec" do skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" module Monkey def bin_path(a,b,c) @@ -718,10 +701,10 @@ RSpec.describe "bundle exec" do let(:executable) { <<~RUBY.strip } #{shebang} - require "rack" + require "myrack" puts "EXEC: \#{caller.grep(/load/).empty? ? 'exec' : 'load'}" puts "ARGS: \#{$0} \#{ARGV.join(' ')}" - puts "RACK: \#{RACK}" + puts "MYRACK: \#{MYRACK}" process_title = `ps -o args -p \#{Process.pid}`.split("\n", 2).last.strip puts "PROCESS: \#{process_title}" RUBY @@ -733,21 +716,21 @@ RSpec.describe "bundle exec" do bundled_app(path).chmod(0o755) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end let(:exec) { "EXEC: load" } let(:args) { "ARGS: #{path} arg1 arg2" } - let(:rack) { "RACK: 1.0.0" } + let(:myrack) { "MYRACK: 1.0.0" } let(:process) do title = "PROCESS: #{path}" title += " arg1 arg2" title end let(:exit_code) { 0 } - let(:expected) { [exec, args, rack, process].join("\n") } + let(:expected) { [exec, args, myrack, process].join("\n") } let(:expected_err) { "" } subject { bundle "exec #{path} arg1 arg2", raise_on_error: false } @@ -877,8 +860,8 @@ RSpec.describe "bundle exec" do context "when Bundler.setup fails", bundler: "< 3" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack', '2' + source "https://gem.repo1" + gem 'myrack', '2' G ENV["BUNDLER_FORCE_TTY"] = "true" end @@ -886,11 +869,11 @@ RSpec.describe "bundle exec" do let(:exit_code) { Bundler::GemNotFound.new.status_code } let(:expected) { "" } let(:expected_err) { <<-EOS.strip } -Could not find gem 'rack (= 2)' in locally installed gems. +Could not find gem 'myrack (= 2)' in locally installed gems. -The source contains the following gems matching 'rack': - * rack-0.9.1 - * rack-1.0.0 +The source contains the following gems matching 'myrack': + * myrack-0.9.1 + * myrack-1.0.0 Run `bundle install` to install missing gems. EOS @@ -907,8 +890,8 @@ Run `bundle install` to install missing gems. context "when Bundler.setup fails", bundler: "3" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack', '2' + source "https://gem.repo1" + gem 'myrack', '2' G ENV["BUNDLER_FORCE_TTY"] = "true" end @@ -916,10 +899,10 @@ Run `bundle install` to install missing gems. let(:exit_code) { Bundler::GemNotFound.new.status_code } let(:expected) { "" } let(:expected_err) { <<-EOS.strip } -Could not find gem 'rack (= 2)' in locally installed gems. +Could not find gem 'myrack (= 2)' in locally installed gems. -The source contains the following gems matching 'rack': - * rack-1.0.0 +The source contains the following gems matching 'myrack': + * myrack-1.0.0 Run `bundle install` to install missing gems. EOS @@ -935,9 +918,9 @@ Run `bundle install` to install missing gems. context "when Bundler.setup fails and Gemfile is not the default" do before do - create_file "CustomGemfile", <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack', '2' + gemfile "CustomGemfile", <<-G + source "https://gem.repo1" + gem 'myrack', '2' G ENV["BUNDLER_FORCE_TTY"] = "true" ENV["BUNDLE_GEMFILE"] = "CustomGemfile" @@ -1099,8 +1082,8 @@ __FILE__: #{path.to_s.inspect} skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "config set path vendor/bundler" bundle :install @@ -1122,7 +1105,7 @@ __FILE__: #{path.to_s.inspect} before do skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source \"https://gem.repo1\"" end it "does not undo the monkeypatches" do @@ -1172,18 +1155,18 @@ __FILE__: #{path.to_s.inspect} end bundle "config set path vendor/bundle" - bundle "config set gemfile gemfiles/rack_6_1.gemfile" + bundle "config set gemfile gemfiles/myrack_6_1.gemfile" - create_file(bundled_app("gemfiles/rack_6_1.gemfile"), <<~RUBY) - source "#{file_uri_for(gem_repo2)}" + gemfile(bundled_app("gemfiles/myrack_6_1.gemfile"), <<~RUBY) + source "https://gem.repo2" gem "rails", "6.1.0" RUBY # A Gemfile needs to be in the root to trick bundler's root resolution - create_file(bundled_app("Gemfile"), "source \"#{file_uri_for(gem_repo1)}\"") + gemfile "source 'https://gem.repo1'" - bundle "install" + bundle "install", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } end it "can still find gems after a nested subprocess" do @@ -1212,7 +1195,7 @@ __FILE__: #{path.to_s.inspect} skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? skip "openssl isn't a default gem" if expected.empty? - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" # must happen before installing the broken system gem + install_gemfile "source \"https://gem.repo1\"" # must happen before installing the broken system gem build_repo4 do build_gem "openssl", openssl_version do |s| @@ -1253,7 +1236,7 @@ __FILE__: #{path.to_s.inspect} build_git "simple_git_binary", &:add_c_extension bundle "config set --local path .bundle" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "simple_git_binary", :git => '#{lib_path("simple_git_binary-1.0")}' G end diff --git a/spec/bundler/commands/fund_spec.rb b/spec/bundler/commands/fund_spec.rb index cc32a7242f..6f4e61da30 100644 --- a/spec/bundler/commands/fund_spec.rb +++ b/spec/bundler/commands/fund_spec.rb @@ -30,22 +30,22 @@ RSpec.describe "bundle fund" do it "prints fund information for all gems in the bundle" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'has_funding_and_other_metadata' gem 'has_funding' - gem 'rack-obama' + gem 'myrack-obama' G bundle "fund" expect(out).to include("* has_funding_and_other_metadata (1.0)\n Funding: https://example.com/has_funding_and_other_metadata/funding") expect(out).to include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding") - expect(out).to_not include("rack-obama") + expect(out).to_not include("myrack-obama") end it "does not consider fund information for gem dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'gem_with_dependent_funding' G @@ -57,44 +57,44 @@ RSpec.describe "bundle fund" do it "does not consider fund information for uninstalled optional dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" group :whatever, optional: true do gem 'has_funding_and_other_metadata' end gem 'has_funding' - gem 'rack-obama' + gem 'myrack-obama' G bundle "fund" expect(out).to include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding") expect(out).to_not include("has_funding_and_other_metadata") - expect(out).to_not include("rack-obama") + expect(out).to_not include("myrack-obama") end it "considers fund information for installed optional dependencies" do bundle "config set with whatever" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" group :whatever, optional: true do gem 'has_funding_and_other_metadata' end gem 'has_funding' - gem 'rack-obama' + gem 'myrack-obama' G bundle "fund" expect(out).to include("* has_funding_and_other_metadata (1.0)\n Funding: https://example.com/has_funding_and_other_metadata/funding") expect(out).to include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding") - expect(out).to_not include("rack-obama") + expect(out).to_not include("myrack-obama") end it "prints message if none of the gems have fund information" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack-obama' + source "https://gem.repo2" + gem 'myrack-obama' G bundle "fund" @@ -105,7 +105,7 @@ RSpec.describe "bundle fund" do describe "with --group option" do it "prints fund message for only specified group gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'has_funding_and_other_metadata', :group => :development gem 'has_funding' G diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb index 7ddc5c2363..42f288a1d8 100644 --- a/spec/bundler/commands/info_spec.rb +++ b/spec/bundler/commands/info_spec.rb @@ -18,7 +18,7 @@ RSpec.describe "bundle info" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails" gem "has_metadata" gem "thin" @@ -127,9 +127,9 @@ RSpec.describe "bundle info" do context "when gem has a reverse dependency on any version" do it "prints the details" do - bundle "info rack" + bundle "info myrack" - expect(out).to include("Reverse Dependencies: \n\t\tthin (1.0) depends on rack (>= 0)") + expect(out).to include("Reverse Dependencies: \n\t\tthin (1.0) depends on myrack (>= 0)") end end @@ -157,7 +157,7 @@ RSpec.describe "bundle info" do it "prints out git info" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G expect(the_bundle).to include_gems "foo 1.0" @@ -173,7 +173,7 @@ RSpec.describe "bundle info" do @revision = revision_for(lib_path("foo-1.0"))[0...6] install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg" G expect(the_bundle).to include_gems "foo 1.0.omg" @@ -185,7 +185,7 @@ RSpec.describe "bundle info" do it "doesn't print the branch when tied to a ref" do sha = revision_for(lib_path("foo-1.0")) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{sha}" G @@ -196,7 +196,7 @@ RSpec.describe "bundle info" do it "handles when a version is a '-' prerelease" do @git = build_git("foo", "1.0.0-beta.1", path: lib_path("foo")) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}" G expect(the_bundle).to include_gems "foo 1.0.0.pre.beta.1" @@ -209,20 +209,20 @@ RSpec.describe "bundle info" do context "with a valid regexp for gem name" do it "presents alternatives", :readline do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G bundle "info rac" - expect(out).to match(/\A1 : rack\n2 : rack-obama\n0 : - exit -(\n>|\z)/) + expect(out).to match(/\A1 : myrack\n2 : myrack-obama\n0 : - exit -(\n>|\z)/) end end context "with an invalid regexp for gem name" do it "does not find the gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -238,7 +238,7 @@ RSpec.describe "bundle info" do bundle "config without test" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails", group: :test G diff --git a/spec/bundler/commands/init_spec.rb b/spec/bundler/commands/init_spec.rb index 564a4bdc2d..538e61fd47 100644 --- a/spec/bundler/commands/init_spec.rb +++ b/spec/bundler/commands/init_spec.rb @@ -32,7 +32,7 @@ RSpec.describe "bundle init" do context "when a Gemfile already exists" do before do - create_file "Gemfile", <<-G + gemfile <<-G gem "rails" G end @@ -86,7 +86,7 @@ RSpec.describe "bundle init" do file << <<-S Gem::Specification.new do |s| s.name = 'test' - s.add_dependency 'rack', '= 1.0.1' + s.add_dependency 'myrack', '= 1.0.1' s.add_development_dependency 'rspec', '1.2' end S @@ -96,7 +96,7 @@ RSpec.describe "bundle init" do gemfile = bundled_app_gemfile.read expect(gemfile).to match(%r{source 'https://rubygems.org'}) - expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1) + expect(gemfile.scan(/gem "myrack", "= 1.0.1"/).size).to eq(1) expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1) expect(gemfile.scan(/group :development/).size).to eq(1) end @@ -129,7 +129,7 @@ RSpec.describe "bundle init" do context "when gems.rb already exists" do before do - create_file("gems.rb", <<-G) + gemfile("gems.rb", <<-G) gem "rails" G end @@ -167,7 +167,7 @@ RSpec.describe "bundle init" do file << <<-S Gem::Specification.new do |s| s.name = 'test' - s.add_dependency 'rack', '= 1.0.1' + s.add_dependency 'myrack', '= 1.0.1' s.add_development_dependency 'rspec', '1.2' end S @@ -179,7 +179,7 @@ RSpec.describe "bundle init" do gemfile = bundled_app("gems.rb").read expect(gemfile).to match(%r{source 'https://rubygems.org'}) - expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1) + expect(gemfile.scan(/gem "myrack", "= 1.0.1"/).size).to eq(1) expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1) expect(gemfile.scan(/group :development/).size).to eq(1) end diff --git a/spec/bundler/commands/inject_spec.rb b/spec/bundler/commands/inject_spec.rb index 255a03c135..193806a02a 100644 --- a/spec/bundler/commands/inject_spec.rb +++ b/spec/bundler/commands/inject_spec.rb @@ -3,16 +3,16 @@ RSpec.describe "bundle inject", bundler: "< 3" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end context "without a lockfile" do it "locks with the injected gems" do expect(bundled_app_lock).not_to exist - bundle "inject 'rack-obama' '> 0'" - expect(bundled_app_lock.read).to match(/rack-obama/) + bundle "inject 'myrack-obama' '> 0'" + expect(bundled_app_lock.read).to match(/myrack-obama/) end end @@ -22,21 +22,21 @@ RSpec.describe "bundle inject", bundler: "< 3" do end it "adds the injected gems to the Gemfile" do - expect(bundled_app_gemfile.read).not_to match(/rack-obama/) - bundle "inject 'rack-obama' '> 0'" - expect(bundled_app_gemfile.read).to match(/rack-obama/) + expect(bundled_app_gemfile.read).not_to match(/myrack-obama/) + bundle "inject 'myrack-obama' '> 0'" + expect(bundled_app_gemfile.read).to match(/myrack-obama/) end it "locks with the injected gems" do - expect(bundled_app_lock.read).not_to match(/rack-obama/) - bundle "inject 'rack-obama' '> 0'" - expect(bundled_app_lock.read).to match(/rack-obama/) + expect(bundled_app_lock.read).not_to match(/myrack-obama/) + bundle "inject 'myrack-obama' '> 0'" + expect(bundled_app_lock.read).to match(/myrack-obama/) end end context "with injected gems already in the Gemfile" do it "doesn't add existing gems" do - bundle "inject 'rack' '> 0'", raise_on_error: false + bundle "inject 'myrack' '> 0'", raise_on_error: false expect(err).to match(/cannot specify the same gem twice/i) end end @@ -53,25 +53,25 @@ Usage: "bundle inject GEM VERSION" context "with source option" do it "add gem with source option in gemfile" do - bundle "inject 'foo' '>0' --source #{file_uri_for(gem_repo1)}" + bundle "inject 'foo' '>0' --source https://gem.repo1" gemfile = bundled_app_gemfile.read - str = "gem \"foo\", \"> 0\", :source => \"#{file_uri_for(gem_repo1)}\"" + str = "gem \"foo\", \"> 0\", :source => \"https://gem.repo1\"" expect(gemfile).to include str end end context "with group option" do it "add gem with group option in gemfile" do - bundle "inject 'rack-obama' '>0' --group=development" + bundle "inject 'myrack-obama' '>0' --group=development" gemfile = bundled_app_gemfile.read - str = "gem \"rack-obama\", \"> 0\", :group => :development" + str = "gem \"myrack-obama\", \"> 0\", :group => :development" expect(gemfile).to include str end it "add gem with multiple groups in gemfile" do - bundle "inject 'rack-obama' '>0' --group=development,test" + bundle "inject 'myrack-obama' '>0' --group=development,test" gemfile = bundled_app_gemfile.read - str = "gem \"rack-obama\", \"> 0\", :groups => [:development, :test]" + str = "gem \"myrack-obama\", \"> 0\", :groups => [:development, :test]" expect(gemfile).to include str end end @@ -87,31 +87,31 @@ Usage: "bundle inject GEM VERSION" end it "injects anyway" do - bundle "inject 'rack-obama' '> 0'" - expect(bundled_app_gemfile.read).to match(/rack-obama/) + bundle "inject 'myrack-obama' '> 0'" + expect(bundled_app_gemfile.read).to match(/myrack-obama/) end it "locks with the injected gems" do - expect(bundled_app_lock.read).not_to match(/rack-obama/) - bundle "inject 'rack-obama' '> 0'" - expect(bundled_app_lock.read).to match(/rack-obama/) + expect(bundled_app_lock.read).not_to match(/myrack-obama/) + bundle "inject 'myrack-obama' '> 0'" + expect(bundled_app_lock.read).to match(/myrack-obama/) end it "restores frozen afterwards" do - bundle "inject 'rack-obama' '> 0'" + bundle "inject 'myrack-obama' '> 0'" config = Psych.load(bundled_app(".bundle/config").read) expect(config["BUNDLE_DEPLOYMENT"] || config["BUNDLE_FROZEN"]).to eq("true") end it "doesn't allow Gemfile changes" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack-obama" G - bundle "inject 'rack' '> 0'", raise_on_error: false + bundle "inject 'myrack' '> 0'", raise_on_error: false expect(err).to match(/the lockfile can't be updated because frozen mode is set/) - expect(bundled_app_lock.read).not_to match(/rack-obama/) + expect(bundled_app_lock.read).not_to match(/myrack-obama/) end end end diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 4fa2dce0e8..e47aea368f 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle install with gem sources" do describe "the simple case" do it "prints output and returns if no dependencies are specified" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G bundle :install @@ -22,8 +22,8 @@ RSpec.describe "bundle install with gem sources" do it "creates a Gemfile.lock" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G expect(bundled_app_lock).to exist @@ -31,8 +31,8 @@ RSpec.describe "bundle install with gem sources" do it "does not create ./.bundle by default", bundler: "< 3" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle :install # can't use install_gemfile since it sets retry @@ -41,8 +41,8 @@ RSpec.describe "bundle install with gem sources" do it "does not create ./.bundle by default when installing to system gems" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle :install, env: { "BUNDLE_PATH__SYSTEM" => "true" } # can't use install_gemfile since it sets retry @@ -51,8 +51,8 @@ RSpec.describe "bundle install with gem sources" do it "creates lock files based on the Gemfile name" do gemfile bundled_app("OmgFile"), <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0" + source "https://gem.repo1" + gem "myrack", "1.0" G bundle "install --gemfile OmgFile" @@ -62,8 +62,8 @@ RSpec.describe "bundle install with gem sources" do it "doesn't delete the lockfile if one already exists" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G lockfile = File.read(bundled_app_lock) @@ -77,8 +77,8 @@ RSpec.describe "bundle install with gem sources" do it "does not touch the lockfile if nothing changed" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G expect { run "1" }.not_to change { File.mtime(bundled_app_lock) } @@ -86,60 +86,60 @@ RSpec.describe "bundle install with gem sources" do it "fetches gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G - expect(default_bundle_path("gems/rack-1.0.0")).to exist - expect(the_bundle).to include_gems("rack 1.0.0") + expect(default_bundle_path("gems/myrack-1.0.0")).to exist + expect(the_bundle).to include_gems("myrack 1.0.0") end it "auto-heals missing gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G - FileUtils.rm_rf(default_bundle_path("gems/rack-1.0.0")) + FileUtils.rm_rf(default_bundle_path("gems/myrack-1.0.0")) bundle "install --verbose" - expect(out).to include("Installing rack 1.0.0") - expect(default_bundle_path("gems/rack-1.0.0")).to exist - expect(the_bundle).to include_gems("rack 1.0.0") + expect(out).to include("Installing myrack 1.0.0") + expect(default_bundle_path("gems/myrack-1.0.0")).to exist + expect(the_bundle).to include_gems("myrack 1.0.0") end it "fetches gems when multiple versions are specified" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack', "> 0.9", "< 1.0" + source "https://gem.repo1" + gem 'myrack', "> 0.9", "< 1.0" G - expect(default_bundle_path("gems/rack-0.9.1")).to exist - expect(the_bundle).to include_gems("rack 0.9.1") + expect(default_bundle_path("gems/myrack-0.9.1")).to exist + expect(the_bundle).to include_gems("myrack 0.9.1") end it "fetches gems when multiple versions are specified take 2" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack', "< 1.0", "> 0.9" + source "https://gem.repo1" + gem 'myrack', "< 1.0", "> 0.9" G - expect(default_bundle_path("gems/rack-0.9.1")).to exist - expect(the_bundle).to include_gems("rack 0.9.1") + expect(default_bundle_path("gems/myrack-0.9.1")).to exist + expect(the_bundle).to include_gems("myrack 0.9.1") end it "raises an appropriate error when gems are specified using symbols" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem :rack + source "https://gem.repo1" + gem :myrack G expect(exitstatus).to eq(4) end it "pulls in dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -148,11 +148,11 @@ RSpec.describe "bundle install with gem sources" do it "does the right version" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G - expect(the_bundle).to include_gems "rack 0.9.1" + expect(the_bundle).to include_gems "myrack 0.9.1" end it "does not install the development dependency" do @@ -163,7 +163,7 @@ RSpec.describe "bundle install with gem sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "with_development_dependency" G @@ -173,7 +173,7 @@ RSpec.describe "bundle install with gem sources" do it "resolves correctly" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activemerchant" gem "rails" G @@ -183,12 +183,12 @@ RSpec.describe "bundle install with gem sources" do it "activates gem correctly according to the resolved gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport", "2.3.5" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activemerchant" gem "rails" G @@ -206,7 +206,7 @@ RSpec.describe "bundle install with gem sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activerecord", "2.3.2" G @@ -216,25 +216,23 @@ RSpec.describe "bundle install with gem sources" do it "works when the gemfile specifies gems that only exist in the system" do build_gem "foo", to_bundle: true install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "foo" G - expect(the_bundle).to include_gems "rack 1.0.0", "foo 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0", "foo 1.0.0" end it "prioritizes local gems over remote gems" do - build_gem "rack", "1.0.0", to_bundle: true do |s| - s.add_dependency "activesupport", "2.3.5" - end + build_gem "myrack", "9.0.0", to_bundle: true install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to include_gems "myrack 9.0.0" end it "loads env plugins" do @@ -242,8 +240,8 @@ RSpec.describe "bundle install with gem sources" do create_file "plugins/rubygems_plugin.rb", "puts '#{plugin_msg}'" rubylib = ENV["RUBYLIB"].to_s.split(File::PATH_SEPARATOR).unshift(bundled_app("plugins").to_s).join(File::PATH_SEPARATOR) install_gemfile <<-G, env: { "RUBYLIB" => rubylib } - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G expect(last_command.stdboth).to include(plugin_msg) @@ -254,7 +252,7 @@ RSpec.describe "bundle install with gem sources" do skip "version is 1.0, not 1.0.0" if Gem.win_platform? install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -265,7 +263,7 @@ RSpec.describe "bundle install with gem sources" do it "falls back on plain ruby" do simulate_platform "foo-bar-baz" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -276,7 +274,7 @@ RSpec.describe "bundle install with gem sources" do it "installs gems for java" do simulate_platform "java" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -288,7 +286,7 @@ RSpec.describe "bundle install with gem sources" do simulate_platform x86_mswin32 install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -300,53 +298,53 @@ RSpec.describe "bundle install with gem sources" do describe "doing bundle install foo" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end it "works" do bundle "config set --local path vendor" bundle "install" - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end it "allows running bundle install --system without deleting foo", bundler: "< 3" do bundle "install --path vendor" bundle "install --system" FileUtils.rm_rf(bundled_app("vendor")) - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end it "allows running bundle install --system after deleting foo", bundler: "< 3" do bundle "install --path vendor" FileUtils.rm_rf(bundled_app("vendor")) bundle "install --system" - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end it "finds gems in multiple sources", bundler: "< 3" do build_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end end - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - source "#{file_uri_for(gem_repo2)}" + install_gemfile <<-G, artifice: "compact_index_extra" + source "https://gemserver.test" + source "https://gemserver.test/extra" gem "activesupport", "1.2.3" - gem "rack", "1.2" + gem "myrack", "1.2" G - expect(the_bundle).to include_gems "rack 1.2", "activesupport 1.2.3" + expect(the_bundle).to include_gems "myrack 1.2", "activesupport 1.2.3" end it "gives a useful error if no sources are set" do install_gemfile <<-G, raise_on_error: false - gem "rack" + gem "myrack" G expect(err).to include("This Gemfile does not include an explicit global source. " \ @@ -357,7 +355,7 @@ RSpec.describe "bundle install with gem sources" do it "creates a Gemfile.lock on a blank Gemfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G expect(File.exist?(bundled_app_lock)).to eq(true) @@ -367,12 +365,12 @@ RSpec.describe "bundle install with gem sources" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" - gem "rack" + source "https://gem.repo2" + gem "myrack" + gem "myrack" G - expect(err).to include("Your Gemfile lists the gem rack (>= 0) more than once.") + expect(err).to include("Your Gemfile lists the gem myrack (>= 0) more than once.") expect(err).to include("Remove any duplicate entries and specify the gem only once.") expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.") end @@ -381,12 +379,12 @@ RSpec.describe "bundle install with gem sources" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack", "1.0" - gem "rack", "1.0" + source "https://gem.repo2" + gem "myrack", "1.0" + gem "myrack", "1.0" G - expect(err).to include("Your Gemfile lists the gem rack (= 1.0) more than once.") + expect(err).to include("Your Gemfile lists the gem myrack (= 1.0) more than once.") expect(err).to include("Remove any duplicate entries and specify the gem only once.") expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.") end @@ -395,14 +393,14 @@ RSpec.describe "bundle install with gem sources" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack", :platform => :jruby - gem "rack" + source "https://gem.repo2" + gem "myrack", :platform => :jruby + gem "myrack" G bundle "install" - expect(err).to include("Your Gemfile lists the gem rack (>= 0) more than once.") + expect(err).to include("Your Gemfile lists the gem myrack (>= 0) more than once.") expect(err).to include("Remove any duplicate entries and specify the gem only once.") expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.") end @@ -417,7 +415,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<~G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec @@ -441,7 +439,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec @@ -477,7 +475,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec path: "#{gem1}" gemspec path: "#{gem2}" @@ -499,7 +497,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "rails", "~> 7.0.8" @@ -530,11 +528,11 @@ RSpec.describe "bundle install with gem sources" do build_git "activesupport", "1.0", path: lib_path("activesupport") install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec - gem "activesupport", :git => "#{file_uri_for(lib_path("activesupport"))}" + gem "activesupport", :git => "#{lib_path("activesupport")}" G expect(err).to be_empty @@ -542,9 +540,9 @@ RSpec.describe "bundle install with gem sources" do # if the Gemfile dependency is specified first install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" - gem "activesupport", :git => "#{file_uri_for(lib_path("activesupport"))}" + gem "activesupport", :git => "#{lib_path("activesupport")}" gemspec G @@ -564,7 +562,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec @@ -579,31 +577,31 @@ RSpec.describe "bundle install with gem sources" do it "throws an error if a gem is added twice in Gemfile when version of one dependency is not specified" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" - gem "rack" - gem "rack", "1.0" + source "https://gem.repo2" + gem "myrack" + gem "myrack", "1.0" G expect(err).to include("You cannot specify the same gem twice with different version requirements") - expect(err).to include("You specified: rack (>= 0) and rack (= 1.0).") + expect(err).to include("You specified: myrack (>= 0) and myrack (= 1.0).") end it "throws an error if a gem is added twice in Gemfile when different versions of both dependencies are specified" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" - gem "rack", "1.0" - gem "rack", "1.1" + source "https://gem.repo2" + gem "myrack", "1.0" + gem "myrack", "1.1" G expect(err).to include("You cannot specify the same gem twice with different version requirements") - expect(err).to include("You specified: rack (= 1.0) and rack (= 1.1).") + expect(err).to include("You specified: myrack (= 1.0) and myrack (= 1.1).") end it "gracefully handles error when rubygems server is unavailable" do skip "networking issue" if Gem.win_platform? install_gemfile <<-G, artifice: nil, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" source "http://0.0.0.0:9384" do gem 'foo' end @@ -627,7 +625,7 @@ RSpec.describe "bundle install with gem sources" do end install_gemfile <<-G, full_index: true, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "ajp-rails", "0.0.0" G @@ -642,7 +640,7 @@ RSpec.describe "bundle install with gem sources" do FileUtils.touch(bundled_app(".bundle/config")) install_gemfile(<<-G) - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo' G @@ -653,7 +651,7 @@ RSpec.describe "bundle install with gem sources" do FileUtils.touch("#{Bundler.rubygems.user_home}/.bundle/config") install_gemfile(<<-G) - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo' G @@ -665,7 +663,7 @@ RSpec.describe "bundle install with gem sources" do it "prints an error" do install_gemfile <<-G, raise_on_error: false ruby '~> 1.2' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G expect(err).to include("Your Ruby version is #{Gem.ruby_version}, but your Gemfile specified ~> 1.2") end @@ -675,7 +673,7 @@ RSpec.describe "bundle install with gem sources" do before do install_gemfile <<-G ruby '~> #{Gem.ruby_version}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end @@ -683,7 +681,7 @@ RSpec.describe "bundle install with gem sources" do checksums = checksums_section_when_existing expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -702,14 +700,14 @@ RSpec.describe "bundle install with gem sources" do it "updates Gemfile.lock with updated yet still compatible ruby version" do install_gemfile <<-G ruby '~> #{current_ruby_minor}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G checksums = checksums_section_when_existing expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -727,7 +725,7 @@ RSpec.describe "bundle install with gem sources" do it "does not crash when unlocking" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby '>= 2.1.0' G @@ -746,7 +744,7 @@ RSpec.describe "bundle install with gem sources" do build_lib "foo" gemfile = <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :path => "#{lib_path("foo-1.0")}" G File.open("#{root_dir}/Gemfile", "w") do |file| @@ -763,7 +761,7 @@ RSpec.describe "bundle install with gem sources" do build_lib "foo", path: root_dir gemfile = <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G File.open("#{root_dir}/Gemfile", "w") do |file| @@ -779,8 +777,8 @@ RSpec.describe "bundle install with gem sources" do bundle "config set force_ruby_platform true" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle :install, quiet: true @@ -809,7 +807,7 @@ RSpec.describe "bundle install with gem sources" do RUBY gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'non-existing-gem' G @@ -826,8 +824,8 @@ RSpec.describe "bundle install with gem sources" do before do FileUtils.mkdir_p(bundle_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G end @@ -847,8 +845,8 @@ RSpec.describe "bundle install with gem sources" do before do FileUtils.mkdir_p(gems_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G end @@ -865,7 +863,7 @@ RSpec.describe "bundle install with gem sources" do expect(err).not_to include("ERROR REPORT TEMPLATE") expect(err).to include( - "There was an error while trying to create `#{gems_path.join("rack-1.0.0")}`. " \ + "There was an error while trying to create `#{gems_path.join("myrack-1.0.0")}`. " \ "It is likely that you need to grant executable permissions for all parent directories and write permissions for `#{gems_path}`." ) end @@ -877,8 +875,8 @@ RSpec.describe "bundle install with gem sources" do before do FileUtils.mkdir_p(bin_dir) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G end @@ -937,7 +935,7 @@ RSpec.describe "bundle install with gem sources" do before do FileUtils.mkdir_p(extensions_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'simple_binary' G end @@ -973,7 +971,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo' G end @@ -1009,7 +1007,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo' G end @@ -1044,7 +1042,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo' G end @@ -1069,8 +1067,8 @@ RSpec.describe "bundle install with gem sources" do before do FileUtils.mkdir_p(cache_path) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G end @@ -1085,12 +1083,12 @@ RSpec.describe "bundle install with gem sources" do end describe "when gemspecs are unreadable", :permissions do - let(:gemspec_path) { vendored_gems("specifications/rack-1.0.0.gemspec") } + let(:gemspec_path) { vendored_gems("specifications/myrack-1.0.0.gemspec") } before do gemfile <<~G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle "config path vendor/bundle" bundle :install @@ -1110,16 +1108,16 @@ RSpec.describe "bundle install with gem sources" do context "after installing with --standalone" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "config set --local path bundle" bundle "install", standalone: true end it "includes the standalone path" do - bundle "binstubs rack", standalone: true - standalone_line = File.read(bundled_app("bin/rackup")).each_line.find {|line| line.include? "$:.unshift" }.strip + bundle "binstubs myrack", standalone: true + standalone_line = File.read(bundled_app("bin/myrackup")).each_line.find {|line| line.include? "$:.unshift" }.strip expect(standalone_line).to eq %($:.unshift File.expand_path "../bundle", __dir__) end end @@ -1149,14 +1147,14 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "libv8" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: libv8 (8.4.255.0-x86_64-darwin-19) @@ -1295,15 +1293,15 @@ RSpec.describe "bundle install with gem sources" do context "with --local flag" do before do - system_gems "rack-1.0.0", path: default_bundle_path + system_gems "myrack-1.0.0", path: default_bundle_path end it "respects installed gems without fetching any remote sources" do install_gemfile <<-G, local: true - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" source "https://not-existing-source" do - gem "rack" + gem "myrack" end G @@ -1318,14 +1316,14 @@ RSpec.describe "bundle install with gem sources" do it "installs only gems of the specified groups" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" - gem "rack", group: :a + gem "myrack", group: :a gem "rake", group: :b gem "yard", group: :c G - expect(out).to include("Installing rack") + expect(out).to include("Installing myrack") expect(out).to include("Installing rake") expect(out).not_to include("Installing yard") end @@ -1344,7 +1342,7 @@ RSpec.describe "bundle install with gem sources" do it "fetches remote sources only when not available locally" do install_gemfile <<-G, "prefer-local": true, verbose: true - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "foo" gem "bar" @@ -1381,7 +1379,7 @@ RSpec.describe "bundle install with gem sources" do it "installs fine" do install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "binman" G @@ -1403,7 +1401,7 @@ RSpec.describe "bundle install with gem sources" do it "does not crash unexpectedly" do gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "autobuild", "1.10.rc2" G @@ -1426,7 +1424,7 @@ RSpec.describe "bundle install with gem sources" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "aaa" gem "zzz" @@ -1434,7 +1432,7 @@ RSpec.describe "bundle install with gem sources" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: aaa (0.2.0) zzz (< 0.2.0) @@ -1460,7 +1458,7 @@ RSpec.describe "bundle install with gem sources" do context "when --jobs option given" do before do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", jobs: 1 + install_gemfile "source 'https://gem.repo1'", jobs: 1 end it "does not save the flag to config" do @@ -1478,7 +1476,7 @@ RSpec.describe "bundle install with gem sources" do it "shows a proper error" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1490,7 +1488,7 @@ RSpec.describe "bundle install with gem sources" do 9.99.8 L - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", env: { "BUNDLER_VERSION" => "9.99.8" }, raise_on_error: false + install_gemfile "source \"https://gem.repo1\"", env: { "BUNDLER_VERSION" => "9.99.8" }, raise_on_error: false expect(err).not_to include("ERROR REPORT TEMPLATE") expect(err).to include("The running version of Bundler (9.99.9) does not match the version of the specification installed for it (9.99.8)") diff --git a/spec/bundler/commands/issue_spec.rb b/spec/bundler/commands/issue_spec.rb index 143f6333ce..346cdedc42 100644 --- a/spec/bundler/commands/issue_spec.rb +++ b/spec/bundler/commands/issue_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "bundle issue" do it "exits with a message" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G diff --git a/spec/bundler/commands/licenses_spec.rb b/spec/bundler/commands/licenses_spec.rb index a203984890..bfec938efd 100644 --- a/spec/bundler/commands/licenses_spec.rb +++ b/spec/bundler/commands/licenses_spec.rb @@ -9,7 +9,7 @@ RSpec.describe "bundle licenses" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails" gem "with_license" G @@ -24,7 +24,7 @@ RSpec.describe "bundle licenses" do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails" gem "with_license" gem "foo" diff --git a/spec/bundler/commands/list_spec.rb b/spec/bundler/commands/list_spec.rb index 660935f06f..cc0db9169d 100644 --- a/spec/bundler/commands/list_spec.rb +++ b/spec/bundler/commands/list_spec.rb @@ -20,9 +20,9 @@ RSpec.describe "bundle list" do describe "with without-group option" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" gem "rspec", :group => [:test] gem "rails", :group => [:production] G @@ -32,7 +32,7 @@ RSpec.describe "bundle list" do it "prints the gems not in the specified group" do bundle "list --without-group test" - expect(out).to include(" * rack (1.0.0)") + expect(out).to include(" * myrack (1.0.0)") expect(out).to include(" * rails (2.3.2)") expect(out).not_to include(" * rspec (1.2.7)") end @@ -50,7 +50,7 @@ RSpec.describe "bundle list" do it "prints the gems not in the specified groups" do bundle "list --without-group test production" - expect(out).to include(" * rack (1.0.0)") + expect(out).to include(" * myrack (1.0.0)") expect(out).not_to include(" * rails (2.3.2)") expect(out).not_to include(" * rspec (1.2.7)") end @@ -60,9 +60,9 @@ RSpec.describe "bundle list" do describe "with only-group option" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" gem "rspec", :group => [:test] gem "rails", :group => [:production] G @@ -72,7 +72,7 @@ RSpec.describe "bundle list" do it "prints the gems in the specified group" do bundle "list --only-group default" - expect(out).to include(" * rack (1.0.0)") + expect(out).to include(" * myrack (1.0.0)") expect(out).not_to include(" * rspec (1.2.7)") end end @@ -89,7 +89,7 @@ RSpec.describe "bundle list" do it "prints the gems in the specified groups" do bundle "list --only-group default production" - expect(out).to include(" * rack (1.0.0)") + expect(out).to include(" * myrack (1.0.0)") expect(out).to include(" * rails (2.3.2)") expect(out).not_to include(" * rspec (1.2.7)") end @@ -99,9 +99,9 @@ RSpec.describe "bundle list" do context "with name-only option" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" gem "rspec", :group => [:test] G end @@ -109,7 +109,7 @@ RSpec.describe "bundle list" do it "prints only the name of the gems in the bundle" do bundle "list --name-only" - expect(out).to include("rack") + expect(out).to include("myrack") expect(out).to include("rspec") end end @@ -117,8 +117,8 @@ RSpec.describe "bundle list" do context "with paths option" do before do build_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "bar" @@ -131,8 +131,8 @@ RSpec.describe "bundle list" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" gem "rails" gem "git_test", :git => "#{lib_path("git_test")}" gemspec :path => "#{tmp("gemspec_test")}" @@ -142,7 +142,7 @@ RSpec.describe "bundle list" do it "prints the path of each gem in the bundle" do bundle "list --paths" expect(out).to match(%r{.*\/rails\-2\.3\.2}) - expect(out).to match(%r{.*\/rack\-1\.2}) + expect(out).to match(%r{.*\/myrack\-1\.2}) expect(out).to match(%r{.*\/git_test\-\w}) expect(out).to match(%r{.*\/gemspec_test}) end @@ -151,7 +151,7 @@ RSpec.describe "bundle list" do context "when no gems are in the gemfile" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end @@ -164,25 +164,25 @@ RSpec.describe "bundle list" do context "without options" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" gem "rspec", :group => [:test] G end it "lists gems installed in the bundle" do bundle "list" - expect(out).to include(" * rack (1.0.0)") + expect(out).to include(" * myrack (1.0.0)") end end context "when using the ls alias" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" gem "rspec", :group => [:test] G end diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index b0d6fa9134..8fff770e88 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -1,31 +1,31 @@ # frozen_string_literal: true RSpec.describe "bundle lock" do - let(:repo) { gem_repo1 } - before :each do + build_repo2 + gemfile <<-G - source "#{file_uri_for(repo)}" + source "https://gem.repo2" gem "rails" gem "weakling" gem "foo" G checksums = checksums_section_when_existing do |c| - c.checksum repo, "actionmailer", "2.3.2" - c.checksum repo, "actionpack", "2.3.2" - c.checksum repo, "activerecord", "2.3.2" - c.checksum repo, "activeresource", "2.3.2" - c.checksum repo, "activesupport", "2.3.2" - c.checksum repo, "foo", "1.0" - c.checksum repo, "rails", "2.3.2" - c.checksum repo, "rake", rake_version - c.checksum repo, "weakling", "0.0.3" + c.checksum gem_repo2, "actionmailer", "2.3.2" + c.checksum gem_repo2, "actionpack", "2.3.2" + c.checksum gem_repo2, "activerecord", "2.3.2" + c.checksum gem_repo2, "activeresource", "2.3.2" + c.checksum gem_repo2, "activesupport", "2.3.2" + c.checksum gem_repo2, "foo", "1.0" + c.checksum gem_repo2, "rails", "2.3.2" + c.checksum gem_repo2, "rake", rake_version + c.checksum gem_repo2, "weakling", "0.0.3" end @lockfile = <<~L GEM - remote: #{file_uri_for(repo)}/ + remote: https://gem.repo2/ specs: actionmailer (2.3.2) activesupport (= 2.3.2) @@ -151,8 +151,8 @@ RSpec.describe "bundle lock" do end it "works with --gemfile flag" do - create_file "CustomGemfile", <<-G - source "#{file_uri_for(repo)}" + gemfile "CustomGemfile", <<-G + source "https://gem.repo2" gem "foo" G checksums = checksums_section_when_existing do |c| @@ -161,7 +161,7 @@ RSpec.describe "bundle lock" do lockfile = <<~L GEM - remote: #{file_uri_for(repo)}/ + remote: https://gem.repo2/ specs: foo (1.0) @@ -194,20 +194,20 @@ RSpec.describe "bundle lock" do bundle "lock --lockfile=lock" checksums = checksums_section_when_existing do |c| - c.checksum repo, "actionmailer", "2.3.2" - c.checksum repo, "actionpack", "2.3.2" - c.checksum repo, "activerecord", "2.3.2" - c.checksum repo, "activeresource", "2.3.2" - c.checksum repo, "activesupport", "2.3.2" - c.checksum repo, "foo", "1.0" - c.checksum repo, "rails", "2.3.2" - c.checksum repo, "rake", rake_version - c.checksum repo, "weakling", "0.0.3" + c.checksum gem_repo2, "actionmailer", "2.3.2" + c.checksum gem_repo2, "actionpack", "2.3.2" + c.checksum gem_repo2, "activerecord", "2.3.2" + c.checksum gem_repo2, "activeresource", "2.3.2" + c.checksum gem_repo2, "activesupport", "2.3.2" + c.checksum gem_repo2, "foo", "1.0" + c.checksum gem_repo2, "rails", "2.3.2" + c.checksum gem_repo2, "rake", rake_version + c.checksum gem_repo2, "weakling", "0.0.3" end lockfile = <<~L GEM - remote: #{file_uri_for(repo)}/ + remote: https://gem.repo2/ specs: actionmailer (2.3.2) activesupport (= 2.3.2) @@ -275,7 +275,7 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "tapioca" gem "ruby-lsp" @@ -283,7 +283,7 @@ RSpec.describe "bundle lock" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: prism (0.15.1) ruby-lsp (0.12.0) @@ -338,7 +338,7 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "tapioca" gem "ruby-lsp" @@ -347,7 +347,7 @@ RSpec.describe "bundle lock" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: other-prism-dependent (1.0.0) prism (>= 0.15.1) @@ -388,14 +388,14 @@ RSpec.describe "bundle lock" do build_git("foo") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo-1.0")}" G # Change uri format to end with "/" and reinstall install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}/" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo-1.0")}/" G expect(out).to include("using resolution from the lockfile") @@ -406,21 +406,21 @@ RSpec.describe "bundle lock" do ref = build_git("foo").ref_for("HEAD") gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" - gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :branch => "deadbeef" + gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "deadbeef" G lockfile <<~L GIT - remote: #{file_uri_for(lib_path("foo-1.0"))} + remote: #{lib_path("foo-1.0")} revision: #{ref} branch: deadbeef specs: foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: rake (10.0.1) @@ -451,10 +451,10 @@ RSpec.describe "bundle lock" do it "can lock without downloading gems" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "thin" - gem "rack_middleware", :group => "test" + gem "myrack_middleware", :group => "test" G bundle "config set without test" bundle "config set path vendor/bundle" @@ -485,7 +485,7 @@ RSpec.describe "bundle lock" do # establish a lockfile set to 1.4.3 install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo', '1.4.3' gem 'bar', '2.0.3' gem 'qux', '1.0.0' @@ -494,7 +494,7 @@ RSpec.describe "bundle lock" do # remove 1.4.3 requirement and bar altogether # to setup update specs below gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo' gem 'qux' G @@ -517,7 +517,7 @@ RSpec.describe "bundle lock" do it "shows proper error when Gemfile changes forbid patch upgrades, and --patch --strict is given" do # force next minor via Gemfile gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo', '1.5.0' gem 'qux' G @@ -568,13 +568,13 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'sequel' G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sequel (5.71.0) @@ -606,7 +606,7 @@ RSpec.describe "bundle lock" do system_gems "bundler-55", gem_repo: gem_repo4 install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } - source "https://gems.repo4" + source "https://gem.repo4" G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2') @@ -632,7 +632,7 @@ RSpec.describe "bundle lock" do it "supports adding new platforms with force_ruby_platform = true" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: platform_specific (1.0) platform_specific (1.0-x86-64_linux) @@ -694,7 +694,7 @@ RSpec.describe "bundle lock" do simulate_platform "x86_64-darwin-22" do install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" G @@ -702,7 +702,7 @@ RSpec.describe "bundle lock" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.12.0) nokogiri (1.12.0-x86_64-darwin) @@ -726,7 +726,7 @@ RSpec.describe "bundle lock" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.12.0-x86_64-darwin) @@ -777,7 +777,7 @@ RSpec.describe "bundle lock" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "mixlib-shellout" gem "gssapi" @@ -794,7 +794,7 @@ RSpec.describe "bundle lock" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: ffi (1.9.14-x86-mingw32) gssapi (1.2.0) @@ -823,7 +823,7 @@ RSpec.describe "bundle lock" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: ffi (1.9.14) ffi (1.9.14-x86-mingw32) @@ -861,14 +861,14 @@ RSpec.describe "bundle lock" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "libv8" G lockfile <<-G GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: libv8 (8.4.255.0) libv8 (8.4.255.0-x86_64-darwin-19) @@ -901,7 +901,7 @@ RSpec.describe "bundle lock" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "libv8" G @@ -915,7 +915,7 @@ RSpec.describe "bundle lock" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: libv8 (8.4.255.0-x86_64-darwin-19) libv8 (8.4.255.0-x86_64-darwin-20) @@ -949,14 +949,14 @@ RSpec.describe "bundle lock" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "libv8" G lockfile <<-G GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: libv8 (8.4.255.0-x86_64-darwin-19) libv8 (8.4.255.0-x86_64-darwin-20) @@ -1121,14 +1121,11 @@ RSpec.describe "bundle lock" do end context "when an update is available" do - let(:repo) do + before do build_repo2 do build_gem "foo", "2.0" end - gem_repo2 - end - before do lockfile(@lockfile) end @@ -1136,20 +1133,20 @@ RSpec.describe "bundle lock" do bundle "lock" checksums = checksums_section_when_existing do |c| - c.checksum repo, "actionmailer", "2.3.2" - c.checksum repo, "actionpack", "2.3.2" - c.checksum repo, "activerecord", "2.3.2" - c.checksum repo, "activeresource", "2.3.2" - c.checksum repo, "activesupport", "2.3.2" - c.checksum repo, "foo", "1.0" - c.checksum repo, "rails", "2.3.2" - c.checksum repo, "rake", rake_version - c.checksum repo, "weakling", "0.0.3" + c.checksum gem_repo2, "actionmailer", "2.3.2" + c.checksum gem_repo2, "actionpack", "2.3.2" + c.checksum gem_repo2, "activerecord", "2.3.2" + c.checksum gem_repo2, "activeresource", "2.3.2" + c.checksum gem_repo2, "activesupport", "2.3.2" + c.checksum gem_repo2, "foo", "1.0" + c.checksum gem_repo2, "rails", "2.3.2" + c.checksum gem_repo2, "rake", rake_version + c.checksum gem_repo2, "weakling", "0.0.3" end expected_lockfile = <<~L GEM - remote: #{file_uri_for(repo)}/ + remote: https://gem.repo2/ specs: actionmailer (2.3.2) activesupport (= 2.3.2) @@ -1190,20 +1187,20 @@ RSpec.describe "bundle lock" do bundle "lock" checksums = checksums_section_when_existing do |c| - c.checksum repo, "actionmailer", "2.3.2" - c.checksum repo, "actionpack", "2.3.2" - c.checksum repo, "activerecord", "2.3.2" - c.checksum repo, "activeresource", "2.3.2" - c.checksum repo, "activesupport", "2.3.2" + c.checksum gem_repo2, "actionmailer", "2.3.2" + c.checksum gem_repo2, "actionpack", "2.3.2" + c.checksum gem_repo2, "activerecord", "2.3.2" + c.checksum gem_repo2, "activeresource", "2.3.2" + c.checksum gem_repo2, "activesupport", "2.3.2" c.no_checksum "foo", "2.0" - c.checksum repo, "rails", "2.3.2" - c.checksum repo, "rake", rake_version - c.checksum repo, "weakling", "0.0.3" + c.checksum gem_repo2, "rails", "2.3.2" + c.checksum gem_repo2, "rake", rake_version + c.checksum gem_repo2, "weakling", "0.0.3" end expected_lockfile = <<~L GEM - remote: #{file_uri_for(repo)}/ + remote: https://gem.repo2/ specs: actionmailer (2.3.2) activesupport (= 2.3.2) @@ -1262,14 +1259,19 @@ RSpec.describe "bundle lock" do it "respects the existing lockfile, even when reresolving" do gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "debug" G + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "debug", "1.6.3" + c.checksum gem_repo4, "irb", "1.5.0" + end + lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: debug (1.6.3) irb (>= 1.3.6) @@ -1280,7 +1282,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES debug - #{checksums_section} + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1289,14 +1291,9 @@ RSpec.describe "bundle lock" do bundle "lock" end - checksums = checksums_section do |c| - c.no_checksum "debug", "1.6.3" - c.no_checksum "irb", "1.5.0" - end - expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: debug (1.6.3) irb (>= 1.3.6) @@ -1335,7 +1332,7 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "rails", ">= 7.0.3.1" gem "activeadmin", "2.13.1" @@ -1349,7 +1346,7 @@ RSpec.describe "bundle lock" do Because rails >= 7.0.4 depends on railties = 7.0.4 and rails < 7.0.4 depends on railties = 7.0.3.1, railties = 7.0.3.1 OR = 7.0.4 is required. - So, because railties = 7.0.3.1 OR = 7.0.4 could not be found in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally, + So, because railties = 7.0.3.1 OR = 7.0.4 could not be found in rubygems repository https://gem.repo4/ or installed locally, version solving has failed. ERR end @@ -1390,7 +1387,7 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "rails", ">= 7.0.2.3" gem "activeadmin", "= 2.13.1" @@ -1398,7 +1395,7 @@ RSpec.describe "bundle lock" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: activeadmin (2.13.1) ransack (= 3.1.0) @@ -1460,7 +1457,7 @@ RSpec.describe "bundle lock" do Thus, rails >= 7.0.2.3, < 7.0.4 cannot be used. And because rails >= 7.0.4 depends on activemodel = 7.0.4, rails >= 7.0.2.3 requires activemodel = 7.0.4. - So, because activemodel = 7.0.4 could not be found in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally + So, because activemodel = 7.0.4 could not be found in rubygems repository https://gem.repo4/ or installed locally and Gemfile depends on rails >= 7.0.2.3, version solving has failed. ERR @@ -1483,7 +1480,7 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "autoproj", ">= 2.0.0" G @@ -1508,7 +1505,7 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "rails" G @@ -1531,7 +1528,7 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "activerecord", "6.0.6" gem "activerecord-jdbc-adapter", "61.0" G @@ -1557,7 +1554,7 @@ RSpec.describe "bundle lock" do it "does not end up including gems scoped to other platforms in the lockfile" do gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "rails" gem "tzinfo-data", platform: :windows G @@ -1584,7 +1581,7 @@ RSpec.describe "bundle lock" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec G end @@ -1607,7 +1604,7 @@ RSpec.describe "bundle lock" do nokogiri GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.14.2) @@ -1644,7 +1641,7 @@ RSpec.describe "bundle lock" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "govuk_app_config" gem "activesupport", "7.0.4.3" @@ -1655,7 +1652,7 @@ RSpec.describe "bundle lock" do # version lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: actionpack (7.0.4.1) activesupport (7.0.4.1) @@ -1690,7 +1687,7 @@ RSpec.describe "bundle lock" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: actionpack (7.0.4.3) activesupport (7.0.4.3) diff --git a/spec/bundler/commands/open_spec.rb b/spec/bundler/commands/open_spec.rb index 18f4db38c9..e0c79aa407 100644 --- a/spec/bundler/commands/open_spec.rb +++ b/spec/bundler/commands/open_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle open" do context "when opening a regular gem" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G end @@ -39,7 +39,7 @@ RSpec.describe "bundle open" do ref = git.ref_for("main", 11) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{lib_path("foo-1.0")}" G @@ -134,7 +134,7 @@ RSpec.describe "bundle open" do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" gem "foo" G @@ -163,7 +163,7 @@ RSpec.describe "bundle open" do skip "No default gems available on this test run" if default_gems.empty? install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb index e7edc67e57..c5663acfb8 100644 --- a/spec/bundler/commands/outdated_spec.rb +++ b/spec/bundler/commands/outdated_spec.rb @@ -9,7 +9,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -46,7 +46,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "AAA", "1.0.0" G @@ -77,7 +77,7 @@ RSpec.describe "bundle outdated" do it "adds gem group to dependency output when repo is updated" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "terranova", '8' @@ -109,7 +109,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -126,14 +126,14 @@ RSpec.describe "bundle outdated" do update_repo2 { build_gem "terranova", "9" } install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "terranova", '9' gem 'activesupport', '2.3.5' G gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "terranova", '8' gem 'activesupport', '2.3.5' @@ -225,7 +225,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "weakling", "~> 0.0.1" gem "terranova", '8' @@ -301,7 +301,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "bar_dependant", '7.0' G @@ -331,7 +331,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "weakling", "~> 0.0.1" gem "terranova", '8' @@ -375,7 +375,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "weakling", "~> 0.0.1" gem "terranova", '8' @@ -394,7 +394,7 @@ RSpec.describe "bundle outdated" do bundle "config set clean false" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.4" G @@ -428,7 +428,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -474,7 +474,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -507,7 +507,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -554,7 +554,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "3.0.0.beta.1" G @@ -578,7 +578,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -622,7 +622,7 @@ RSpec.describe "bundle outdated" do it "doesn't crash when some deps unused on the current platform" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", platforms: [:ruby_22] G @@ -633,8 +633,8 @@ RSpec.describe "bundle outdated" do it "only reports gem dependencies when they can actually be updated" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack_middleware", "1.0" + source "https://gem.repo2" + gem "myrack_middleware", "1.0" G bundle :outdated, "filter-strict": true @@ -645,7 +645,7 @@ RSpec.describe "bundle outdated" do describe "and filter options" do it "only reports gems that match requirement and patch filter level" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "~> 2.3" gem "weakling", ">= 0.0.1" G @@ -667,7 +667,7 @@ RSpec.describe "bundle outdated" do it "only reports gems that match requirement and minor filter level" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "~> 2.3" gem "weakling", ">= 0.0.1" G @@ -689,7 +689,7 @@ RSpec.describe "bundle outdated" do it "only reports gems that match requirement and major filter level" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "~> 2.3" gem "weakling", ">= 0.0.1" G @@ -719,7 +719,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -742,8 +742,8 @@ RSpec.describe "bundle outdated" do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" gem "foo" G @@ -757,9 +757,9 @@ RSpec.describe "bundle outdated" do build_repo2 gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - gem "rack" + gem "myrack" gem "foo" G bundle :lock @@ -786,9 +786,9 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - gem "rack" + gem "myrack" gem "foo" G bundle "config set --local deployment true" @@ -811,7 +811,7 @@ RSpec.describe "bundle outdated" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "laduradura", '= 5.15.2' G end @@ -829,7 +829,7 @@ RSpec.describe "bundle outdated" do it "reports that updates are available if the Ruby platform is used" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "laduradura", '= 5.15.2', :platforms => [:ruby, :jruby] G @@ -839,7 +839,7 @@ RSpec.describe "bundle outdated" do it "reports that updates are available if the JRuby platform is used", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "laduradura", '= 5.15.2', :platforms => [:ruby, :jruby] G @@ -872,7 +872,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -898,7 +898,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -928,7 +928,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -954,7 +954,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -987,7 +987,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -1013,7 +1013,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -1039,7 +1039,7 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "zebra", :git => "#{lib_path("zebra")}" gem "foo", :git => "#{lib_path("foo")}" gem "activesupport", "2.3.5" @@ -1123,7 +1123,7 @@ RSpec.describe "bundle outdated" do # establish a lockfile set to 1.0.0 install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'patch', '1.0.0' gem 'minor', '1.0.0' gem 'major', '1.0.0' @@ -1131,7 +1131,7 @@ RSpec.describe "bundle outdated" do # remove all version requirements gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'patch' gem 'minor' gem 'major' @@ -1196,7 +1196,7 @@ RSpec.describe "bundle outdated" do # establish a lockfile set to 1.4.3 install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo', '1.4.3' gem 'bar', '2.0.3' gem 'qux', '1.0.0' @@ -1205,7 +1205,7 @@ RSpec.describe "bundle outdated" do # remove 1.4.3 requirement and bar altogether # to setup update specs below gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo' gem 'qux' G @@ -1246,13 +1246,13 @@ RSpec.describe "bundle outdated" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'weakling', '0.2' gem 'bar', '2.1' G gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'weakling' G @@ -1283,7 +1283,7 @@ RSpec.describe "bundle outdated" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.11.1) nokogiri (1.11.1-#{Bundler.local_platform}) @@ -1300,7 +1300,7 @@ RSpec.describe "bundle outdated" do L gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" G end @@ -1330,14 +1330,14 @@ RSpec.describe "bundle outdated" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "mini_portile2" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: mini_portile2 (2.5.2) net-ftp (~> 0.1) diff --git a/spec/bundler/commands/platform_spec.rb b/spec/bundler/commands/platform_spec.rb index 61e615acae..370cc601c0 100644 --- a/spec/bundler/commands/platform_spec.rb +++ b/spec/bundler/commands/platform_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle platform" do context "without flags" do it "returns all the output" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" #{ruby_version_correct} @@ -27,7 +27,7 @@ G it "returns all the output including the patchlevel" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" #{ruby_version_correct_patchlevel} @@ -50,7 +50,7 @@ G it "doesn't print ruby version requirement if it isn't specified" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" G @@ -68,7 +68,7 @@ G it "doesn't match the ruby version requirement" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" #{ruby_version_incorrect} @@ -93,7 +93,7 @@ G context "--ruby" do it "returns ruby version when explicit" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3' gem "foo" @@ -106,7 +106,7 @@ G it "defaults to MRI" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "1.9.3" gem "foo" @@ -119,7 +119,7 @@ G it "handles jruby" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5' gem "foo" @@ -132,7 +132,7 @@ G it "handles rbx" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4' gem "foo" @@ -145,7 +145,7 @@ G it "handles truffleruby" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "2.5.1", :engine => 'truffleruby', :engine_version => '1.0.0-rc6' gem "foo" @@ -158,7 +158,7 @@ G it "raises an error if engine is used but engine version is not" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "1.8.7", :engine => 'rbx' gem "foo" @@ -171,7 +171,7 @@ G it "raises an error if engine_version is used but engine is not" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "1.8.7", :engine_version => '1.2.4' gem "foo" @@ -184,7 +184,7 @@ G it "raises an error if engine version doesn't match ruby version for MRI" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "1.8.7", :engine => 'ruby', :engine_version => '1.2.4' gem "foo" @@ -197,7 +197,7 @@ G it "should print if no ruby version is specified" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" G @@ -209,13 +209,13 @@ G it "handles when there is a locked requirement" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "< 1.8.7" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -236,12 +236,12 @@ G it "handles when there is a lockfile with no requirement" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -259,7 +259,7 @@ G it "handles when there is a requirement in the gemfile" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby ">= 1.8.7" G @@ -269,7 +269,7 @@ G it "handles when there are multiple requirements in the gemfile" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby ">= 1.8.7", "< 2.0.0" G @@ -315,8 +315,8 @@ G context "bundle install" do it "installs fine when the ruby version matches" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{ruby_version_correct} G @@ -326,8 +326,8 @@ G it "installs fine with any engine", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{ruby_version_correct_engineless} G @@ -337,8 +337,8 @@ G it "installs fine when the patchlevel matches" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{ruby_version_correct_patchlevel} G @@ -348,8 +348,8 @@ G it "doesn't install when the ruby version doesn't match" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{ruby_version_incorrect} G @@ -360,8 +360,8 @@ G it "doesn't install when engine doesn't match" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{engine_incorrect} G @@ -372,8 +372,8 @@ G it "doesn't install when engine version doesn't match", :jruby_only do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{engine_version_incorrect} G @@ -384,8 +384,8 @@ G it "doesn't install when patchlevel doesn't match" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{patchlevel_incorrect} G @@ -398,13 +398,13 @@ G context "bundle check" do it "checks fine when the ruby version matches" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{ruby_version_correct} G @@ -415,13 +415,13 @@ G it "checks fine with any engine", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{ruby_version_correct_engineless} G @@ -432,13 +432,13 @@ G it "fails when ruby version doesn't match" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{ruby_version_incorrect} G @@ -449,13 +449,13 @@ G it "fails when engine doesn't match" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{engine_incorrect} G @@ -466,13 +466,13 @@ G it "fails when engine version doesn't match", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{engine_version_incorrect} G @@ -483,13 +483,13 @@ G it "fails when patchlevel doesn't match" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{patchlevel_incorrect} G @@ -504,57 +504,57 @@ G build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" G end it "updates successfully when the ruby version matches" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" #{ruby_version_correct} G update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "activesupport", "3.0" end bundle "update", all: true - expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" + expect(the_bundle).to include_gems "myrack 1.2", "myrack-obama 1.0", "activesupport 3.0" end it "updates fine with any engine", :jruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" #{ruby_version_correct_engineless} G update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "activesupport", "3.0" end bundle "update", all: true - expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" + expect(the_bundle).to include_gems "myrack 1.2", "myrack-obama 1.0", "activesupport 3.0" end it "fails when ruby version doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" #{ruby_version_incorrect} G @@ -568,9 +568,9 @@ G it "fails when ruby engine doesn't match", :jruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" #{engine_incorrect} G @@ -584,9 +584,9 @@ G it "fails when ruby engine version doesn't match", :jruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" #{engine_version_incorrect} G @@ -600,8 +600,8 @@ G it "fails when patchlevel doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{patchlevel_incorrect} G @@ -617,14 +617,14 @@ G context "bundle info" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G end it "prints path if ruby version is correct" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" #{ruby_version_correct} @@ -636,7 +636,7 @@ G it "prints path if ruby version is correct for any engine", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" #{ruby_version_correct_engineless} @@ -648,7 +648,7 @@ G it "fails if ruby version doesn't match", bundler: "< 3" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" #{ruby_version_incorrect} @@ -660,7 +660,7 @@ G it "fails if engine doesn't match", bundler: "< 3" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" #{engine_incorrect} @@ -672,7 +672,7 @@ G it "fails if engine version doesn't match", bundler: "< 3", jruby_only: true do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" #{engine_version_incorrect} @@ -684,8 +684,8 @@ G it "fails when patchlevel doesn't match", bundler: "< 3" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{patchlevel_incorrect} G @@ -701,39 +701,39 @@ G context "bundle cache" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G end it "copies the .gem file to vendor/cache when ruby version matches" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{ruby_version_correct} G bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end it "copies the .gem file to vendor/cache when ruby version matches for any engine", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{ruby_version_correct_engineless} G bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end it "fails if the ruby version doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{ruby_version_incorrect} G @@ -744,8 +744,8 @@ G it "fails if the engine doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{engine_incorrect} G @@ -756,8 +756,8 @@ G it "fails if the engine version doesn't match", :jruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{engine_version_incorrect} G @@ -768,8 +768,8 @@ G it "fails when patchlevel doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{patchlevel_incorrect} G @@ -782,39 +782,39 @@ G context "bundle pack" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G end it "copies the .gem file to vendor/cache when ruby version matches" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{ruby_version_correct} G bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end it "copies the .gem file to vendor/cache when ruby version matches any engine", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{ruby_version_correct_engineless} G bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist end it "fails if the ruby version doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{ruby_version_incorrect} G @@ -825,8 +825,8 @@ G it "fails if the engine doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{engine_incorrect} G @@ -837,8 +837,8 @@ G it "fails if the engine version doesn't match", :jruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' #{engine_version_incorrect} G @@ -849,8 +849,8 @@ G it "fails when patchlevel doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{patchlevel_incorrect} G @@ -863,78 +863,78 @@ G context "bundle exec" do before do ENV["BUNDLER_FORCE_TTY"] = "true" - system_gems "rack-1.0.0", "rack-0.9.1", path: default_bundle_path + system_gems "myrack-1.0.0", "myrack-0.9.1", path: default_bundle_path end it "activates the correct gem when ruby version matches" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" #{ruby_version_correct} G - bundle "exec rackup" + bundle "exec myrackup" expect(out).to include("0.9.1") end it "activates the correct gem when ruby version matches any engine", :jruby_only do - system_gems "rack-1.0.0", "rack-0.9.1", path: default_bundle_path + system_gems "myrack-1.0.0", "myrack-0.9.1", path: default_bundle_path gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" #{ruby_version_correct_engineless} G - bundle "exec rackup" + bundle "exec myrackup" expect(out).to include("0.9.1") end it "fails when the ruby version doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" #{ruby_version_incorrect} G - bundle "exec rackup", raise_on_error: false + bundle "exec myrackup", raise_on_error: false should_be_ruby_version_incorrect end it "fails when the engine doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" #{engine_incorrect} G - bundle "exec rackup", raise_on_error: false + bundle "exec myrackup", raise_on_error: false should_be_engine_incorrect end # it "fails when the engine version doesn't match", :jruby_only do # gemfile <<-G - # gem "rack", "0.9.1" + # gem "myrack", "0.9.1" # # #{engine_version_incorrect} # G # - # bundle "exec rackup" + # bundle "exec myrackup" # should_be_engine_version_incorrect # end it "fails when patchlevel doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" #{patchlevel_incorrect} G - bundle "exec rackup", raise_on_error: false + bundle "exec myrackup", raise_on_error: false should_be_patchlevel_incorrect end end @@ -942,25 +942,25 @@ G context "bundle console", bundler: "< 3" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development G end it "starts IRB with the default group loaded when ruby version matches", :readline do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development #{ruby_version_correct} G bundle "console" do |input, _, _| - input.puts("puts RACK") + input.puts("puts MYRACK") input.puts("exit") end expect(out).to include("0.9.1") @@ -968,16 +968,16 @@ G it "starts IRB with the default group loaded when ruby version matches", :readline, :jruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development #{ruby_version_correct_engineless} G bundle "console" do |input, _, _| - input.puts("puts RACK") + input.puts("puts MYRACK") input.puts("exit") end expect(out).to include("0.9.1") @@ -985,10 +985,10 @@ G it "fails when ruby version doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development #{ruby_version_incorrect} G @@ -999,10 +999,10 @@ G it "fails when engine doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development #{engine_incorrect} G @@ -1013,10 +1013,10 @@ G it "fails when engine version doesn't match", :jruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development #{engine_version_incorrect} G @@ -1027,10 +1027,10 @@ G it "fails when patchlevel doesn't match" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + gem "myrack_middleware", :group => :development #{patchlevel_incorrect} G @@ -1043,9 +1043,9 @@ G context "Bundler.setup" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack", :group => :test + gem "myrack", :group => :test G ENV["BUNDLER_FORCE_TTY"] = "true" @@ -1053,9 +1053,9 @@ G it "makes a Gemfile.lock if setup succeeds" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack" + gem "myrack" #{ruby_version_correct} G @@ -1068,9 +1068,9 @@ G it "makes a Gemfile.lock if setup succeeds for any engine", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack" + gem "myrack" #{ruby_version_correct_engineless} G @@ -1083,9 +1083,9 @@ G it "fails when ruby version doesn't match" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack" + gem "myrack" #{ruby_version_incorrect} G @@ -1100,9 +1100,9 @@ G it "fails when engine doesn't match" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack" + gem "myrack" #{engine_incorrect} G @@ -1117,9 +1117,9 @@ G it "fails when engine version doesn't match", :jruby_only do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack" + gem "myrack" #{engine_version_incorrect} G @@ -1134,9 +1134,9 @@ G it "fails when patchlevel doesn't match" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack" + gem "myrack" #{patchlevel_incorrect} G @@ -1157,7 +1157,7 @@ G end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path("foo")}" G @@ -1170,7 +1170,7 @@ G end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path("foo")}" @@ -1196,7 +1196,7 @@ G end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path("foo")}" @@ -1221,7 +1221,7 @@ G end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path("foo")}" @@ -1239,7 +1239,7 @@ G end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path("foo")}" @@ -1257,7 +1257,7 @@ G end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path("foo")}" @@ -1275,7 +1275,7 @@ G end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path("foo")}" @@ -1293,7 +1293,7 @@ G end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path("foo")}" diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb index 3c7fd3486d..8671504b25 100644 --- a/spec/bundler/commands/post_bundle_message_spec.rb +++ b/spec/bundler/commands/post_bundle_message_spec.rb @@ -3,13 +3,13 @@ RSpec.describe "post bundle message" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", "2.3.5", :group => [:emo, :test] group :test do gem "rspec" end - gem "rack-obama", :group => :obama + gem "myrack-obama", :group => :obama G end @@ -115,25 +115,25 @@ RSpec.describe "post bundle message" do it "should report a helpful error message" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "not-a-gem", :group => :development G expect(err).to include <<-EOS.strip -Could not find gem 'not-a-gem' in rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally. +Could not find gem 'not-a-gem' in rubygems repository https://gem.repo1/ or installed locally. EOS end it "should report a helpful error message with reference to cache if available" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "not-a-gem", :group => :development G expect(err).to include("Could not find gem 'not-a-gem' in"). diff --git a/spec/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb index 1aec37f850..547aa12b6c 100644 --- a/spec/bundler/commands/pristine_spec.rb +++ b/spec/bundler/commands/pristine_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "bundle pristine" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "weakling" gem "very_simple_binary" gem "foo", :git => "#{lib_path("foo")}", :branch => "main" diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb index 23ce7dde47..d2d7d1b6a8 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle remove" do context "when no gems are specified" do it "throws error" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G bundle "remove", raise_on_error: false @@ -16,29 +16,29 @@ RSpec.describe "bundle remove" do context "after 'bundle install' is run" do describe "running 'bundle remove GEM_NAME'" do it "removes it from the lockfile" do - rack_dep = <<~L + myrack_dep = <<~L DEPENDENCIES - rack + myrack L gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G bundle "install" - expect(lockfile).to include(rack_dep) + expect(lockfile).to include(myrack_dep) - bundle "remove rack" + bundle "remove myrack" expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G - expect(lockfile).to_not include(rack_dep) + expect(lockfile).to_not include(myrack_dep) end end end @@ -46,15 +46,15 @@ RSpec.describe "bundle remove" do context "when --install flag is specified", bundler: "< 3" do it "removes gems from .bundle" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G - bundle "remove rack --install" + bundle "remove myrack --install" - expect(out).to include("rack was removed.") - expect(the_bundle).to_not include_gems "rack" + expect(out).to include("myrack was removed.") + expect(the_bundle).to_not include_gems "myrack" end end @@ -62,39 +62,39 @@ RSpec.describe "bundle remove" do context "when gem is present in gemfile" do it "shows success for removed gem" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") - expect(the_bundle).to_not include_gems "rack" + expect(out).to include("myrack was removed.") + expect(the_bundle).to_not include_gems "myrack" expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end context "when gem is specified in multiple lines" do it "shows success for removed gem" do - build_git "rack" + build_git "myrack" gemfile <<-G - source '#{file_uri_for(gem_repo1)}' + source 'https://gem.repo1' gem 'git' - gem 'rack', - git: "#{lib_path("rack-1.0")}", + gem 'myrack', + git: "#{lib_path("myrack-1.0")}", branch: 'main' gem 'nokogiri' G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(gemfile).to eq <<~G - source '#{file_uri_for(gem_repo1)}' + source 'https://gem.repo1' gem 'git' gem 'nokogiri' @@ -106,12 +106,12 @@ RSpec.describe "bundle remove" do context "when gem is not present in gemfile" do it "shows warning for gem that could not be removed" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G - bundle "remove rack", raise_on_error: false + bundle "remove myrack", raise_on_error: false - expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") + expect(err).to include("`myrack` is not specified in #{bundled_app_gemfile} so it could not be removed.") end end end @@ -120,18 +120,18 @@ RSpec.describe "bundle remove" do context "when all gems are present in gemfile" do it "shows success fir all removed gems" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" gem "rails" G - bundle "remove rack rails" + bundle "remove myrack rails" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(out).to include("rails was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -139,18 +139,18 @@ RSpec.describe "bundle remove" do context "when some gems are not present in the gemfile" do it "shows warning for those not present and success for those that can be removed" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" gem "minitest" gem "rspec" G - bundle "remove rails rack minitest", raise_on_error: false + bundle "remove rails myrack minitest", raise_on_error: false - expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") + expect(err).to include("`myrack` is not specified in #{bundled_app_gemfile} so it could not be removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" gem "minitest" @@ -163,16 +163,16 @@ RSpec.describe "bundle remove" do context "with inline groups" do it "removes the specified gem" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", :group => [:dev] + gem "myrack", :group => [:dev] G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -181,7 +181,7 @@ RSpec.describe "bundle remove" do context "when single group block with gem to be removed is present" do it "removes the group block" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do gem "rspec" @@ -192,7 +192,7 @@ RSpec.describe "bundle remove" do expect(out).to include("rspec was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -200,19 +200,19 @@ RSpec.describe "bundle remove" do context "when gem to be removed is outside block" do it "does not modify group" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" group :test do gem "coffee-script-source" end G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do gem "coffee-script-source" @@ -224,7 +224,7 @@ RSpec.describe "bundle remove" do context "when an empty block is also present" do it "removes all empty blocks" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do gem "rspec" @@ -238,7 +238,7 @@ RSpec.describe "bundle remove" do expect(out).to include("rspec was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -246,7 +246,7 @@ RSpec.describe "bundle remove" do context "when the gem belongs to multiple groups" do it "removes the groups" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test, :serioustest do gem "rspec" @@ -257,7 +257,7 @@ RSpec.describe "bundle remove" do expect(out).to include("rspec was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -265,7 +265,7 @@ RSpec.describe "bundle remove" do context "when the gem is present in multiple groups" do it "removes all empty blocks" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :one do gem "rspec" @@ -280,7 +280,7 @@ RSpec.describe "bundle remove" do expect(out).to include("rspec was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -290,7 +290,7 @@ RSpec.describe "bundle remove" do context "when all the groups will be empty after removal" do it "removes the empty nested blocks" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do group :serioustest do @@ -303,7 +303,7 @@ RSpec.describe "bundle remove" do expect(out).to include("rspec was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -311,10 +311,10 @@ RSpec.describe "bundle remove" do context "when outer group will not be empty after removal" do it "removes only empty blocks" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do - gem "rack-test" + gem "myrack-test" group :serioustest do gem "rspec" @@ -326,10 +326,10 @@ RSpec.describe "bundle remove" do expect(out).to include("rspec was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do - gem "rack-test" + gem "myrack-test" end G @@ -339,12 +339,12 @@ RSpec.describe "bundle remove" do context "when inner group will not be empty after removal" do it "removes only empty blocks" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do group :serioustest do gem "rspec" - gem "rack-test" + gem "myrack-test" end end G @@ -353,11 +353,11 @@ RSpec.describe "bundle remove" do expect(out).to include("rspec was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do group :serioustest do - gem "rack-test" + gem "myrack-test" end end G @@ -369,16 +369,16 @@ RSpec.describe "bundle remove" do context "when multiple gems are present in same line" do it "shows warning for gems not removed" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack"; gem "rails" + source "https://gem.repo1" + gem "myrack"; gem "rails" G bundle "remove rails", raise_on_error: false - expect(err).to include("Gems could not be removed. rack (>= 0) would also have been removed.") + expect(err).to include("Gems could not be removed. myrack (>= 0) would also have been removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" - gem "rack"; gem "rails" + source "https://gem.repo1" + gem "myrack"; gem "rails" G end end @@ -386,21 +386,21 @@ RSpec.describe "bundle remove" do context "when some gems could not be removed" do it "shows warning for gems not removed and success for those removed" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem"rack" + source "https://gem.repo1" + gem"myrack" gem"rspec" gem "rails" gem "minitest" G - bundle "remove rails rack rspec minitest" + bundle "remove rails myrack rspec minitest" expect(out).to include("rails was removed.") expect(out).to include("minitest was removed.") - expect(out).to include("rack, rspec could not be removed.") + expect(out).to include("myrack, rspec could not be removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" - gem"rack" + source "https://gem.repo1" + gem"myrack" gem"rspec" G end @@ -416,11 +416,11 @@ RSpec.describe "bundle remove" do it "removes gems and empty source blocks" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" - source "#{file_uri_for(gem_repo3)}" do + source "https://gem.repo3" do gem "rspec" end G @@ -431,9 +431,9 @@ RSpec.describe "bundle remove" do expect(out).to include("rspec was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G end end @@ -441,40 +441,40 @@ RSpec.describe "bundle remove" do describe "with eval_gemfile" do context "when gems are present in both gemfiles" do it "removes the gems" do - create_file "Gemfile-other", <<-G - gem "rack" + gemfile "Gemfile-other", <<-G + gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" - gem "rack" + gem "myrack" G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") end end context "when gems are present in other gemfile" do it "removes the gems" do - create_file "Gemfile-other", <<-G - gem "rack" + gemfile "Gemfile-other", <<-G + gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" G - bundle "remove rack" + bundle "remove myrack" - expect(bundled_app("Gemfile-other").read).to_not include("gem \"rack\"") - expect(out).to include("rack was removed.") + expect(bundled_app("Gemfile-other").read).to_not include("gem \"myrack\"") + expect(out).to include("myrack was removed.") end end @@ -486,36 +486,36 @@ RSpec.describe "bundle remove" do G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" G - bundle "remove rack", raise_on_error: false + bundle "remove myrack", raise_on_error: false - expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") + expect(err).to include("`myrack` is not specified in #{bundled_app_gemfile} so it could not be removed.") end end context "when the gem is present in parent file but not in gemfile specified by eval_gemfile" do it "removes the gem" do - create_file "Gemfile-other", <<-G + gemfile "Gemfile-other", <<-G gem "rails" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" - gem "rack" + gem "myrack" G - bundle "remove rack", raise_on_error: false + bundle "remove myrack", raise_on_error: false - expect(out).to include("rack was removed.") - expect(err).to include("`rack` is not specified in #{bundled_app("Gemfile-other")} so it could not be removed.") + expect(out).to include("myrack was removed.") + expect(err).to include("`myrack` is not specified in #{bundled_app("Gemfile-other")} so it could not be removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" G @@ -524,23 +524,23 @@ RSpec.describe "bundle remove" do context "when gems cannot be removed from other gemfile" do it "shows error" do - create_file "Gemfile-other", <<-G - gem "rails"; gem "rack" + gemfile "Gemfile-other", <<-G + gem "rails"; gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" - gem "rack" + gem "myrack" G - bundle "remove rack", raise_on_error: false + bundle "remove myrack", raise_on_error: false - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(err).to include("Gems could not be removed. rails (>= 0) would also have been removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" G @@ -549,47 +549,47 @@ RSpec.describe "bundle remove" do context "when gems could not be removed from parent gemfile" do it "shows error" do - create_file "Gemfile-other", <<-G - gem "rack" + gemfile "Gemfile-other", <<-G + gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" - gem "rails"; gem "rack" + gem "rails"; gem "myrack" G - bundle "remove rack", raise_on_error: false + bundle "remove myrack", raise_on_error: false expect(err).to include("Gems could not be removed. rails (>= 0) would also have been removed.") - expect(bundled_app("Gemfile-other").read).to include("gem \"rack\"") + expect(bundled_app("Gemfile-other").read).to include("gem \"myrack\"") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" - gem "rails"; gem "rack" + gem "rails"; gem "myrack" G end end context "when gem present in gemfiles but could not be removed from one from one of them" do it "removes gem which can be removed and shows warning for file from which it cannot be removed" do - create_file "Gemfile-other", <<-G - gem "rack" + gemfile "Gemfile-other", <<-G + gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "Gemfile-other" - gem"rack" + gem"myrack" G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") - expect(bundled_app("Gemfile-other").read).to_not include("gem \"rack\"") + expect(out).to include("myrack was removed.") + expect(bundled_app("Gemfile-other").read).to_not include("gem \"myrack\"") end end end @@ -597,18 +597,18 @@ RSpec.describe "bundle remove" do context "with install_if" do it "removes gems inside blocks and empty blocks" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" install_if(lambda { false }) do - gem "rack" + gem "myrack" end G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -616,18 +616,18 @@ RSpec.describe "bundle remove" do context "with env" do it "removes gems inside blocks and empty blocks" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" env "BUNDLER_TEST" do - gem "rack" + gem "myrack" end G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -636,11 +636,11 @@ RSpec.describe "bundle remove" do it "should not remove the gem" do build_lib("foo", path: tmp("foo")) do |s| s.write("foo.gemspec", "") - s.add_dependency "rack" + s.add_dependency "myrack" end install_gemfile(<<-G) - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => '#{tmp("foo")}', :name => 'foo' G @@ -654,19 +654,19 @@ RSpec.describe "bundle remove" do context "when comment is a separate line comment" do it "does not remove the line comment" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - # gem "rack" might be used in the future - gem "rack" + # gem "myrack" might be used in the future + gem "myrack" G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - # gem "rack" might be used in the future + # gem "myrack" might be used in the future G end end @@ -674,16 +674,16 @@ RSpec.describe "bundle remove" do context "when gem specified for removal has an inline comment" do it "removes the inline comment" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" # this can be removed + gem "myrack" # this can be removed G - bundle "remove rack" + bundle "remove myrack" - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end end @@ -691,19 +691,19 @@ RSpec.describe "bundle remove" do context "when gem specified for removal is mentioned in other gem's comment" do it "does not remove other gem" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "puma" # implements interface provided by gem "rack" + source "https://gem.repo1" + gem "puma" # implements interface provided by gem "myrack" - gem "rack" + gem "myrack" G - bundle "remove rack" + bundle "remove myrack" expect(out).to_not include("puma was removed.") - expect(out).to include("rack was removed.") + expect(out).to include("myrack was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" - gem "puma" # implements interface provided by gem "rack" + source "https://gem.repo1" + gem "puma" # implements interface provided by gem "myrack" G end end @@ -711,20 +711,20 @@ RSpec.describe "bundle remove" do context "when gem specified for removal has a comment that mentions other gem" do it "does not remove other gem" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "puma" # implements interface provided by gem "rack" + source "https://gem.repo1" + gem "puma" # implements interface provided by gem "myrack" - gem "rack" + gem "myrack" G bundle "remove puma" expect(out).to include("puma was removed.") - expect(out).to_not include("rack was removed.") + expect(out).to_not include("myrack was removed.") expect(gemfile).to eq <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G end end diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb index 4f02818cef..7f32d0563b 100644 --- a/spec/bundler/commands/show_spec.rb +++ b/spec/bundler/commands/show_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle show", bundler: "< 3" do context "with a standard Gemfile" do before :each do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G end @@ -155,7 +155,7 @@ RSpec.describe "bundle show", bundler: "< 3" do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo" G @@ -167,20 +167,20 @@ RSpec.describe "bundle show", bundler: "< 3" do context "with a valid regexp for gem name" do it "presents alternatives", :readline do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G bundle "show rac" - expect(out).to match(/\A1 : rack\n2 : rack-obama\n0 : - exit -(\n>|\z)/) + expect(out).to match(/\A1 : myrack\n2 : myrack-obama\n0 : - exit -(\n>|\z)/) end end context "with an invalid regexp for gem name" do it "does not find the gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -199,7 +199,7 @@ RSpec.describe "bundle show", bundler: "< 3" do it "doesn't update gems to newer versions" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails" G diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index d5d38b81f1..c1874c3bc8 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -6,17 +6,17 @@ RSpec.describe "bundle update" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" gem "platform_specific" G end it "updates the entire bundle" do update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "activesupport", "3.0" @@ -24,14 +24,14 @@ RSpec.describe "bundle update" do bundle "update" expect(out).to include("Bundle updated!") - expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" + expect(the_bundle).to include_gems "myrack 1.2", "myrack-obama 1.0", "activesupport 3.0" end it "doesn't delete the Gemfile.lock file if something goes wrong" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" exit! G bundle "update", raise_on_error: false @@ -44,17 +44,17 @@ RSpec.describe "bundle update" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" gem "platform_specific" G end it "updates the entire bundle" do update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "activesupport", "3.0" @@ -62,16 +62,16 @@ RSpec.describe "bundle update" do bundle "update", all: true expect(out).to include("Bundle updated!") - expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" + expect(the_bundle).to include_gems "myrack 1.2", "myrack-obama 1.0", "activesupport 3.0" end it "doesn't delete the Gemfile.lock file if something goes wrong" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" exit! G bundle "update", all: true, raise_on_error: false @@ -82,8 +82,8 @@ RSpec.describe "bundle update" do describe "with --gemfile" do it "creates lock files based on the Gemfile name" do gemfile bundled_app("OmgFile"), <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0" + source "https://gem.repo1" + gem "myrack", "1.0" G bundle "update --gemfile OmgFile", all: true @@ -96,19 +96,19 @@ RSpec.describe "bundle update" do before { bundle "config set update_requires_all_flag true" } it "errors when passed nothing" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" bundle :update, raise_on_error: false expect(err).to eq("To update everything, pass the `--all` flag.") end it "errors when passed --all and another option" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" bundle "update --all foo", raise_on_error: false expect(err).to eq("Cannot specify --all along with specific options.") end it "updates everything when passed --all" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" bundle "update --all" expect(out).to include("Bundle updated!") end @@ -119,9 +119,9 @@ RSpec.describe "bundle update" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" gem "platform_specific" G end @@ -137,24 +137,24 @@ RSpec.describe "bundle update" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" gem "platform_specific" G end it "unlocks all child dependencies that are unrelated to other locked dependencies" do update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "activesupport", "3.0" end - bundle "update rack-obama" - expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 2.3.5" + bundle "update myrack-obama" + expect(the_bundle).to include_gems "myrack 1.2", "myrack-obama 1.0", "activesupport 2.3.5" end end @@ -163,9 +163,9 @@ RSpec.describe "bundle update" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" gem "platform_specific" G end @@ -185,22 +185,22 @@ RSpec.describe "bundle update" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" gem "platform_specific" G end it "should update the child dependency" do update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end end - bundle "update rack" - expect(the_bundle).to include_gems "rack 1.2" + bundle "update myrack" + expect(the_bundle).to include_gems "myrack 1.2" end end @@ -223,7 +223,7 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "slim-rails" gem "slim_lint" G @@ -269,7 +269,7 @@ RSpec.describe "bundle update" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "country_select" gem "countries" @@ -282,7 +282,7 @@ RSpec.describe "bundle update" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: countries (3.1.0) country_select (5.1.0) @@ -331,7 +331,7 @@ RSpec.describe "bundle update" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "oauth2" gem "quickbooks-ruby" @@ -339,7 +339,7 @@ RSpec.describe "bundle update" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: faraday (2.5.2) multi_json (1.15.0) @@ -390,7 +390,7 @@ RSpec.describe "bundle update" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec @@ -404,7 +404,7 @@ RSpec.describe "bundle update" do specs: GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: rake (13.0.6) sneakers (2.11.0) @@ -440,7 +440,7 @@ RSpec.describe "bundle update" do end install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "a" G @@ -464,7 +464,7 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "a" gem "b" G @@ -472,7 +472,7 @@ RSpec.describe "bundle update" do expect(the_bundle).to include_gems("a 1.0", "b 2.0") gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "a" gem "b", "1.0" G @@ -497,14 +497,14 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "activesupport", "~> 6.1.0" G expect(the_bundle).to include_gems("activesupport 6.1.4.1", "tzinfo 2.0.4") gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "activesupport", "~> 6.0.0" G @@ -517,7 +517,7 @@ RSpec.describe "bundle update" do expected_lockfile = <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: activesupport (6.0.4.1) tzinfo (~> 1.1) @@ -558,21 +558,21 @@ RSpec.describe "bundle update" do build_repo2 gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" gem "platform_specific" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: activesupport (2.3.5) platform_specific (1.0-#{local_platform}) - rack (1.0.0) - rack-obama (1.0) - rack + myrack (1.0.0) + myrack-obama (1.0) + myrack PLATFORMS #{local_platform} @@ -580,7 +580,7 @@ RSpec.describe "bundle update" do DEPENDENCIES activesupport platform_specific - rack-obama + myrack-obama BUNDLED WITH #{Bundler::VERSION} @@ -604,26 +604,26 @@ RSpec.describe "bundle update" do it "should update only specified group gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", :group => :development - gem "rack" + gem "myrack" G update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "activesupport", "3.0" end bundle "update --group development" expect(the_bundle).to include_gems "activesupport 3.0" - expect(the_bundle).not_to include_gems "rack 1.2" + expect(the_bundle).not_to include_gems "myrack 1.2" end context "when conservatively updating a group with non-group sub-deps" do it "should update only specified group gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activemerchant", :group => :development gem "activesupport" G @@ -641,7 +641,7 @@ RSpec.describe "bundle update" do before do build_git "foo", path: lib_path("activesupport") install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport", :group => :development gem "foo", :git => "#{lib_path("activesupport")}" G @@ -660,13 +660,13 @@ RSpec.describe "bundle update" do context "when bundler itself is a transitive dependency" do it "executes without error" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport", :group => :development - gem "rack" + gem "myrack" G update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "activesupport", "3.0" @@ -674,7 +674,7 @@ RSpec.describe "bundle update" do bundle "update --group development" expect(the_bundle).to include_gems "activesupport 2.3.5" expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}" - expect(the_bundle).not_to include_gems "rack 1.2" + expect(the_bundle).not_to include_gems "myrack 1.2" end end end @@ -684,9 +684,9 @@ RSpec.describe "bundle update" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" - gem "rack-obama" + gem "myrack-obama" gem "platform_specific" G end @@ -728,7 +728,7 @@ RSpec.describe "bundle update" do it "should not update gems not included in the source that happen to have the same name" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" G update_repo2 { build_gem "activesupport", "3.0" } @@ -739,7 +739,7 @@ RSpec.describe "bundle update" do it "should not update gems not included in the source that happen to have the same name" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" G update_repo2 { build_gem "activesupport", "3.0" } @@ -759,7 +759,7 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "harry" gem "fred" G @@ -791,7 +791,7 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "harry" gem "fred" G @@ -814,7 +814,7 @@ RSpec.describe "bundle update" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" G @@ -836,7 +836,7 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "bar" gem "foo" G @@ -854,7 +854,7 @@ RSpec.describe "bundle update" do it "shows error message when Gemfile.lock is not preset and gem is specified" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activesupport" G @@ -866,10 +866,10 @@ RSpec.describe "bundle update" do context "with multiple sources and caching enabled" do before do build_repo2 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" build_gem "request_store", "1.0.0" do |s| - s.add_dependency "rack", "1.0.0" + s.add_dependency "myrack", "1.0.0" end end @@ -878,24 +878,24 @@ RSpec.describe "bundle update" do end gemfile <<~G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "request_store" - source "#{file_uri_for(gem_repo4)}" do + source "https://gem.repo4" do end G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) request_store (1.0.0) - rack (= 1.0.0) + myrack (= 1.0.0) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: PLATFORMS @@ -915,7 +915,7 @@ RSpec.describe "bundle update" do update_repo2 do build_gem "request_store", "1.1.0" do |s| - s.add_dependency "rack", "1.0.0" + s.add_dependency "myrack", "1.0.0" end end @@ -925,14 +925,14 @@ RSpec.describe "bundle update" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) request_store (1.1.0) - rack (= 1.0.0) + myrack (= 1.0.0) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: PLATFORMS @@ -1017,49 +1017,49 @@ RSpec.describe "bundle update in more complicated situations" do it "will eagerly unlock dependencies of a specified gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "thin" - gem "rack-obama" + gem "myrack-obama" G update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "thin", "2.0" do |s| - s.add_dependency "rack" + s.add_dependency "myrack" end end bundle "update thin" - expect(the_bundle).to include_gems "thin 2.0", "rack 1.2", "rack-obama 1.0" + expect(the_bundle).to include_gems "thin 2.0", "myrack 1.2", "myrack-obama 1.0" end it "will warn when some explicitly updated gems are not updated" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "thin" - gem "rack-obama" + gem "myrack-obama" G update_repo2 do - build_gem("thin", "2.0") {|s| s.add_dependency "rack" } - build_gem "rack", "10.0" + build_gem("thin", "2.0") {|s| s.add_dependency "myrack" } + build_gem "myrack", "10.0" end - bundle "update thin rack-obama" - expect(last_command.stdboth).to include "Bundler attempted to update rack-obama but its version stayed the same" - expect(the_bundle).to include_gems "thin 2.0", "rack 10.0", "rack-obama 1.0" + bundle "update thin myrack-obama" + expect(last_command.stdboth).to include "Bundler attempted to update myrack-obama but its version stayed the same" + expect(the_bundle).to include_gems "thin 2.0", "myrack 10.0", "myrack-obama 1.0" end it "will not warn when an explicitly updated git gem changes sha but not version" do build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => '#{lib_path("foo-1.0")}' G @@ -1073,28 +1073,28 @@ RSpec.describe "bundle update in more complicated situations" do end it "will not warn when changing gem sources but not versions" do - build_git "rack" + build_git "myrack" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack", :git => '#{lib_path("rack-1.0")}' + source "https://gem.repo2" + gem "myrack", :git => '#{lib_path("myrack-1.0")}' G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "update rack" + bundle "update myrack" expect(last_command.stdboth).not_to include "attempted to update" end it "will update only from pinned source" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - source "#{file_uri_for(gem_repo1)}" do + source "https://gem.repo1" do gem "thin" end G @@ -1103,7 +1103,7 @@ RSpec.describe "bundle update in more complicated situations" do build_gem "thin", "2.0" end - bundle "update" + bundle "update", artifice: "compact_index" expect(the_bundle).to include_gems "thin 1.0" end @@ -1117,13 +1117,13 @@ RSpec.describe "bundle update in more complicated situations" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "a" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: a (0.9-java) @@ -1156,13 +1156,13 @@ RSpec.describe "bundle update in more complicated situations" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "a", platform: :jruby G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: a (0.9-java) @@ -1189,14 +1189,14 @@ RSpec.describe "bundle update without a Gemfile.lock" do build_repo2 gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - gem "rack", "1.0" + gem "myrack", "1.0" G bundle "update", all: true - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end @@ -1211,7 +1211,7 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0.1" G end @@ -1229,11 +1229,11 @@ RSpec.describe "bundle update --ruby" do before do install_gemfile <<-G ruby '~> #{Gem.ruby_version}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end @@ -1242,7 +1242,7 @@ RSpec.describe "bundle update --ruby" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1260,12 +1260,12 @@ RSpec.describe "bundle update --ruby" do before do install_gemfile <<-G ruby '~> #{Gem.ruby_version}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G gemfile <<-G ruby '~> #{current_ruby_minor}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end @@ -1274,7 +1274,7 @@ RSpec.describe "bundle update --ruby" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1295,12 +1295,12 @@ RSpec.describe "bundle update --ruby" do before do install_gemfile <<-G ruby '~> #{Gem.ruby_version}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G gemfile <<-G ruby '~> 2.1.0' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end it "shows a helpful error message" do @@ -1314,7 +1314,7 @@ RSpec.describe "bundle update --ruby" do before do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1333,7 +1333,7 @@ RSpec.describe "bundle update --ruby" do gemfile <<-G ruby '~> #{Gem.ruby_version}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G end @@ -1342,7 +1342,7 @@ RSpec.describe "bundle update --ruby" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1365,143 +1365,143 @@ end RSpec.describe "bundle update --bundler" do it "updates the bundler version in the lockfile" do build_repo4 do - build_gem "rack", "1.0" + build_gem "bundler", "2.5.9" + build_gem "myrack", "1.0" end checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo4, "rack", "1.0") + c.checksum(gem_repo4, "myrack", "1.0") end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" G expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (1.0) + myrack (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} L lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2') - bundle :update, bundler: true, artifice: "compact_index", verbose: true + bundle :update, bundler: true, verbose: true expect(out).to include("Using bundler #{Bundler::VERSION}") expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (1.0) + myrack (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} L - expect(the_bundle).to include_gem "rack 1.0" + expect(the_bundle).to include_gem "myrack 1.0" end it "updates the bundler version in the lockfile without re-resolving if the highest version is already installed" do - system_gems "bundler-2.3.9" - build_repo4 do - build_gem "rack", "1.0" + build_gem "bundler", "2.3.9" + build_gem "myrack", "1.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.9") checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo4, "rack", "1.0") + c.checksum(gem_repo4, "myrack", "1.0") end - bundle :update, bundler: true, artifice: "compact_index", verbose: true + bundle :update, bundler: true, verbose: true expect(out).to include("Using bundler #{Bundler::VERSION}") expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (1.0) + myrack (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} L - expect(the_bundle).to include_gem "rack 1.0" + expect(the_bundle).to include_gem "myrack 1.0" end it "updates the bundler version in the lockfile even if the latest version is not installed", :ruby_repo do - pristine_system_gems "bundler-2.3.9" + pristine_system_gems "bundler-2.99.9" build_repo4 do - build_gem "rack", "1.0" + build_gem "myrack", "1.0" build_bundler "999.0.0" end - install_gemfile <<-G, artifice: nil, env: { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } - source "#{file_uri_for(gem_repo4)}" - gem "rack" + install_gemfile <<-G + source "https://gem.repo4" + gem "myrack" G - lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.9") + lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.99.9") - bundle :update, bundler: true, artifice: "compact_index", verbose: true, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle :update, bundler: true, verbose: true, preserve_ruby_flags: true # Only updates properly on modern RubyGems. if Gem.rubygems_version >= Gem::Version.new("3.3.0.dev") expect(out).to include("Updating bundler to 999.0.0") - expect(out).to include("Using bundler 999.0.0") - expect(out).not_to include("Installing Bundler 2.3.9 and restarting using that version.") + expect(out).to include("Running `bundle update --bundler \"> 0.a\" --verbose` with bundler 999.0.0") + expect(out).not_to include("Installing Bundler 2.99.9 and restarting using that version.") expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (1.0) + myrack (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH 999.0.0 L expect(the_bundle).to include_gems "bundler 999.0.0" - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" else # Old RubyGems versions do not trampoline but they still change BUNDLED # WITH to the latest bundler version. This means the below check fails # because it tries to use bundler 999.0.0 which did not get installed. # Workaround the bug by forcing the version we know is installed. - expect(the_bundle).to include_gems "rack 1.0", env: { "BUNDLER_VERSION" => "2.3.9" } + expect(the_bundle).to include_gems "myrack 1.0", env: { "BUNDLER_VERSION" => "2.99.9" } end end @@ -1509,27 +1509,27 @@ RSpec.describe "bundle update --bundler" do pristine_system_gems "bundler-2.99.0" build_repo4 do - build_gem "rack", "3.0.9.1" + build_gem "myrack", "3.0.9.1" build_bundler "2.99.0" end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (3.0.9.1) + myrack (3.0.9.1) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH 2.99.0 @@ -1546,7 +1546,7 @@ RSpec.describe "bundle update --bundler" do pristine_system_gems "bundler-2.3.9" build_repo4 do - build_gem "rack", "1.0" + build_gem "myrack", "1.0" build_bundler "2.3.9" build_bundler "999.0.0" do |s| @@ -1555,8 +1555,8 @@ RSpec.describe "bundle update --bundler" do end install_gemfile <<-G, env: { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.9") @@ -1566,34 +1566,34 @@ RSpec.describe "bundle update --bundler" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (1.0) + myrack (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH 2.3.9 L expect(the_bundle).to include_gems "bundler 2.3.9" - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end it "errors if the explicit target version does not exist" do pristine_system_gems "bundler-2.3.9" build_repo4 do - build_gem "rack", "1.0" + build_gem "myrack", "1.0" end install_gemfile <<-G, env: { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.9") @@ -1611,12 +1611,12 @@ RSpec.describe "bundle update --bundler" do system_gems "bundler-2.3.0.dev" build_repo4 do - build_gem "rack", "1.0" + build_gem "myrack", "1.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" G bundle :update, bundler: "2.3.0.dev", verbose: "true" @@ -1624,20 +1624,20 @@ RSpec.describe "bundle update --bundler" do # Only updates properly on modern RubyGems. if Gem.rubygems_version >= Gem::Version.new("3.3.0.dev") checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo4, "rack", "1.0") + c.checksum(gem_repo4, "myrack", "1.0") end expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (1.0) + myrack (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH 2.3.0.dev @@ -1651,12 +1651,12 @@ RSpec.describe "bundle update --bundler" do system_gems "bundler-2.3.9" build_repo4 do - build_gem "rack", "1.0" + build_gem "myrack", "1.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" G bundle :update, bundler: "2.3.9", verbose: true @@ -1665,21 +1665,21 @@ RSpec.describe "bundle update --bundler" do # Only updates properly on modern RubyGems. checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo4, "rack", "1.0") + c.checksum(gem_repo4, "myrack", "1.0") end if Gem.rubygems_version >= Gem::Version.new("3.3.0.dev") expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: - rack (1.0) + myrack (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH 2.3.9 @@ -1693,12 +1693,12 @@ RSpec.describe "bundle update --bundler" do system_gems "bundler-2.3.9" gemfile <<~G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: PLATFORMS @@ -1738,7 +1738,7 @@ RSpec.describe "bundle update conservative" do # establish a lockfile set to 1.4.3 install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo', '1.4.3' gem 'bar', '2.0.3' gem 'qux', '1.0.0' @@ -1747,7 +1747,7 @@ RSpec.describe "bundle update conservative" do # remove 1.4.3 requirement and bar altogether # to setup update specs below gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'foo' gem 'qux' G @@ -1843,7 +1843,7 @@ RSpec.describe "bundle update conservative" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'isolated_owner' gem 'shared_owner_a' @@ -1852,7 +1852,7 @@ RSpec.describe "bundle update conservative" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: isolated_dep (2.0.1) isolated_owner (1.0.1) @@ -1905,9 +1905,17 @@ RSpec.describe "bundle update conservative" do it "should only change direct dependencies when updating the lockfile with --conservative" do bundle "lock --update --conservative" + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "isolated_dep", "2.0.1" + c.checksum gem_repo4, "isolated_owner", "1.0.2" + c.checksum gem_repo4, "shared_dep", "5.0.1" + c.checksum gem_repo4, "shared_owner_a", "3.0.2" + c.checksum gem_repo4, "shared_owner_b", "4.0.2" + end + expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: isolated_dep (2.0.1) isolated_owner (1.0.2) @@ -1925,14 +1933,7 @@ RSpec.describe "bundle update conservative" do isolated_owner shared_owner_a shared_owner_b - - CHECKSUMS - isolated_dep (2.0.1) - isolated_owner (1.0.2) - shared_dep (5.0.1) - shared_owner_a (3.0.2) - shared_owner_b (4.0.2) - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1940,7 +1941,7 @@ RSpec.describe "bundle update conservative" do it "should match bundle install conservative update behavior when not eagerly unlocking" do gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'isolated_owner', '1.0.2' gem 'shared_owner_a', '3.0.2' @@ -1968,14 +1969,14 @@ RSpec.describe "bundle update conservative" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri", ">=1.16.4" gem "prism", ">=0.25.0" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.16.4-arm64-darwin) nokogiri (1.16.4-x86_64-linux) @@ -2001,7 +2002,7 @@ RSpec.describe "bundle update conservative" do context "error handling" do before do - gemfile "source \"#{file_uri_for(gem_repo1)}\"" + gemfile "source 'https://gem.repo1'" end it "raises if too many flags are provided" do diff --git a/spec/bundler/commands/viz_spec.rb b/spec/bundler/commands/viz_spec.rb index f8b5f7836e..c26e3c81ed 100644 --- a/spec/bundler/commands/viz_spec.rb +++ b/spec/bundler/commands/viz_spec.rb @@ -7,9 +7,9 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld it "graphs gems from the Gemfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G bundle "viz" @@ -25,11 +25,11 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld node[ fontname = "Arial, Helvetica, SansSerif"]; edge[ fontname = "Arial, Helvetica, SansSerif" , fontsize = "12"]; default [style = "filled", fillcolor = "#B9B9D5", shape = "box3d", fontsize = "16", label = "default"]; - rack [style = "filled", fillcolor = "#B9B9D5", label = "rack"]; - default -> rack [constraint = "false"]; - "rack-obama" [style = "filled", fillcolor = "#B9B9D5", label = "rack-obama"]; - default -> "rack-obama" [constraint = "false"]; - "rack-obama" -> rack; + myrack [style = "filled", fillcolor = "#B9B9D5", label = "myrack"]; + default -> myrack [constraint = "false"]; + "myrack-obama" [style = "filled", fillcolor = "#B9B9D5", label = "myrack-obama"]; + default -> "myrack-obama" [constraint = "false"]; + "myrack-obama" -> myrack; } debugging bundle viz... DOT @@ -37,13 +37,13 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld it "graphs gems that are prereleases" do build_repo2 do - build_gem "rack", "1.3.pre" + build_gem "myrack", "1.3.pre" end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack", "= 1.3.pre" - gem "rack-obama" + source "https://gem.repo2" + gem "myrack", "= 1.3.pre" + gem "myrack-obama" G bundle "viz" @@ -59,11 +59,11 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld node[ fontname = "Arial, Helvetica, SansSerif"]; edge[ fontname = "Arial, Helvetica, SansSerif" , fontsize = "12"]; default [style = "filled", fillcolor = "#B9B9D5", shape = "box3d", fontsize = "16", label = "default"]; - rack [style = "filled", fillcolor = "#B9B9D5", label = "rack\\n1.3.pre"]; - default -> rack [constraint = "false"]; - "rack-obama" [style = "filled", fillcolor = "#B9B9D5", label = "rack-obama\\n1.0"]; - default -> "rack-obama" [constraint = "false"]; - "rack-obama" -> rack; + myrack [style = "filled", fillcolor = "#B9B9D5", label = "myrack\\n1.3.pre"]; + default -> myrack [constraint = "false"]; + "myrack-obama" [style = "filled", fillcolor = "#B9B9D5", label = "myrack-obama\\n1.0"]; + default -> "myrack-obama" [constraint = "false"]; + "myrack-obama" -> myrack; } debugging bundle viz... EOS @@ -82,9 +82,9 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld it "loads the correct ruby-graphviz gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G bundle "viz", format: "debug" @@ -97,11 +97,11 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld node[ fontname = "Arial, Helvetica, SansSerif"]; edge[ fontname = "Arial, Helvetica, SansSerif" , fontsize = "12"]; default [style = "filled", fillcolor = "#B9B9D5", shape = "box3d", fontsize = "16", label = "default"]; - rack [style = "filled", fillcolor = "#B9B9D5", label = "rack"]; - default -> rack [constraint = "false"]; - "rack-obama" [style = "filled", fillcolor = "#B9B9D5", label = "rack-obama"]; - default -> "rack-obama" [constraint = "false"]; - "rack-obama" -> rack; + myrack [style = "filled", fillcolor = "#B9B9D5", label = "myrack"]; + default -> myrack [constraint = "false"]; + "myrack-obama" [style = "filled", fillcolor = "#B9B9D5", label = "myrack-obama"]; + default -> "myrack-obama" [constraint = "false"]; + "myrack-obama" -> myrack; } debugging bundle viz... DOT @@ -111,7 +111,7 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld context "--without option" do it "one group" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" group :rails do @@ -125,11 +125,11 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld it "two groups" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" - group :rack do - gem "rack" + group :myrack do + gem "myrack" end group :rails do @@ -137,7 +137,7 @@ RSpec.describe "bundle viz", bundler: "< 3", if: Bundler.which("dot"), realworld end G - bundle "viz --without=rails:rack" + bundle "viz --without=rails:myrack" expect(out).to include("gem_graph.png") end end diff --git a/spec/bundler/install/allow_offline_install_spec.rb b/spec/bundler/install/allow_offline_install_spec.rb index 8da94718e0..2d313531e0 100644 --- a/spec/bundler/install/allow_offline_install_spec.rb +++ b/spec/bundler/install/allow_offline_install_spec.rb @@ -9,15 +9,15 @@ RSpec.describe "bundle install with :allow_offline_install" do it "still installs" do install_gemfile <<-G, artifice: "compact_index" source "http://testgemserver.local" - gem "rack-obama" + gem "myrack-obama" G - expect(the_bundle).to include_gem("rack 1.0") + expect(the_bundle).to include_gem("myrack 1.0") end it "still fails when the network is down" do install_gemfile <<-G, artifice: "fail", raise_on_error: false source "http://testgemserver.local" - gem "rack-obama" + gem "myrack-obama" G expect(err).to include("Could not reach host testgemserver.local.") expect(the_bundle).to_not be_locked @@ -26,26 +26,26 @@ RSpec.describe "bundle install with :allow_offline_install" do context "with cached data locally" do it "will install from the compact index" do - system_gems ["rack-1.0.0"], path: default_bundle_path + system_gems ["myrack-1.0.0"], path: default_bundle_path bundle "config set clean false" install_gemfile <<-G, artifice: "compact_index" source "http://testgemserver.local" - gem "rack-obama" - gem "rack", "< 1.0" + gem "myrack-obama" + gem "myrack", "< 1.0" G - expect(the_bundle).to include_gems("rack-obama 1.0", "rack 0.9.1") + expect(the_bundle).to include_gems("myrack-obama 1.0", "myrack 0.9.1") gemfile <<-G source "http://testgemserver.local" - gem "rack-obama" + gem "myrack-obama" G bundle :update, artifice: "fail", all: true expect(last_command.stdboth).to include "Using the cached data for the new index because of a network error" - expect(the_bundle).to include_gems("rack-obama 1.0", "rack 1.0.0") + expect(the_bundle).to include_gems("myrack-obama 1.0", "myrack 1.0.0") end def break_git_remote_ops! @@ -78,7 +78,7 @@ RSpec.describe "bundle install with :allow_offline_install" do git = build_git "a", "1.0.0", path: lib_path("a") update_git("a", path: git.path, branch: "new_branch") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "a", :git => #{git.path.to_s.dump} G @@ -88,7 +88,7 @@ RSpec.describe "bundle install with :allow_offline_install" do break_git_remote_ops! do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "a", :git => #{git.path.to_s.dump}, :branch => "new_branch" G end diff --git a/spec/bundler/install/binstubs_spec.rb b/spec/bundler/install/binstubs_spec.rb index 928ba80b15..00765ac6dd 100644 --- a/spec/bundler/install/binstubs_spec.rb +++ b/spec/bundler/install/binstubs_spec.rb @@ -6,14 +6,14 @@ RSpec.describe "bundle install" do expect(Pathname.new("/usr/bin")).not_to be_writable gemfile <<-G def Gem.bindir; "/usr/bin"; end - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G config "BUNDLE_SYSTEM_BINDIR" => system_gem_path("altbin").to_s bundle :install - expect(the_bundle).to include_gems "rack 1.0.0" - expect(system_gem_path("altbin/rackup")).to exist + expect(the_bundle).to include_gems "myrack 1.0.0" + expect(system_gem_path("altbin/myrackup")).to exist end end @@ -21,26 +21,26 @@ RSpec.describe "bundle install" do before do build_repo2 do build_gem "fake", "14" do |s| - s.executables = "rackup" + s.executables = "myrackup" end end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "fake" - gem "rack" + gem "myrack" G end it "warns about the situation" do - bundle "exec rackup" + bundle "exec myrackup" expect(last_command.stderr).to include( - "The `rackup` executable in the `fake` gem is being loaded, but it's also present in other gems (rack).\n" \ + "The `myrackup` executable in the `fake` gem is being loaded, but it's also present in other gems (myrack).\n" \ "If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \ "If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names." ).or include( - "The `rackup` executable in the `rack` gem is being loaded, but it's also present in other gems (fake).\n" \ + "The `myrackup` executable in the `myrack` gem is being loaded, but it's also present in other gems (fake).\n" \ "If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \ "If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names." ) diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb index 19911f1154..95edf7859d 100644 --- a/spec/bundler/install/bundler_spec.rb +++ b/spec/bundler/install/bundler_spec.rb @@ -14,7 +14,7 @@ RSpec.describe "bundle install" do it "are forced to the current bundler version" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0" G @@ -23,15 +23,15 @@ RSpec.describe "bundle install" do it "are forced to the current bundler version even if not already present" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}" end it "causes a conflict if explicitly requesting a different version of bundler" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0" gem "bundler", "0.9.1" G @@ -51,7 +51,7 @@ RSpec.describe "bundle install" do it "causes a conflict if explicitly requesting a non matching requirement on bundler" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0" gem "bundler", "~> 0.8" G @@ -74,7 +74,7 @@ RSpec.describe "bundle install" do it "causes a conflict if explicitly requesting a version of bundler that doesn't exist" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0" gem "bundler", "0.9.2" G @@ -99,16 +99,16 @@ RSpec.describe "bundle install" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "multiple_versioned_deps" G install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "multiple_versioned_deps" - gem "rack" + gem "myrack" G expect(the_bundle).to include_gems "multiple_versioned_deps 1.0.0" @@ -116,7 +116,7 @@ RSpec.describe "bundle install" do it "includes bundler in the bundle when it's a child dependency" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0" G @@ -126,8 +126,8 @@ RSpec.describe "bundle install" do it "allows gem 'bundler' when Bundler is not in the Gemfile or its dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" G run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError => e; puts e.backtrace; end" @@ -144,7 +144,7 @@ RSpec.describe "bundle install" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "activemerchant" gem "rails_pinned_to_old_activesupport" G @@ -172,7 +172,7 @@ RSpec.describe "bundle install" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails_pinned_to_old_activesupport" gem "activesupport", "2.3.5" G @@ -197,12 +197,12 @@ RSpec.describe "bundle install" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'rails', "2.3.2" G install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails_pinned_to_old_activesupport" G @@ -219,17 +219,17 @@ RSpec.describe "bundle install" do bundle "config set path.system true" install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'rails', "7.0.4" G install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'rails', "7.0.3" G install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'rails', "7.0.4" G @@ -243,7 +243,7 @@ RSpec.describe "bundle install" do system_gems "bundler-99999999.99.1" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0" G @@ -257,7 +257,7 @@ RSpec.describe "bundle install" do system_gems "bundler-99999999.99.1" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0" G diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index d89fdea6f1..23d2bd39ba 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -3,8 +3,8 @@ RSpec.describe "install in deployment or frozen mode" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end @@ -37,7 +37,7 @@ RSpec.describe "install in deployment or frozen mode" do it "doesn't mess up a subsequent `bundle install` after you try to deploy without a lock" do bundle "install --deployment", raise_on_error: false bundle :install - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end it "installs gems by default to vendor/bundle" do @@ -60,15 +60,15 @@ RSpec.describe "install in deployment or frozen mode" do it "explodes with the --deployment flag if you make a change and don't check in the lockfile" do bundle :lock gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G bundle "install --deployment", raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") - expect(err).to include("* rack-obama") + expect(err).to include("* myrack-obama") expect(err).not_to include("You have deleted from the Gemfile") expect(err).not_to include("You have changed in the Gemfile") end @@ -80,13 +80,13 @@ RSpec.describe "install in deployment or frozen mode" do bundle "config set --local deployment true" bundle "config set --local path vendor/bundle" bundle "install --gemfile #{tmp}/bundled_app/Gemfile", dir: tmp - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end it "works if you exclude a group with a git gem" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" group :test do gem "foo", :git => "#{lib_path("foo-1.0")}" end @@ -110,7 +110,7 @@ RSpec.describe "install in deployment or frozen mode" do build_lib "foo", path: lib_path("nested/foo") build_lib "bar", path: lib_path("nested/bar") gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", "1.0", :path => "#{lib_path("nested")}" gem "bar", :path => "#{lib_path("nested")}" G @@ -123,7 +123,7 @@ RSpec.describe "install in deployment or frozen mode" do it "works when path gems are specified twice" do build_lib "foo", path: lib_path("nested/foo") gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("nested/foo")}" gem "foo", :path => "#{lib_path("nested/foo")}" G @@ -137,7 +137,7 @@ RSpec.describe "install in deployment or frozen mode" do install_gemfile(<<-G, artifice: "endpoint_strict_basic_authentication", quiet: true) source "http://user:[email protected]/" - gem "rack-obama", ">= 1.0" + gem "myrack-obama", ">= 1.0" G bundle "config set --local deployment true" @@ -146,16 +146,16 @@ RSpec.describe "install in deployment or frozen mode" do it "works with sources given by a block" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - source "#{file_uri_for(gem_repo1)}" do - gem "rack" + source "https://gem.repo1" + source "https://gem.repo1" do + gem "myrack" end G bundle "config set --local deployment true" bundle :install - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end context "when replacing a host with the same host with credentials" do @@ -164,20 +164,20 @@ RSpec.describe "install in deployment or frozen mode" do bundle "install" gemfile <<-G source "http://user_name:[email protected]/" - gem "rack" + gem "myrack" G lockfile <<-G GEM remote: http://localgemserver.test/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{generic_local_platform} DEPENDENCIES - rack + myrack G bundle "config set --local deployment true" @@ -231,16 +231,16 @@ RSpec.describe "install in deployment or frozen mode" do it "explodes with the `deployment` setting if you make a change and don't check in the lockfile" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G bundle "config set --local deployment true" bundle :install, raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") - expect(err).to include("* rack-obama") + expect(err).to include("* myrack-obama") expect(err).not_to include("You have deleted from the Gemfile") expect(err).not_to include("You have changed in the Gemfile") end @@ -248,7 +248,7 @@ RSpec.describe "install in deployment or frozen mode" do it "works if a path gem is missing but is in a without group" do build_lib "path_gem" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" gem "path_gem", :path => "#{lib_path("path_gem-1.0")}", :group => :development G @@ -267,9 +267,9 @@ RSpec.describe "install in deployment or frozen mode" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - source "#{file_uri_for(gem_repo1)}" do + source "https://gem.repo1" do gem "rake", platform: :#{not_local_tag} end G @@ -315,7 +315,7 @@ RSpec.describe "install in deployment or frozen mode" do it "explodes if a path gem is missing" do build_lib "path_gem" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" gem "path_gem", :path => "#{lib_path("path_gem-1.0")}", :group => :development G @@ -330,32 +330,32 @@ RSpec.describe "install in deployment or frozen mode" do it "can have --frozen set via an environment variable" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G ENV["BUNDLE_FROZEN"] = "1" bundle "install", raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") - expect(err).to include("* rack-obama") + expect(err).to include("* myrack-obama") expect(err).not_to include("You have deleted from the Gemfile") expect(err).not_to include("You have changed in the Gemfile") end it "can have --deployment set via an environment variable" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G ENV["BUNDLE_DEPLOYMENT"] = "true" bundle "install", raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") - expect(err).to include("* rack-obama") + expect(err).to include("* myrack-obama") expect(err).not_to include("You have deleted from the Gemfile") expect(err).not_to include("You have changed in the Gemfile") end @@ -375,9 +375,9 @@ RSpec.describe "install in deployment or frozen mode" do it "can have --frozen set to false via an environment variable" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G ENV["BUNDLE_FROZEN"] = "false" @@ -385,12 +385,12 @@ RSpec.describe "install in deployment or frozen mode" do bundle "install" expect(out).not_to include("frozen mode") expect(out).not_to include("You have added to the Gemfile") - expect(out).not_to include("* rack-obama") + expect(out).not_to include("* myrack-obama") end it "explodes if you remove a gem and don't check in the lockfile" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" G @@ -398,34 +398,34 @@ RSpec.describe "install in deployment or frozen mode" do bundle :install, raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n") - expect(err).to include("You have deleted from the Gemfile:\n* rack") + expect(err).to include("You have deleted from the Gemfile:\n* myrack") expect(err).not_to include("You have changed in the Gemfile") end it "explodes if you add a source" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "git://hubz.com" + source "https://gem.repo1" + gem "myrack", :git => "git://hubz.com" G bundle "config set --local deployment true" bundle :install, raise_on_error: false expect(err).to include("frozen mode") expect(err).not_to include("You have added to the Gemfile") - expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `git://hubz.com`") + expect(err).to include("You have changed in the Gemfile:\n* myrack from `no specified source` to `git://hubz.com`") end it "explodes if you change a source" do - build_git "rack" + build_git "myrack" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-1.0")}" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-1.0")}" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "config set --local deployment true" @@ -433,29 +433,29 @@ RSpec.describe "install in deployment or frozen mode" do expect(err).to include("frozen mode") expect(err).not_to include("You have deleted from the Gemfile") expect(err).not_to include("You have added to the Gemfile") - expect(err).to include("You have changed in the Gemfile:\n* rack from `#{lib_path("rack-1.0")}` to `no specified source`") + expect(err).to include("You have changed in the Gemfile:\n* myrack from `#{lib_path("myrack-1.0")}` to `no specified source`") end it "explodes if you change a source" do - build_lib "foo", path: lib_path("rack/foo") - build_git "rack", path: lib_path("rack") + build_lib "foo", path: lib_path("myrack/foo") + build_git "myrack", path: lib_path("myrack") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack")}" - gem "foo", :git => "#{lib_path("rack")}" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack")}" + gem "foo", :git => "#{lib_path("myrack")}" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "foo", :git => "#{lib_path("rack")}" + source "https://gem.repo1" + gem "myrack" + gem "foo", :git => "#{lib_path("myrack")}" G bundle "config set --local deployment true" bundle :install, raise_on_error: false expect(err).to include("frozen mode") - expect(err).to include("You have changed in the Gemfile:\n* rack from `#{lib_path("rack")}` to `no specified source`") + expect(err).to include("You have changed in the Gemfile:\n* myrack from `#{lib_path("myrack")}` to `no specified source`") expect(err).not_to include("You have added to the Gemfile") expect(err).not_to include("You have deleted from the Gemfile") end @@ -466,21 +466,21 @@ RSpec.describe "install in deployment or frozen mode" do bundle "config set --local deployment true" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack", "1.0.0" + gem "myrack-obama" G - run "require 'rack'", raise_on_error: false + run "require 'myrack'", raise_on_error: false expect(err).to include <<~E.strip The dependencies in your gemfile changed, but the lockfile can't be updated because frozen mode is set (Bundler::ProductionError) You have added to the Gemfile: - * rack (= 1.0.0) - * rack-obama + * myrack (= 1.0.0) + * myrack-obama You have deleted from the Gemfile: - * rack + * myrack E end end @@ -489,7 +489,7 @@ RSpec.describe "install in deployment or frozen mode" do it "works fine after bundle package and bundle install --local" do build_lib "foo", path: lib_path("foo") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" G diff --git a/spec/bundler/install/failure_spec.rb b/spec/bundler/install/failure_spec.rb index f972a37bf6..2c2773e849 100644 --- a/spec/bundler/install/failure_spec.rb +++ b/spec/bundler/install/failure_spec.rb @@ -15,7 +15,7 @@ RSpec.describe "bundle install" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails" G expect(err).to start_with("Gem::Ext::BuildError: ERROR: Failed to build gem native extension.") @@ -40,7 +40,7 @@ In Gemfile: it "removes the downloaded .gem" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "a" G diff --git a/spec/bundler/install/gemfile/eval_gemfile_spec.rb b/spec/bundler/install/gemfile/eval_gemfile_spec.rb index 7d2f9d46f9..a507e52485 100644 --- a/spec/bundler/install/gemfile/eval_gemfile_spec.rb +++ b/spec/bundler/install/gemfile/eval_gemfile_spec.rb @@ -10,15 +10,15 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do context "eval-ed Gemfile points to an internal gemspec" do before do - create_file "Gemfile-other", <<-G - source "#{file_uri_for(gem_repo1)}" + gemfile "Gemfile-other", <<-G + source "https://gem.repo1" gemspec :path => 'gems/gunks' G end it "installs the gemspec specified gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile 'Gemfile-other' G expect(out).to include("Resolving dependencies") @@ -36,12 +36,12 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do build_gem "zip-zip", "0.3" end - create_file bundled_app("gems/Gemfile"), <<-G - source "#{file_uri_for(gem_repo2)}" + gemfile bundled_app("gems/Gemfile"), <<-G + source "https://gem.repo2" gemspec :path => "\#{__dir__}/gunks" - source "#{file_uri_for(gem_repo2)}" do + source "https://gem.repo2" do gem "zip-zip" end G @@ -49,7 +49,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do it "installs and finds gems correctly" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails" @@ -65,13 +65,13 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do context "eval-ed Gemfile has relative-path gems" do before do build_lib("a", path: bundled_app("gems/a")) - create_file bundled_app("nested/Gemfile-nested"), <<-G - source "#{file_uri_for(gem_repo1)}" + gemfile bundled_app("nested/Gemfile-nested"), <<-G + source "https://gem.repo1" gem "a", :path => "../gems/a" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile "nested/Gemfile-nested" G end @@ -95,7 +95,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do it "installs the gemspec specified gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" eval_gemfile 'other/Gemfile-other' gemspec :path => 'gems/gunks' G @@ -108,15 +108,15 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do context "eval-ed Gemfile references other gemfiles" do it "works with relative paths" do - create_file "other/Gemfile-other", "gem 'rack'" - create_file "other/Gemfile", "eval_gemfile 'Gemfile-other'" - create_file "Gemfile-alt", <<-G - source "#{file_uri_for(gem_repo1)}" + gemfile "other/Gemfile-other", "gem 'myrack'" + gemfile "other/Gemfile", "eval_gemfile 'Gemfile-other'" + gemfile "Gemfile-alt", <<-G + source "https://gem.repo1" eval_gemfile "other/Gemfile" G install_gemfile "eval_gemfile File.expand_path('Gemfile-alt')" - expect(the_bundle).to include_gem "rack 1.0.0" + expect(the_bundle).to include_gem "myrack 1.0.0" end end end diff --git a/spec/bundler/install/gemfile/force_ruby_platform_spec.rb b/spec/bundler/install/gemfile/force_ruby_platform_spec.rb index a29b79ad62..e715cc9303 100644 --- a/spec/bundler/install/gemfile/force_ruby_platform_spec.rb +++ b/spec/bundler/install/gemfile/force_ruby_platform_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do it "pulls the pure ruby variant of the given gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "platform_specific_forced", :force_ruby_platform => true gem "platform_specific" @@ -40,7 +40,7 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do it "still respects a global `force_ruby_platform` config" do install_gemfile <<-G, env: { "BUNDLE_FORCE_RUBY_PLATFORM" => "true" } - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "platform_specific_forced", :force_ruby_platform => true gem "platform_specific" @@ -69,7 +69,7 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do it "still pulls the ruby variant" do install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "depends_on_platform_specific" gem "platform_specific", :force_ruby_platform => true @@ -106,7 +106,7 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do it "ignores ruby variants for the transitive dependencies" do install_gemfile <<-G, env: { "DEBUG_RESOLVER" => "true" } - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "depends_on_platform_specific", :force_ruby_platform => true G @@ -118,7 +118,7 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do it "reinstalls the ruby variant when a platform specific variant is already installed, the lockile has only RUBY platform, and :force_ruby_platform is used in the Gemfile" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: platform_specific (1.0) @@ -135,7 +135,7 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do system_gems "platform_specific-1.0-#{Gem::Platform.local}", path: default_bundle_path install_gemfile <<-G, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, artifice: "compact_index" - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "platform_specific", :force_ruby_platform => true G diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb index 2932228a54..b8843de0d2 100644 --- a/spec/bundler/install/gemfile/gemspec_spec.rb +++ b/spec/bundler/install/gemfile/gemspec_spec.rb @@ -45,7 +45,7 @@ RSpec.describe "bundle install from an existing gemspec" do s.add_development_dependency "bar-dev", "=1.0.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec :path => '#{tmp("foo")}' G @@ -62,7 +62,7 @@ RSpec.describe "bundle install from an existing gemspec" do FileUtils.mv tmp("foo", "foo.gemspec"), tmp("foo", ".gemspec") install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec :path => '#{tmp("foo")}' G @@ -81,7 +81,7 @@ RSpec.describe "bundle install from an existing gemspec" do s.add_dependency "baz", ">= 1.0", "< 1.1" end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec :path => '#{tmp("foo")}' G @@ -92,7 +92,7 @@ RSpec.describe "bundle install from an existing gemspec" do build_lib("foo", path: tmp("foo"), gemspec: false) install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec :path => '#{tmp("foo")}' G expect(err).to match(/There are no gemspecs at #{tmp("foo")}/) @@ -104,7 +104,7 @@ RSpec.describe "bundle install from an existing gemspec" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec :path => '#{tmp("foo")}' G expect(err).to match(/There are multiple gemspecs at #{tmp("foo")}/) @@ -118,7 +118,7 @@ RSpec.describe "bundle install from an existing gemspec" do end install_gemfile(<<-G) - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec :path => '#{tmp("foo")}', :name => 'foo' G @@ -134,7 +134,7 @@ RSpec.describe "bundle install from an existing gemspec" do end install_gemfile(<<-G) - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec :path => '#{tmp("foo")}', :name => 'foo', :development_group => :dev G @@ -145,19 +145,19 @@ RSpec.describe "bundle install from an existing gemspec" do it "should match a lockfile even if the gemspec defines development dependencies" do build_lib("foo", path: tmp("foo")) do |s| - s.write("Gemfile", "source '#{file_uri_for(gem_repo1)}'\ngemspec") + s.write("Gemfile", "source 'https://gem.repo1'\ngemspec") s.add_dependency "actionpack", "=2.3.2" s.add_development_dependency "rake", rake_version end - bundle "install", dir: tmp("foo") + bundle "install", dir: tmp("foo"), artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } # This should really be able to rely on $stderr, but, it's not written # right, so we can't. In fact, this is a bug negation test, and so it'll # ghost pass in future, and will only catch a regression if the message # doesn't change. Exit codes should be used correctly (they can be more # than just 0 and 1). bundle "config set --local deployment true" - output = bundle("install", dir: tmp("foo")) + output = bundle("install", dir: tmp("foo"), artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s }) expect(output).not_to match(/You have added to the Gemfile/) expect(output).not_to match(/You have deleted from the Gemfile/) expect(output).not_to match(/the lockfile can't be updated because frozen mode is set/) @@ -165,11 +165,11 @@ RSpec.describe "bundle install from an existing gemspec" do it "should match a lockfile without needing to re-resolve" do build_lib("foo", path: tmp("foo")) do |s| - s.add_dependency "rack" + s.add_dependency "myrack" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => '#{tmp("foo")}' G @@ -183,12 +183,12 @@ RSpec.describe "bundle install from an existing gemspec" do simulate_platform java build_lib("foo", path: tmp("foo")) do |s| - s.add_dependency "rack" + s.add_dependency "myrack" s.add_development_dependency "thin" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => '#{tmp("foo")}' G @@ -231,16 +231,16 @@ RSpec.describe "bundle install from an existing gemspec" do # # issue was caused by rubygems having an unresolved gem during a require, # so emulate that - system_gems %w[rack-1.0.0 rack-0.9.1 rack-obama-1.0] + system_gems %w[myrack-1.0.0 myrack-0.9.1 myrack-obama-1.0] build_lib("foo", path: bundled_app) gemspec = bundled_app("foo.gemspec").read bundled_app("foo.gemspec").open("w") do |f| - f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack/obama' }" + f.write "#{gemspec.strip}.tap { gem 'myrack-obama'; require 'myrack/obama' }" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G @@ -258,7 +258,7 @@ RSpec.describe "bundle install from an existing gemspec" do build_gem "foo", "0.0.1", to_bundle: true install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "deps" gemspec :path => '#{tmp("foo")}', :name => 'foo' G @@ -279,7 +279,7 @@ RSpec.describe "bundle install from an existing gemspec" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "deps" gemspec :path => '#{tmp("foo")}', :name => 'foo' G @@ -294,7 +294,7 @@ RSpec.describe "bundle install from an existing gemspec" do build_lib "omg", "2.0", path: lib_path("omg") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => "#{lib_path("omg")}" G @@ -313,7 +313,7 @@ RSpec.describe "bundle install from an existing gemspec" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G @@ -335,23 +335,23 @@ RSpec.describe "bundle install from an existing gemspec" do before do # build the "parent" gem that depends on another gem in the same repo build_lib "source_conflict", path: bundled_app do |s| - s.add_dependency "rack_middleware" + s.add_dependency "myrack_middleware" end # build the "child" gem that is the same version as a released gem, but # has completely different and conflicting dependency requirements - build_lib "rack_middleware", "1.0", path: bundled_app("rack_middleware") do |s| - s.add_dependency "rack", "1.0" # anything other than 0.9.1 + build_lib "myrack_middleware", "1.0", path: bundled_app("myrack_middleware") do |s| + s.add_dependency "myrack", "1.0" # anything other than 0.9.1 end end it "should install the child gemspec's deps" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end @@ -360,7 +360,7 @@ RSpec.describe "bundle install from an existing gemspec" do before do build_lib("foo", path: tmp("foo")) do |s| - s.add_dependency "rack", "=1.0.0" + s.add_dependency "myrack", "=1.0.0" end gemfile <<-G @@ -377,12 +377,12 @@ RSpec.describe "bundle install from an existing gemspec" do remote: ../foo specs: foo (1.0) - rack (= 1.0.0) + myrack (= 1.0.0) GEM remote: #{source_uri} specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{generic_local_platform} @@ -400,7 +400,7 @@ RSpec.describe "bundle install from an existing gemspec" do create_file( tmp("foo", "foo-java.gemspec"), build_spec("foo", "1.0", "java") do - dep "rack", "=1.0.0" + dep "myrack", "=1.0.0" @spec.authors = "authors" @spec.summary = "summary" end.first.to_ruby @@ -409,15 +409,15 @@ RSpec.describe "bundle install from an existing gemspec" do it "should install" do results = bundle "install", artifice: "endpoint" - expect(results).to include("Installing rack 1.0.0") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(results).to include("Installing myrack 1.0.0") + expect(the_bundle).to include_gems "myrack 1.0.0" end end it "should install", :jruby do results = bundle "install", artifice: "endpoint" - expect(results).to include("Installing rack 1.0.0") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(results).to include("Installing myrack 1.0.0") + expect(the_bundle).to include_gems "myrack 1.0.0" end context "bundled for multiple platforms" do @@ -441,7 +441,7 @@ RSpec.describe "bundle install from an existing gemspec" do end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gemspec G @@ -478,7 +478,7 @@ RSpec.describe "bundle install from an existing gemspec" do platform_specific GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: platform_specific (1.0) platform_specific (1.0-java) @@ -518,7 +518,7 @@ RSpec.describe "bundle install from an existing gemspec" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: platform_specific (1.0) platform_specific (1.0-java) @@ -561,7 +561,7 @@ RSpec.describe "bundle install from an existing gemspec" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: indirect_platform_specific (1.0) platform_specific @@ -591,8 +591,8 @@ RSpec.describe "bundle install from an existing gemspec" do before do build_lib("foo", path: tmp("foo")) do |s| s.version = "1.0.0" - s.add_development_dependency "rack" - s.write "foo-universal-java.gemspec", build_spec("foo", "1.0.0", "universal-java") {|sj| sj.runtime "rack", "1.0.0" }.first.to_ruby + s.add_development_dependency "myrack" + s.write "foo-universal-java.gemspec", build_spec("foo", "1.0.0", "universal-java") {|sj| sj.runtime "myrack", "1.0.0" }.first.to_ruby end end @@ -600,11 +600,11 @@ RSpec.describe "bundle install from an existing gemspec" do bundle "config set --local force_ruby_platform true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => '#{tmp("foo")}', :name => 'foo' G - expect(the_bundle).to include_gems "foo 1.0.0", "rack 1.0.0" + expect(the_bundle).to include_gems "foo 1.0.0", "myrack 1.0.0" end it "installs the ruby platform gemspec and skips dev deps with `without development` configured" do @@ -612,12 +612,12 @@ RSpec.describe "bundle install from an existing gemspec" do bundle "config set --local without development" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => '#{tmp("foo")}', :name => 'foo' G expect(the_bundle).to include_gem "foo 1.0.0" - expect(the_bundle).not_to include_gem "rack" + expect(the_bundle).not_to include_gem "myrack" end end @@ -637,7 +637,7 @@ RSpec.describe "bundle install from an existing gemspec" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec :path => "../chef" G @@ -656,7 +656,7 @@ RSpec.describe "bundle install from an existing gemspec" do win32-api (~> 1.5.3) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: win32-api (1.5.3-universal-mingw32) @@ -696,7 +696,7 @@ RSpec.describe "bundle install from an existing gemspec" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec :path => "../activeadmin" gem "jruby-openssl", :platform => :jruby G @@ -719,7 +719,7 @@ RSpec.describe "bundle install from an existing gemspec" do railties (>= 5.2, < 6.2) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: jruby-openssl (0.10.7-java) railties (6.1.4) diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb index 21216594b1..b1924876a7 100644 --- a/spec/bundler/install/gemfile/git_spec.rb +++ b/spec/bundler/install/gemfile/git_spec.rb @@ -8,7 +8,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem 'foo' end @@ -70,7 +70,7 @@ RSpec.describe "bundle install with git sources" do update_git "foo" install_gemfile bundled_app2("Gemfile"), <<-G, dir: bundled_app2 - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem 'foo' end @@ -93,7 +93,7 @@ RSpec.describe "bundle install with git sources" do build_git "foo" install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}" G @@ -106,7 +106,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" platforms :jruby do gem "only_java", "1.2", :git => "#{lib_path("only_java-1.0-java")}" end @@ -126,7 +126,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" platforms :jruby do gem "only_java", "1.2", :git => "#{lib_path("only_java-1.1-java")}" end @@ -153,17 +153,17 @@ RSpec.describe "bundle install with git sources" do update_git "foo", "1.1", path: lib_path("foo-1.0") gemfile tmp("bundled_app.bck/Gemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem 'foo' end - gem "rack", "1.0" + gem "myrack", "1.0" G bundle "update foo", dir: tmp("bundled_app.bck") - expect(the_bundle).to include_gems "foo 1.1", "rack 1.0", dir: tmp("bundled_app.bck") + expect(the_bundle).to include_gems "foo 1.1", "myrack 1.0", dir: tmp("bundled_app.bck") end end @@ -171,8 +171,8 @@ RSpec.describe "bundle install with git sources" do before do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" git "#{lib_path("foo-1.0")}" do # this page left intentionally blank @@ -182,7 +182,7 @@ RSpec.describe "bundle install with git sources" do it "does not explode" do bundle "install" - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end @@ -195,7 +195,7 @@ RSpec.describe "bundle install with git sources" do it "works" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}", :ref => "#{@revision}" do gem "foo" end @@ -212,7 +212,7 @@ RSpec.describe "bundle install with git sources" do it "works when the revision is a symbol" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}", :ref => #{@revision.to_sym.inspect} do gem "foo" end @@ -229,14 +229,14 @@ RSpec.describe "bundle install with git sources" do it "works when an abbreviated revision is added after an initial, potentially shallow clone" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem "foo" end G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}", :ref => #{@revision[0..7].inspect} do gem "foo" end @@ -246,11 +246,11 @@ RSpec.describe "bundle install with git sources" do it "works when a tag that does not look like a commit hash is used as the value of :ref" do build_git "foo" @remote = build_git("bar", bare: true) - update_git "foo", remote: file_uri_for(@remote.path) + update_git "foo", remote: @remote.path update_git "foo", push: "main" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{@remote.path}" G @@ -259,7 +259,7 @@ RSpec.describe "bundle install with git sources" do update_git "foo", push: "v1.0.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{@remote.path}", :ref => "v1.0.0" G @@ -280,7 +280,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}", :ref => "refs/bundler/1" do gem "foo" end @@ -297,7 +297,7 @@ RSpec.describe "bundle install with git sources" do it "works when the revision is a non-head ref and it was previously downloaded" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem "foo" end @@ -316,7 +316,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}", :ref => "refs/bundler/1" do gem "foo" end @@ -337,7 +337,7 @@ RSpec.describe "bundle install with git sources" do bundle "config set global_gem_cache true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem "foo" end @@ -360,7 +360,7 @@ RSpec.describe "bundle install with git sources" do update_git("foo", path: repo, branch: branch) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{repo}", :branch => #{branch.dump} do gem "foo" end @@ -377,7 +377,7 @@ RSpec.describe "bundle install with git sources" do update_git("foo", path: repo, branch: branch) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{repo}", :branch => #{branch.dump} do gem "foo" end @@ -395,7 +395,7 @@ RSpec.describe "bundle install with git sources" do update_git("foo", path: repo, branch: branch) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{repo}", :branch => #{branch.dump} do gem "foo" end @@ -414,7 +414,7 @@ RSpec.describe "bundle install with git sources" do update_git("foo", path: repo, tag: tag) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{repo}", :tag => #{tag.dump} do gem "foo" end @@ -431,7 +431,7 @@ RSpec.describe "bundle install with git sources" do update_git("foo", path: repo, tag: tag) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{repo}", :tag => #{tag.dump} do gem "foo" end @@ -449,7 +449,7 @@ RSpec.describe "bundle install with git sources" do update_git("foo", path: repo, tag: tag) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{repo}", :tag => #{tag.dump} do gem "foo" end @@ -462,100 +462,100 @@ RSpec.describe "bundle install with git sources" do describe "when specifying local override" do it "uses the local repository instead of checking a new one out" do - build_git "rack", "0.8", path: lib_path("local-rack") do |s| - s.write "lib/rack.rb", "puts :LOCAL" + build_git "myrack", "0.8", path: lib_path("local-myrack") do |s| + s.write "lib/myrack.rb", "puts :LOCAL" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install - run "require 'rack'" + run "require 'myrack'" expect(out).to eq("LOCAL") end it "chooses the local repository on runtime" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) - update_git "rack", "0.8", path: lib_path("local-rack") do |s| - s.write "lib/rack.rb", "puts :LOCAL" + update_git "myrack", "0.8", path: lib_path("local-myrack") do |s| + s.write "lib/myrack.rb", "puts :LOCAL" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) - run "require 'rack'" + bundle %(config set local.myrack #{lib_path("local-myrack")}) + run "require 'myrack'" expect(out).to eq("LOCAL") end it "unlocks the source when the dependencies have changed while switching to the local" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) - update_git "rack", "0.8", path: lib_path("local-rack") do |s| - s.write "rack.gemspec", build_spec("rack", "0.8") { runtime "rspec", "> 0" }.first.to_ruby - s.write "lib/rack.rb", "puts :LOCAL" + update_git "myrack", "0.8", path: lib_path("local-myrack") do |s| + s.write "myrack.gemspec", build_spec("myrack", "0.8") { runtime "rspec", "> 0" }.first.to_ruby + s.write "lib/myrack.rb", "puts :LOCAL" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install - run "require 'rack'" + run "require 'myrack'" expect(out).to eq("LOCAL") end it "updates specs on runtime" do system_gems "nokogiri-1.4.2" - build_git "rack", "0.8" + build_git "myrack", "0.8" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G lockfile0 = File.read(bundled_app_lock) - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) - update_git "rack", "0.8", path: lib_path("local-rack") do |s| + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) + update_git "myrack", "0.8", path: lib_path("local-myrack") do |s| s.add_dependency "nokogiri", "1.4.2" end - bundle %(config set local.rack #{lib_path("local-rack")}) - run "require 'rack'" + bundle %(config set local.myrack #{lib_path("local-myrack")}) + run "require 'myrack'" lockfile1 = File.read(bundled_app_lock) expect(lockfile1).not_to eq(lockfile0) end it "updates ref on install" do - build_git "rack", "0.8" + build_git "myrack", "0.8" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G lockfile0 = File.read(bundled_app_lock) - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) - update_git "rack", "0.8", path: lib_path("local-rack") + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) + update_git "myrack", "0.8", path: lib_path("local-myrack") - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install lockfile1 = File.read(bundled_app_lock) @@ -563,18 +563,18 @@ RSpec.describe "bundle install with git sources" do end it "explodes and gives correct solution if given path does not exist on install" do - build_git "rack", "0.8" + build_git "myrack", "0.8" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install, raise_on_error: false - expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path("local-rack").to_s)} does not exist/) + expect(err).to match(/Cannot use local override for myrack-0.8 because #{Regexp.escape(lib_path("local-myrack").to_s)} does not exist/) - solution = "config unset local.rack" + solution = "config unset local.myrack" expect(err).to match(/Run `bundle #{solution}` to remove the local override/) bundle solution @@ -584,19 +584,19 @@ RSpec.describe "bundle install with git sources" do end it "explodes and gives correct solution if branch is not given on install" do - build_git "rack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + build_git "myrack", "0.8" + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install, raise_on_error: false - expect(err).to match(/Cannot use local override for rack-0.8 at #{Regexp.escape(lib_path("local-rack").to_s)} because :branch is not specified in Gemfile/) + expect(err).to match(/Cannot use local override for myrack-0.8 at #{Regexp.escape(lib_path("local-myrack").to_s)} because :branch is not specified in Gemfile/) - solution = "config unset local.rack" + solution = "config unset local.myrack" expect(err).to match(/Specify a branch or run `bundle #{solution}` to remove the local override/) bundle solution @@ -606,69 +606,69 @@ RSpec.describe "bundle install with git sources" do end it "does not explode if disable_local_branch_check is given" do - build_git "rack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + build_git "myrack", "0.8" + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle %(config set disable_local_branch_check true) bundle :install expect(out).to match(/Bundle complete!/) end it "explodes on different branches on install" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) - update_git "rack", "0.8", path: lib_path("local-rack"), branch: "another" do |s| - s.write "lib/rack.rb", "puts :LOCAL" + update_git "myrack", "0.8", path: lib_path("local-myrack"), branch: "another" do |s| + s.write "lib/myrack.rb", "puts :LOCAL" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install, raise_on_error: false expect(err).to match(/is using branch another but Gemfile specifies main/) end it "explodes on invalid revision on install" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - build_git "rack", "0.8", path: lib_path("local-rack") do |s| - s.write "lib/rack.rb", "puts :LOCAL" + build_git "myrack", "0.8", path: lib_path("local-myrack") do |s| + s.write "lib/myrack.rb", "puts :LOCAL" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install, raise_on_error: false expect(err).to match(/The Gemfile lock is pointing to revision \w+/) end it "does not explode on invalid revision on install" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - build_git "rack", "0.8", path: lib_path("local-rack") do |s| - s.write "lib/rack.rb", "puts :LOCAL" + build_git "myrack", "0.8", path: lib_path("local-myrack") do |s| + s.write "lib/myrack.rb", "puts :LOCAL" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle %(config set disable_local_revision_check true) bundle :install expect(out).to match(/Bundle complete!/) @@ -693,66 +693,66 @@ RSpec.describe "bundle install with git sources" do # end it "installs from git even if a newer gem is available elsewhere" do - build_git "rack", "0.8" + build_git "myrack", "0.8" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}" G - expect(the_bundle).to include_gems "rack 0.8" + expect(the_bundle).to include_gems "myrack 0.8" end it "installs dependencies from git even if a newer gem is available elsewhere" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" - build_lib "rack", "1.0", path: lib_path("nested/bar") do |s| - s.write "lib/rack.rb", "puts 'WIN OVERRIDE'" + build_lib "myrack", "1.0", path: lib_path("nested/bar") do |s| + s.write "lib/myrack.rb", "puts 'WIN OVERRIDE'" end build_git "foo", path: lib_path("nested") do |s| - s.add_dependency "rack", "= 1.0" + s.add_dependency "myrack", "= 1.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("nested")}" G - run "require 'rack'" + run "require 'myrack'" expect(out).to eq("WIN OVERRIDE") end it "correctly unlocks when changing to a git source" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G - build_git "rack", path: lib_path("rack") + build_git "myrack", path: lib_path("myrack") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0", :git => "#{lib_path("rack")}" + source "https://gem.repo1" + gem "myrack", "1.0.0", :git => "#{lib_path("myrack")}" G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "correctly unlocks when changing to a git source without versions" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - build_git "rack", "1.2", path: lib_path("rack") + build_git "myrack", "1.2", path: lib_path("myrack") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack")}" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack")}" G - expect(the_bundle).to include_gems "rack 1.2" + expect(the_bundle).to include_gems "myrack 1.2" end end @@ -762,7 +762,7 @@ RSpec.describe "bundle install with git sources" do build_lib "hi2u", path: lib_path("hi2u") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path("hi2u")}" do gem "omg" gem "hi2u" @@ -779,7 +779,7 @@ RSpec.describe "bundle install with git sources" do update_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{@revision}" G @@ -797,7 +797,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" gem "rails", "2.3.2" G @@ -827,7 +827,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :git => "#{lib_path("foo")}" gem "rails", "2.3.2" G @@ -844,7 +844,7 @@ RSpec.describe "bundle install with git sources" do build_git "foo", "1.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", "1.0", :git => "#{lib_path("foo-1.0")}" G @@ -855,7 +855,7 @@ RSpec.describe "bundle install with git sources" do build_git "foo", gemspec: false install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", "1.0", :git => "#{lib_path("foo-1.0")}" gem "rails", "2.3.2" G @@ -866,7 +866,7 @@ RSpec.describe "bundle install with git sources" do it "catches git errors and spits out useful output" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", "1.0", :git => "omgomg" G @@ -881,7 +881,7 @@ RSpec.describe "bundle install with git sources" do build_git "foo", path: lib_path("foo space-1.0") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo space-1.0")}" G @@ -892,7 +892,7 @@ RSpec.describe "bundle install with git sources" do build_git "forced", "1.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("forced-1.0")}" do gem 'forced' end @@ -924,12 +924,12 @@ RSpec.describe "bundle install with git sources" do git "commit -m \"submodulator\"", lib_path("has_submodule-1.0") install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("has_submodule-1.0")}" do gem "has_submodule" end G - expect(err).to match(%r{submodule >= 0 could not be found in rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally}) + expect(err).to match(%r{submodule >= 0 could not be found in rubygems repository https://gem.repo1/ or installed locally}) expect(the_bundle).not_to include_gems "has_submodule 1.0" end @@ -946,7 +946,7 @@ RSpec.describe "bundle install with git sources" do git "commit -m \"submodulator\"", lib_path("has_submodule-1.0") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("has_submodule-1.0")}", :submodules => true do gem "has_submodule" end @@ -966,7 +966,7 @@ RSpec.describe "bundle install with git sources" do git "commit -m \"submodulator\"", lib_path("has_submodule-1.0") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("has_submodule-1.0")}" do gem "has_submodule" end @@ -981,7 +981,7 @@ RSpec.describe "bundle install with git sources" do git = build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem "foo" end @@ -991,7 +991,7 @@ RSpec.describe "bundle install with git sources" do update_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}", :ref => "#{git.ref_for("HEAD^")}" do gem "foo" end @@ -1009,7 +1009,7 @@ RSpec.describe "bundle install with git sources" do build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1023,7 +1023,7 @@ RSpec.describe "bundle install with git sources" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1038,7 +1038,7 @@ RSpec.describe "bundle install with git sources" do FileUtils.touch(default_bundle_path("bundler")) install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1056,7 +1056,7 @@ RSpec.describe "bundle install with git sources" do build_git "bar", path: lib_path("nested") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("nested")}" gem "bar", :git => "#{lib_path("nested")}" G @@ -1075,12 +1075,12 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :path => "#{lib_path("bar")}" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :git => "#{lib_path("bar")}" G @@ -1089,19 +1089,19 @@ RSpec.describe "bundle install with git sources" do it "doesn't explode when switching Gem to Git source" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack-obama" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack-obama" + gem "myrack", "1.0.0" G - build_git "rack", "1.0" do |s| + build_git "myrack", "1.0" do |s| s.write "lib/new_file.rb", "puts 'USING GIT'" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack-obama" - gem "rack", "1.0.0", :git => "#{lib_path("rack-1.0")}" + source "https://gem.repo1" + gem "myrack-obama" + gem "myrack", "1.0.0", :git => "#{lib_path("myrack-1.0")}" G run "require 'new_file'" @@ -1114,8 +1114,8 @@ RSpec.describe "bundle install with git sources" do build_git "valim" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "valim", :git => "#{file_uri_for(lib_path("valim-1.0"))}" + source "https://gem.repo1" + gem "valim", :git => "#{lib_path("valim-1.0")}" G old_revision = revision_for(lib_path("valim-1.0")) @@ -1140,14 +1140,14 @@ RSpec.describe "bundle install with git sources" do revision = revision_for(lib_path("foo-1.0")) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :ref => "#{revision}" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{revision}" G expect(out).to_not match(/Revision.*does not exist/) install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :ref => "deadbeef" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "deadbeef" G expect(err).to include("Revision deadbeef does not exist in the repository") end @@ -1156,8 +1156,8 @@ RSpec.describe "bundle install with git sources" do build_git "foo" install_gemfile <<-G, env: { "LANG" => "en" }, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :branch => "deadbeef" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "deadbeef" G expect(err).to include("Revision deadbeef does not exist in the repository") @@ -1169,7 +1169,7 @@ RSpec.describe "bundle install with git sources" do build_git "valim", path: lib_path("valim") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "valim", "= 1.0", :git => "#{lib_path("valim")}" G @@ -1184,7 +1184,7 @@ RSpec.describe "bundle install with git sources" do it "runs pre-install hooks" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1204,7 +1204,7 @@ RSpec.describe "bundle install with git sources" do it "runs post-install hooks" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1224,7 +1224,7 @@ RSpec.describe "bundle install with git sources" do it "complains if the install hook fails" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1258,7 +1258,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1297,7 +1297,7 @@ RSpec.describe "bundle install with git sources" do git_commit_sha = git_reader.ref_for("HEAD") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{git_commit_sha}" G @@ -1322,7 +1322,7 @@ RSpec.describe "bundle install with git sources" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1352,7 +1352,7 @@ In Gemfile: end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1365,7 +1365,7 @@ In Gemfile: expect(installed_time).to match(/\A\d+\.\d+\z/) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1393,8 +1393,8 @@ In Gemfile: end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1407,8 +1407,8 @@ In Gemfile: expect(installed_time).to match(/\A\d+\.\d+\z/) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1436,7 +1436,7 @@ In Gemfile: end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1452,7 +1452,7 @@ In Gemfile: expect(installed_time).to match(/\A\d+\.\d+\z/) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "branch2" G @@ -1485,7 +1485,7 @@ In Gemfile: ENV["GIT_WORK_TREE"] = "bar" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("xxxxxx-1.0")}" do gem 'xxxxxx' end @@ -1499,7 +1499,7 @@ In Gemfile: describe "without git installed" do it "prints a better error message when installing" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake", git: "https://github.com/ruby/rake" G @@ -1536,7 +1536,7 @@ In Gemfile: build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem 'foo' end @@ -1553,7 +1553,7 @@ In Gemfile: build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem 'foo' end @@ -1583,7 +1583,7 @@ In Gemfile: build_git "foo", "1.0", path: lib_path("foo") gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo")}", :branch => "main" G @@ -1599,7 +1599,7 @@ In Gemfile: it "does not display the password" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "https://#{credentials}@github.com/company/private-repo" do gem "foo" end @@ -1615,7 +1615,7 @@ In Gemfile: it "displays the oauth scheme but not the oauth token" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "https://#{credentials}:[email protected]/company/private-repo" do gem "foo" end diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb index f7907a9cad..71871899a2 100644 --- a/spec/bundler/install/gemfile/groups_spec.rb +++ b/spec/bundler/install/gemfile/groups_spec.rb @@ -4,8 +4,8 @@ RSpec.describe "bundle install with groups" do describe "installing with no options" do before :each do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" group :emo do gem "activesupport", "2.3.5" end @@ -14,7 +14,7 @@ RSpec.describe "bundle install with groups" do end it "installs gems in the default group" do - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "installs gems in a group block into that group" do @@ -40,7 +40,7 @@ RSpec.describe "bundle install with groups" do end it "sets up everything if Bundler.setup is used with no groups" do - output = run("require 'rack'; puts RACK") + output = run("require 'myrack'; puts MYRACK") expect(output).to eq("1.0.0") output = run("require 'activesupport'; puts ACTIVESUPPORT") @@ -74,8 +74,8 @@ RSpec.describe "bundle install with groups" do describe "with gems assigned to a single group" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" group :emo do gem "activesupport", "2.3.5" end @@ -88,13 +88,13 @@ RSpec.describe "bundle install with groups" do it "installs gems in the default group" do bundle "config set --local without emo" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0", groups: [:default] + expect(the_bundle).to include_gems "myrack 1.0.0", groups: [:default] end it "respects global `without` configuration, but does not save it locally" do bundle "config set --global without emo" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0", groups: [:default] + expect(the_bundle).to include_gems "myrack 1.0.0", groups: [:default] bundle "config list" expect(out).not_to include("Set for your local app (#{bundled_app(".bundle/config")}): [:emo]") expect(out).to include("Set for the current user (#{home(".bundle/config")}): [:emo]") @@ -129,13 +129,13 @@ RSpec.describe "bundle install with groups" do it "allows Bundler.setup for specific groups" do bundle "config set --local without emo" bundle :install - run("require 'rack'; puts RACK", :default) + run("require 'myrack'; puts MYRACK", :default) expect(out).to eq("1.0.0") end it "does not effect the resolve" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" group :emo do gem "rails", "2.3.2" @@ -153,7 +153,7 @@ RSpec.describe "bundle install with groups" do bundle :install expect(out).not_to include("activesupport") - expect(the_bundle).to include_gems "rack 1.0.0", groups: [:default] + expect(the_bundle).to include_gems "myrack 1.0.0", groups: [:default] expect(the_bundle).not_to include_gems "activesupport 2.3.5", groups: [:default] ENV["BUNDLE_WITHOUT"] = nil @@ -257,8 +257,8 @@ RSpec.describe "bundle install with groups" do describe "with gems assigned to multiple groups" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" group :emo, :lolercoaster do gem "activesupport", "2.3.5" end @@ -268,20 +268,20 @@ RSpec.describe "bundle install with groups" do it "installs gems in the default group" do bundle "config set --local without emo lolercoaster" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "installs the gem if any of its groups are installed" do bundle "config set --local without emo" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to include_gems "myrack 1.0.0", "activesupport 2.3.5" end describe "with a gem defined multiple times in different groups" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" group :emo do gem "activesupport", "2.3.5" @@ -316,8 +316,8 @@ RSpec.describe "bundle install with groups" do describe "nesting groups" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" group :emo do group :lolercoaster do gem "activesupport", "2.3.5" @@ -329,13 +329,13 @@ RSpec.describe "bundle install with groups" do it "installs gems in the default group" do bundle "config set --local without emo lolercoaster" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "installs the gem if any of its groups are installed" do bundle "config set --local without emo" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to include_gems "myrack 1.0.0", "activesupport 2.3.5" end end end @@ -343,8 +343,8 @@ RSpec.describe "bundle install with groups" do describe "when loading only the default group" do it "should not load all groups" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :groups => :development G @@ -352,7 +352,7 @@ RSpec.describe "bundle install with groups" do require "bundler" Bundler.setup :default Bundler.require :default - puts RACK + puts MYRACK begin require "activesupport" rescue LoadError @@ -369,33 +369,33 @@ RSpec.describe "bundle install with groups" do before(:each) do build_repo2 - system_gems "rack-0.9.1" + system_gems "myrack-0.9.1" - bundle "config set --local without rack" + bundle "config set --local without myrack" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" - group :rack do - gem "rack_middleware" + group :myrack do + gem "myrack_middleware" end G end it "uses the correct versions even if --without was used on the original" do - expect(the_bundle).to include_gems "rack 0.9.1" - expect(the_bundle).not_to include_gems "rack_middleware 1.0" + expect(the_bundle).to include_gems "myrack 0.9.1" + expect(the_bundle).not_to include_gems "myrack_middleware 1.0" simulate_new_machine bundle :install - expect(the_bundle).to include_gems "rack 0.9.1" - expect(the_bundle).to include_gems "rack_middleware 1.0" + expect(the_bundle).to include_gems "myrack 0.9.1" + expect(the_bundle).to include_gems "myrack_middleware 1.0" end it "does not hit the remote a second time" do FileUtils.rm_rf gem_repo2 - bundle "config set --local without rack" + bundle "config set --local without myrack" bundle :install, verbose: true expect(last_command.stdboth).not_to match(/fetching/i) end diff --git a/spec/bundler/install/gemfile/install_if_spec.rb b/spec/bundler/install/gemfile/install_if_spec.rb index c7640d07e1..689c5ab501 100644 --- a/spec/bundler/install/gemfile/install_if_spec.rb +++ b/spec/bundler/install/gemfile/install_if_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "bundle install with install_if conditionals" do it "follows the install_if DSL" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" install_if(lambda { true }) do gem "activesupport", "2.3.5" end @@ -11,29 +11,29 @@ RSpec.describe "bundle install with install_if conditionals" do install_if(lambda { false }) do gem "foo" end - gem "rack" + gem "myrack" G - expect(the_bundle).to include_gems("rack 1.0", "activesupport 2.3.5") + expect(the_bundle).to include_gems("myrack 1.0", "activesupport 2.3.5") expect(the_bundle).not_to include_gems("thin") expect(the_bundle).not_to include_gems("foo") checksums = checksums_section_when_existing do |c| c.checksum gem_repo1, "activesupport", "2.3.5" c.no_checksum "foo", "1.0" - c.checksum gem_repo1, "rack", "1.0.0" + c.checksum gem_repo1, "myrack", "1.0.0" c.no_checksum "thin", "1.0" end expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: activesupport (2.3.5) foo (1.0) - rack (1.0.0) + myrack (1.0.0) thin (1.0) - rack + myrack PLATFORMS #{lockfile_platforms} @@ -41,7 +41,7 @@ RSpec.describe "bundle install with install_if conditionals" do DEPENDENCIES activesupport (= 2.3.5) foo - rack + myrack thin #{checksums} BUNDLED WITH diff --git a/spec/bundler/install/gemfile/lockfile_spec.rb b/spec/bundler/install/gemfile/lockfile_spec.rb index 4601d3e2a8..f80b21e562 100644 --- a/spec/bundler/install/gemfile/lockfile_spec.rb +++ b/spec/bundler/install/gemfile/lockfile_spec.rb @@ -2,9 +2,9 @@ RSpec.describe "bundle install with a lockfile present" do let(:gf) { <<-G } - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G subject do @@ -28,7 +28,7 @@ RSpec.describe "bundle install with a lockfile present" do it "does not evaluate the gemfile twice" do bundle :install - with_env_vars("BUNDLER_SPEC_NO_APPEND" => "1") { expect(the_bundle).to include_gem "rack 1.0.0" } + with_env_vars("BUNDLER_SPEC_NO_APPEND" => "1") { expect(the_bundle).to include_gem "myrack 1.0.0" } # The first eval is from the initial install, we're testing that the # second install doesn't double-eval @@ -41,7 +41,7 @@ RSpec.describe "bundle install with a lockfile present" do it "does not evaluate the gemfile twice" do bundle :install - with_env_vars("BUNDLER_SPEC_NO_APPEND" => "1") { expect(the_bundle).to include_gem "rack 1.0.0" } + with_env_vars("BUNDLER_SPEC_NO_APPEND" => "1") { expect(the_bundle).to include_gem "myrack 1.0.0" } # The first eval is from the initial install, we're testing that the # second install doesn't double-eval diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index a57b7ee560..ca712e24c8 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -16,7 +16,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path("foo-1.0")}" do gem 'foo' end @@ -29,7 +29,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :path => "#{lib_path("foo-1.0")}" G @@ -42,7 +42,7 @@ RSpec.describe "bundle install with explicit source paths" do relative_path = lib_path("foo-1.0").relative_path_from(bundled_app) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :path => "#{relative_path}" G @@ -55,7 +55,7 @@ RSpec.describe "bundle install with explicit source paths" do relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new("~").expand_path) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :path => "~/#{relative_path}" G @@ -70,7 +70,7 @@ RSpec.describe "bundle install with explicit source paths" do relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new("/home/#{username}").expand_path) install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :path => "~#{username}/#{relative_path}" G expect(err).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.") @@ -81,7 +81,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo", path: bundled_app("foo-1.0") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :path => "./foo-1.0" G @@ -93,7 +93,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "aaa", path: lib_path("demo/aaa") gemfile lib_path("demo/Gemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec gem "aaa", :path => "./aaa" G @@ -115,7 +115,7 @@ RSpec.describe "bundle install with explicit source paths" do aaa (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -139,7 +139,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo", path: bundled_app("foo-1.0") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :path => File.expand_path("foo-1.0", __dir__) G @@ -148,22 +148,22 @@ RSpec.describe "bundle install with explicit source paths" do end it "installs dependencies from the path even if a newer gem is available elsewhere" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" - build_lib "rack", "1.0", path: lib_path("nested/bar") do |s| - s.write "lib/rack.rb", "puts 'WIN OVERRIDE'" + build_lib "myrack", "1.0", path: lib_path("nested/bar") do |s| + s.write "lib/myrack.rb", "puts 'WIN OVERRIDE'" end build_lib "foo", path: lib_path("nested") do |s| - s.add_dependency "rack", "= 1.0" + s.add_dependency "myrack", "= 1.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("nested")}" G - run "require 'rack'" + run "require 'myrack'" expect(out).to eq("WIN OVERRIDE") end @@ -179,7 +179,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo", "1.0.0", path: lib_path("omg/foo") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "omg", :path => "#{lib_path("omg")}" G @@ -190,7 +190,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo", "0.0.0.dev", path: lib_path("foo") gemfile <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" G @@ -201,7 +201,7 @@ RSpec.describe "bundle install with explicit source paths" do foo (0.0.0.dev) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -223,7 +223,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo", "0.0.0.SNAPSHOT", path: lib_path("foo") gemfile <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" G @@ -234,7 +234,7 @@ RSpec.describe "bundle install with explicit source paths" do foo (0.0.0.SNAPSHOT) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -256,7 +256,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "omg", "2.0", path: lib_path("omg") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "omg", :path => "#{lib_path("omg")}" G @@ -280,7 +280,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "premailer", :path => "#{lib_path("premailer")}" G @@ -302,7 +302,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo-1.0")}" G @@ -314,17 +314,17 @@ RSpec.describe "bundle install with explicit source paths" do it "supports gemspec syntax" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", "1.0" + s.add_dependency "myrack", "1.0" end gemfile lib_path("foo/Gemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G bundle "install", dir: lib_path("foo") expect(the_bundle).to include_gems "foo 1.0", dir: lib_path("foo") - expect(the_bundle).to include_gems "rack 1.0", dir: lib_path("foo") + expect(the_bundle).to include_gems "myrack 1.0", dir: lib_path("foo") end it "does not unlock dependencies of path sources" do @@ -340,7 +340,7 @@ RSpec.describe "bundle install with explicit source paths" do gemfile_path = lib_path("foo/Gemfile") gemfile gemfile_path, <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec G @@ -359,7 +359,7 @@ RSpec.describe "bundle install with explicit source paths" do graphql (~> 2.0) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: graphql (2.0.15) @@ -385,53 +385,53 @@ RSpec.describe "bundle install with explicit source paths" do it "supports gemspec syntax with an alternative path" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", "1.0" + s.add_dependency "myrack", "1.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => "#{lib_path("foo")}" G expect(the_bundle).to include_gems "foo 1.0" - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end it "doesn't automatically unlock dependencies when using the gemspec syntax" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", ">= 1.0" + s.add_dependency "myrack", ">= 1.0" end install_gemfile lib_path("foo/Gemfile"), <<-G, dir: lib_path("foo") - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G - build_gem "rack", "1.0.1", to_system: true + build_gem "myrack", "1.0.1", to_system: true bundle "install", dir: lib_path("foo") expect(the_bundle).to include_gems "foo 1.0", dir: lib_path("foo") - expect(the_bundle).to include_gems "rack 1.0", dir: lib_path("foo") + expect(the_bundle).to include_gems "myrack 1.0", dir: lib_path("foo") end it "doesn't automatically unlock dependencies when using the gemspec syntax and the gem has development dependencies" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", ">= 1.0" + s.add_dependency "myrack", ">= 1.0" s.add_development_dependency "activesupport" end install_gemfile lib_path("foo/Gemfile"), <<-G, dir: lib_path("foo") - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G - build_gem "rack", "1.0.1", to_system: true + build_gem "myrack", "1.0.1", to_system: true bundle "install", dir: lib_path("foo") expect(the_bundle).to include_gems "foo 1.0", dir: lib_path("foo") - expect(the_bundle).to include_gems "rack 1.0", dir: lib_path("foo") + expect(the_bundle).to include_gems "myrack 1.0", dir: lib_path("foo") end it "raises if there are multiple gemspecs" do @@ -440,7 +440,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => "#{lib_path("foo")}" G @@ -454,7 +454,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => "#{lib_path("foo")}", :name => "foo" G @@ -467,7 +467,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path("foo-1.0")}" do gem 'foo' end @@ -485,7 +485,7 @@ RSpec.describe "bundle install with explicit source paths" do lib_path("foo-1.0").join("bin/performance").mkpath install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', '1.0', :path => "#{lib_path("foo-1.0")}" G expect(err).to be_empty @@ -495,7 +495,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :path => "#{lib_path("foo-1.0")}" G @@ -508,7 +508,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "hi2u" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "omg" gem "hi2u" @@ -527,7 +527,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" gem "omg", :path => "#{lib_path("omg")}" G @@ -539,7 +539,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo", gemspec: false gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", "1.0", :path => "#{lib_path("foo-1.0")}" G @@ -569,18 +569,18 @@ RSpec.describe "bundle install with explicit source paths" do context "existing lockfile" do it "rubygems gems don't re-resolve without changes" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack-obama', '1.0' + source "https://gem.repo1" + gem 'myrack-obama', '1.0' gem 'net-ssh', '1.0' G bundle :check, env: { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) - expect(the_bundle).to include_gems "rack-obama 1.0", "net-ssh 1.0" + expect(the_bundle).to include_gems "myrack-obama 1.0", "net-ssh 1.0" end it "source path gems w/deps don't re-resolve without changes" do - build_lib "rack-obama", "1.0", path: lib_path("omg") do |s| + build_lib "myrack-obama", "1.0", path: lib_path("omg") do |s| s.add_dependency "yard" end @@ -589,14 +589,14 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack-obama', :path => "#{lib_path("omg")}" + source "https://gem.repo1" + gem 'myrack-obama', :path => "#{lib_path("omg")}" gem 'net-ssh', :path => "#{lib_path("omg")}" G bundle :check, env: { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) - expect(the_bundle).to include_gems "rack-obama 1.0", "net-ssh 1.0" + expect(the_bundle).to include_gems "myrack-obama 1.0", "net-ssh 1.0" end end @@ -606,7 +606,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo-1.0")}" G @@ -622,7 +622,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "bar", "1.0", path: lib_path("foo/bar") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" G end @@ -651,33 +651,33 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "foo", "1.0", path: lib_path("foo") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo")}" G end it "gets dependencies that are updated in the path" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack" + s.add_dependency "myrack" end bundle "install" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "keeps using the same version if it's compatible" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", "0.9.1" + s.add_dependency "myrack", "0.9.1" end bundle "install" - expect(the_bundle).to include_gems "rack 0.9.1" + expect(the_bundle).to include_gems "myrack 0.9.1" checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" - c.checksum gem_repo1, "rack", "0.9.1" + c.checksum gem_repo1, "myrack", "0.9.1" end expect(lockfile).to eq <<~G @@ -685,12 +685,12 @@ RSpec.describe "bundle install with explicit source paths" do remote: #{lib_path("foo")} specs: foo (1.0) - rack (= 0.9.1) + myrack (= 0.9.1) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} @@ -703,7 +703,7 @@ RSpec.describe "bundle install with explicit source paths" do G build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack" + s.add_dependency "myrack" end bundle "install" @@ -713,12 +713,12 @@ RSpec.describe "bundle install with explicit source paths" do remote: #{lib_path("foo")} specs: foo (1.0) - rack + myrack GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} @@ -730,21 +730,21 @@ RSpec.describe "bundle install with explicit source paths" do #{Bundler::VERSION} G - expect(the_bundle).to include_gems "rack 0.9.1" + expect(the_bundle).to include_gems "myrack 0.9.1" end it "keeps using the same version even when another dependency is added" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", "0.9.1" + s.add_dependency "myrack", "0.9.1" end bundle "install" - expect(the_bundle).to include_gems "rack 0.9.1" + expect(the_bundle).to include_gems "myrack 0.9.1" checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" - c.checksum gem_repo1, "rack", "0.9.1" + c.checksum gem_repo1, "myrack", "0.9.1" end expect(lockfile).to eq <<~G @@ -752,12 +752,12 @@ RSpec.describe "bundle install with explicit source paths" do remote: #{lib_path("foo")} specs: foo (1.0) - rack (= 0.9.1) + myrack (= 0.9.1) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} @@ -770,7 +770,7 @@ RSpec.describe "bundle install with explicit source paths" do G build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack" + s.add_dependency "myrack" s.add_dependency "rake", rake_version end @@ -783,13 +783,13 @@ RSpec.describe "bundle install with explicit source paths" do remote: #{lib_path("foo")} specs: foo (1.0) - rack + myrack rake (= #{rake_version}) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (0.9.1) + myrack (0.9.1) rake (#{rake_version}) PLATFORMS @@ -802,12 +802,12 @@ RSpec.describe "bundle install with explicit source paths" do #{Bundler::VERSION} G - expect(the_bundle).to include_gems "rack 0.9.1" + expect(the_bundle).to include_gems "myrack 0.9.1" end it "does not remove existing ruby platform" do build_lib "foo", "1.0", path: lib_path("foo") do |s| - s.add_dependency "rack", "0.9.1" + s.add_dependency "myrack", "0.9.1" end checksums = checksums_section_when_existing do |c| @@ -832,19 +832,19 @@ RSpec.describe "bundle install with explicit source paths" do bundle "lock" - checksums.no_checksum "rack", "0.9.1" + checksums.no_checksum "myrack", "0.9.1" expect(lockfile).to eq <<~G PATH remote: #{lib_path("foo")} specs: foo (1.0) - rack (= 0.9.1) + myrack (= 0.9.1) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms("ruby")} @@ -869,12 +869,12 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :git => "#{lib_path("bar")}" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :path => "#{lib_path("bar")}" G @@ -888,7 +888,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar" path "#{lib_path("foo")}" do gem "foo" @@ -898,7 +898,7 @@ RSpec.describe "bundle install with explicit source paths" do build_lib "bar", "1.0", path: lib_path("foo/bar") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path("foo")}" do gem "foo" gem "bar" @@ -915,13 +915,13 @@ RSpec.describe "bundle install with explicit source paths" do gemfile lib_path("private_lib/Gemfile"), <<-G source "http://localgemserver.test" gemspec - gem 'rack' + gem 'myrack' G bundle :install, env: { "DEBUG" => "1" }, artifice: "endpoint", dir: lib_path("private_lib") - expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$}) + expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=myrack$}) expect(out).not_to match(/^HTTP GET.*private_lib/) expect(the_bundle).to include_gems "private_lib 2.2", dir: lib_path("private_lib") - expect(the_bundle).to include_gems "rack 1.0", dir: lib_path("private_lib") + expect(the_bundle).to include_gems "myrack 1.0", dir: lib_path("private_lib") end end @@ -929,7 +929,7 @@ RSpec.describe "bundle install with explicit source paths" do it "runs pre-install hooks" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -949,7 +949,7 @@ RSpec.describe "bundle install with explicit source paths" do it "runs post-install hooks" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -969,7 +969,7 @@ RSpec.describe "bundle install with explicit source paths" do it "complains if the install hook fails" do build_git "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1000,7 +1000,7 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo-1.0")}" gem "bar", :path => "#{lib_path("bar-1.0")}" G diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb index d90dacdc02..75ec08ba36 100644 --- a/spec/bundler/install/gemfile/platform_spec.rb +++ b/spec/bundler/install/gemfile/platform_spec.rb @@ -4,30 +4,30 @@ RSpec.describe "bundle install across platforms" do it "maintains the same lockfile if all gems are compatible across platforms" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{not_local} DEPENDENCIES - rack + myrack G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G - expect(the_bundle).to include_gems "rack 0.9.1" + expect(the_bundle).to include_gems "myrack 0.9.1" end it "pulls in the correct platform specific gem" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)} + remote: https://gem.repo1 specs: platform_specific (1.0) platform_specific (1.0-java) @@ -42,7 +42,7 @@ RSpec.describe "bundle install across platforms" do simulate_platform "java" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -53,7 +53,7 @@ RSpec.describe "bundle install across platforms" do it "pulls the pure ruby version on jruby if the java platform is not present in the lockfile and bundler is run in frozen mode", :jruby_only do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)} + remote: https://gem.repo1 specs: platform_specific (1.0) @@ -67,7 +67,7 @@ RSpec.describe "bundle install across platforms" do bundle "config set --local frozen true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -96,7 +96,7 @@ RSpec.describe "bundle install across platforms" do it "pulls in the correct architecture gem" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: darwin_single_arch (1.0) darwin_single_arch (1.0-arm64-darwin) @@ -112,7 +112,7 @@ RSpec.describe "bundle install across platforms" do simulate_platform "universal-darwin-21" simulate_ruby_platform "universal.x86_64-darwin21" do install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "darwin_single_arch" G @@ -124,7 +124,7 @@ RSpec.describe "bundle install across platforms" do it "pulls in the correct architecture gem on arm64e macOS Ruby" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: darwin_single_arch (1.0) darwin_single_arch (1.0-arm64-darwin) @@ -140,7 +140,7 @@ RSpec.describe "bundle install across platforms" do simulate_platform "universal-darwin-21" simulate_ruby_platform "universal.arm64e-darwin21" do install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "darwin_single_arch" G @@ -153,7 +153,7 @@ RSpec.describe "bundle install across platforms" do it "works with gems that have different dependencies" do simulate_platform "java" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri" G @@ -197,7 +197,7 @@ RSpec.describe "bundle install across platforms" do simulate_platform java install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "empyrean", "0.1.0" gem "pry" @@ -214,7 +214,7 @@ RSpec.describe "bundle install across platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: coderay (1.1.2) empyrean (0.1.0) @@ -242,7 +242,7 @@ RSpec.describe "bundle install across platforms" do good_lockfile = <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: coderay (1.1.2) empyrean (0.1.0) @@ -274,7 +274,7 @@ RSpec.describe "bundle install across platforms" do bad_lockfile = <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: coderay (1.1.2) empyrean (0.1.0) @@ -341,11 +341,11 @@ RSpec.describe "bundle install across platforms" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" G install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "image_optim_pack" G @@ -357,9 +357,9 @@ RSpec.describe "bundle install across platforms" do it "fetches gems again after changing the version of Ruby" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G bundle "config set --local path vendor/bundle" @@ -368,18 +368,18 @@ RSpec.describe "bundle install across platforms" do FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, "1.8")) bundle :install - expect(vendored_gems("gems/rack-1.0.0")).to exist + expect(vendored_gems("gems/myrack-1.0.0")).to exist end it "keeps existing platforms when installing with force_ruby_platform" do - checksums = checksums_section do |c| - c.no_checksum "platform_specific", "1.0" - c.no_checksum "platform_specific", "1.0", "java" + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo1, "platform_specific", "1.0" + c.checksum gem_repo1, "platform_specific", "1.0", "java" end lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: platform_specific (1.0-java) @@ -394,7 +394,7 @@ RSpec.describe "bundle install across platforms" do bundle "config set --local force_ruby_platform true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -404,7 +404,7 @@ RSpec.describe "bundle install across platforms" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: platform_specific (1.0) platform_specific (1.0-java) @@ -425,7 +425,7 @@ end RSpec.describe "bundle install with platform conditionals" do it "installs gems tagged w/ the current platforms" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" platforms :#{local_tag} do gem "nokogiri" @@ -437,14 +437,14 @@ RSpec.describe "bundle install with platform conditionals" do it "does not install gems tagged w/ another platforms" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" platforms :#{not_local_tag} do gem "nokogiri" end G - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" expect(the_bundle).not_to include_gems "nokogiri 1.4.2" end @@ -458,7 +458,7 @@ RSpec.describe "bundle install with platform conditionals" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "activesupport" @@ -469,7 +469,7 @@ RSpec.describe "bundle install with platform conditionals" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: activesupport (6.1.4.1) tzinfo (~> 2.0) @@ -493,7 +493,7 @@ RSpec.describe "bundle install with platform conditionals" do it "installs gems tagged w/ the current platforms inline" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri", :platforms => :#{local_tag} G expect(the_bundle).to include_gems "nokogiri 1.4.2" @@ -501,17 +501,17 @@ RSpec.describe "bundle install with platform conditionals" do it "does not install gems tagged w/ another platforms inline" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "nokogiri", :platforms => :#{not_local_tag} G - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" expect(the_bundle).not_to include_gems "nokogiri 1.4.2" end it "installs gems tagged w/ the current platform inline" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri", :platform => :#{local_tag} G expect(the_bundle).to include_gems "nokogiri 1.4.2" @@ -519,7 +519,7 @@ RSpec.describe "bundle install with platform conditionals" do it "doesn't install gems tagged w/ another platform inline" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri", :platform => :#{not_local_tag} G expect(the_bundle).not_to include_gems "nokogiri 1.4.2" @@ -529,7 +529,7 @@ RSpec.describe "bundle install with platform conditionals" do build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" platform :#{not_local_tag} do gem "foo", :git => "#{lib_path("foo-1.0")}" end @@ -542,7 +542,7 @@ RSpec.describe "bundle install with platform conditionals" do bundle "config set --local force_ruby_platform true" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "some_gem", :platform => :rbx G @@ -553,7 +553,7 @@ RSpec.describe "bundle install with platform conditionals" do it "does not attempt to install gems from other rubies when using --local" do bundle "config set --local force_ruby_platform true" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "some_gem", platform: :ruby_22 G @@ -565,9 +565,9 @@ RSpec.describe "bundle install with platform conditionals" do bundle "config set --local force_ruby_platform true" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", :platform => [:windows, :mswin, :mswin64, :mingw, :x64_mingw, :jruby] + gem "myrack", :platform => [:windows, :mswin, :mswin64, :mingw, :x64_mingw, :jruby] G bundle "install" @@ -576,14 +576,14 @@ RSpec.describe "bundle install with platform conditionals" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS ruby DEPENDENCIES - rack + myrack #{checksums_section_when_existing} BUNDLED WITH #{Bundler::VERSION} @@ -602,7 +602,7 @@ RSpec.describe "bundle install with platform conditionals" do end install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "listen" gem "ffi", :platform => :windows diff --git a/spec/bundler/install/gemfile/ruby_spec.rb b/spec/bundler/install/gemfile/ruby_spec.rb index b64d633fd3..3e15d82bbe 100644 --- a/spec/bundler/install/gemfile/ruby_spec.rb +++ b/spec/bundler/install/gemfile/ruby_spec.rb @@ -10,77 +10,77 @@ RSpec.describe "ruby requirement" do # requirement. This test verifies the fix, committed in bfbad5c5. it "allows adding gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "#{Gem.ruby_version}" - gem "rack" + gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "#{Gem.ruby_version}" - gem "rack" - gem "rack-obama" + gem "myrack" + gem "myrack-obama" G - expect(the_bundle).to include_gems "rack-obama 1.0" + expect(the_bundle).to include_gems "myrack-obama 1.0" end it "allows removing the ruby version requirement" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "~> #{Gem.ruby_version}" - gem "rack" + gem "myrack" G expect(lockfile).to include("RUBY VERSION") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(lockfile).not_to include("RUBY VERSION") end it "allows changing the ruby version requirement to something compatible" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby ">= #{current_ruby_minor}" - gem "rack" + gem "myrack" G allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) expect(locked_ruby_version).to eq(Bundler::RubyVersion.system) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby ">= #{Gem.ruby_version}" - gem "rack" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(locked_ruby_version).to eq(Bundler::RubyVersion.system) end it "allows changing the ruby version requirement to something incompatible" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby ">= 1.0.0" - gem "rack" + gem "myrack" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack RUBY VERSION ruby 2.1.4p422 @@ -92,30 +92,30 @@ RSpec.describe "ruby requirement" do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby ">= #{current_ruby_minor}" - gem "rack" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(locked_ruby_version).to eq(Bundler::RubyVersion.system) end it "allows requirements with trailing whitespace" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "#{Gem.ruby_version}\\n \t\\n" - gem "rack" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "fails gracefully with malformed requirements" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby ">= 0", "-.\\0" - gem "rack" + gem "myrack" G expect(err).to include("There was an error parsing") # i.e. DSL error, not error template @@ -125,9 +125,9 @@ RSpec.describe "ruby requirement" do create_file ".ruby-version", Gem.ruby_version.to_s install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby file: ".ruby-version" - gem "rack" + gem "myrack" G expect(lockfile).to include("RUBY VERSION") @@ -137,16 +137,16 @@ RSpec.describe "ruby requirement" do create_file ".ruby-version", Gem.ruby_version.to_s gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby file: ".ruby-version" - gem "rack" + gem "myrack" G nested_dir = bundled_app(".ruby-lsp") FileUtils.mkdir nested_dir - create_file ".ruby-lsp/Gemfile", <<-G + gemfile ".ruby-lsp/Gemfile", <<-G eval_gemfile(File.expand_path("../Gemfile", __dir__)) G diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index 3de77ff7e3..eea39c4664 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -2,28 +2,28 @@ RSpec.describe "bundle install with gems on multiple sources" do # repo1 is built automatically before all of the specs run - # it contains rack-obama 1.0.0 and rack 0.9.1 & 1.0.0 amongst other gems + # it contains myrack-obama 1.0.0 and myrack 0.9.1 & 1.0.0 amongst other gems context "without source affinity" do before do - # Oh no! Someone evil is trying to hijack rack :( + # Oh no! Someone evil is trying to hijack myrack :( # need this to be broken to check for correct source ordering build_repo gem_repo3 do - build_gem "rack", repo3_rack_version do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", repo3_myrack_version do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end end end context "with multiple toplevel sources" do - let(:repo3_rack_version) { "1.0.0" } + let(:repo3_myrack_version) { "1.0.0" } before do gemfile <<-G source "https://gem.repo3" source "https://gem.repo1" - gem "rack-obama" - gem "rack" + gem "myrack-obama" + gem "myrack" G end @@ -33,13 +33,13 @@ RSpec.describe "bundle install with gems on multiple sources" do remote: https://gem.repo3/ remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{local_platform} DEPENDENCIES - depends_on_rack! + depends_on_myrack! BUNDLED WITH #{Bundler::VERSION} @@ -51,9 +51,9 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(err).to eq <<~E.strip [DEPRECATED] Your Gemfile contains multiple global sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. Bundler found mismatched checksums. This is a potential security risk. - #{checksum_to_lock(gem_repo1, "rack", "1.0.0")} + #{checksum_to_lock(gem_repo1, "myrack", "1.0.0")} from the API at https://gem.repo1/ - #{checksum_to_lock(gem_repo3, "rack", "1.0.0")} + #{checksum_to_lock(gem_repo3, "myrack", "1.0.0")} from the API at https://gem.repo3/ Mismatched checksums each have an authoritative source: @@ -74,9 +74,9 @@ RSpec.describe "bundle install with gems on multiple sources" do it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", bundler: "< 3" do bundle :install, artifice: "compact_index" - expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include("Warning: the gem 'myrack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo1") - expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", source: "remote1") + expect(the_bundle).to include_gems("myrack-obama 1.0.0", "myrack 1.0.0", source: "remote1") end it "does not use the full index unnecessarily", bundler: "< 3" do @@ -97,22 +97,22 @@ RSpec.describe "bundle install with gems on multiple sources" do end context "when different versions of the same gem are in multiple sources" do - let(:repo3_rack_version) { "1.2" } + let(:repo3_myrack_version) { "1.2" } before do gemfile <<-G source "https://gem.repo3" source "https://gem.repo1" - gem "rack-obama" - gem "rack", "1.0.0" # force it to install the working version in repo1 + gem "myrack-obama" + gem "myrack", "1.0.0" # force it to install the working version in repo1 G end it "warns about ambiguous gems, but installs anyway", bundler: "< 3" do bundle :install, artifice: "compact_index" - expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include("Warning: the gem 'myrack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo1") - expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", source: "remote1") + expect(the_bundle).to include_gems("myrack-obama 1.0.0", "myrack 1.0.0", source: "remote1") end it "fails", bundler: "3" do @@ -154,15 +154,15 @@ RSpec.describe "bundle install with gems on multiple sources" do context "with source affinity" do context "with sources given by a block" do before do - # Oh no! Someone evil is trying to hijack rack :( + # Oh no! Someone evil is trying to hijack myrack :( # need this to be broken to check for correct source ordering build_repo gem_repo3 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0" do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end - build_gem "rack-obama" do |s| - s.add_dependency "rack" + build_gem "myrack-obama" do |s| + s.add_dependency "myrack" end end @@ -170,76 +170,76 @@ RSpec.describe "bundle install with gems on multiple sources" do source "https://gem.repo3" source "https://gem.repo1" do gem "thin" # comes first to test name sorting - gem "rack" + gem "myrack" end - gem "rack-obama" # should come from repo3! + gem "myrack-obama" # should come from repo3! G end it "installs the gems without any warning" do bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("rack-obama 1.0.0") - expect(the_bundle).to include_gems("rack 1.0.0", source: "remote1") + expect(the_bundle).to include_gems("myrack-obama 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0", source: "remote1") end it "can cache and deploy" do bundle :cache, artifice: "compact_index" - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist - expect(bundled_app("vendor/cache/rack-obama-1.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/myrack-obama-1.0.gem")).to exist bundle "config set --local deployment true" bundle :install, artifice: "compact_index" - expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0") + expect(the_bundle).to include_gems("myrack-obama 1.0.0", "myrack 1.0.0") end end context "with sources set by an option" do before do - # Oh no! Someone evil is trying to hijack rack :( + # Oh no! Someone evil is trying to hijack myrack :( # need this to be broken to check for correct source ordering build_repo gem_repo3 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0" do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end - build_gem "rack-obama" do |s| - s.add_dependency "rack" + build_gem "myrack-obama" do |s| + s.add_dependency "myrack" end end install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo3" - gem "rack-obama" # should come from repo3! - gem "rack", :source => "https://gem.repo1" + gem "myrack-obama" # should come from repo3! + gem "myrack", :source => "https://gem.repo1" G end it "installs the gems without any warning" do expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0") + expect(the_bundle).to include_gems("myrack-obama 1.0.0", "myrack 1.0.0") end end context "when a pinned gem has an indirect dependency in the pinned source" do before do build_repo gem_repo3 do - build_gem "depends_on_rack", "1.0.1" do |s| - s.add_dependency "rack" + build_gem "depends_on_myrack", "1.0.1" do |s| + s.add_dependency "myrack" end end - # we need a working rack gem in repo3 + # we need a working myrack gem in repo3 update_repo gem_repo3 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end gemfile <<-G source "https://gem.repo2" source "https://gem.repo3" do - gem "depends_on_rack" + gem "depends_on_myrack" end G end @@ -252,7 +252,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs from the same source without any warning" do bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0", source: "remote3") end end @@ -260,8 +260,8 @@ RSpec.describe "bundle install with gems on multiple sources" do before do # need this to be broken to check for correct source ordering build_repo gem_repo2 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0" do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end end end @@ -269,32 +269,32 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs from the same source without any warning" do bundle :install, artifice: "compact_index" - expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") + expect(err).not_to include("Warning: the gem 'myrack' was found in multiple sources.") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0", source: "remote3") # In https://github.com/bundler/bundler/issues/3585 this failed # when there is already a lock file, and the gems are missing, so try again system_gems [] bundle :install, artifice: "compact_index" - expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") + expect(err).not_to include("Warning: the gem 'myrack' was found in multiple sources.") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0", source: "remote3") end end end context "when a pinned gem has an indirect dependency in a different source" do before do - # In these tests, we need a working rack gem in repo2 and not repo3 + # In these tests, we need a working myrack gem in repo2 and not repo3 build_repo gem_repo3 do - build_gem "depends_on_rack", "1.0.1" do |s| - s.add_dependency "rack" + build_gem "depends_on_myrack", "1.0.1" do |s| + s.add_dependency "myrack" end end build_repo gem_repo2 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end end @@ -303,14 +303,14 @@ RSpec.describe "bundle install with gems on multiple sources" do install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo2" source "https://gem.repo3" do - gem "depends_on_rack" + gem "depends_on_myrack" end G end it "installs from the other source without any warning" do expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0") end end @@ -320,7 +320,7 @@ RSpec.describe "bundle install with gems on multiple sources" do source "https://gem.repo1" source "https://gem.repo2" source "https://gem.repo3" do - gem "depends_on_rack" + gem "depends_on_myrack" end G end @@ -331,9 +331,9 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(err).to eq(<<~E.strip) [DEPRECATED] Your Gemfile contains multiple global sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. Bundler found mismatched checksums. This is a potential security risk. - #{checksum_to_lock(gem_repo2, "rack", "1.0.0")} + #{checksum_to_lock(gem_repo2, "myrack", "1.0.0")} from the API at https://gem.repo2/ - #{checksum_to_lock(gem_repo1, "rack", "1.0.0")} + #{checksum_to_lock(gem_repo1, "myrack", "1.0.0")} from the API at https://gem.repo1/ Mismatched checksums each have an authoritative source: @@ -348,20 +348,20 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "fails when the two sources agree, but the local gem calculates a different checksum", bundler: "< 3" do - rack_checksum = "c0ffee11" * 8 - bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_RACK_CHECKSUM" => rack_checksum }, raise_on_error: false + myrack_checksum = "c0ffee11" * 8 + bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_MYRACK_CHECKSUM" => myrack_checksum }, raise_on_error: false expect(err).to eq(<<~E.strip) [DEPRECATED] Your Gemfile contains multiple global sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. Bundler found mismatched checksums. This is a potential security risk. - rack (1.0.0) sha256=#{rack_checksum} + myrack (1.0.0) sha256=#{myrack_checksum} from the API at https://gem.repo2/ and the API at https://gem.repo1/ - #{checksum_to_lock(gem_repo2, "rack", "1.0.0")} - from the gem at #{default_bundle_path("cache", "rack-1.0.0.gem")} + #{checksum_to_lock(gem_repo2, "myrack", "1.0.0")} + from the gem at #{default_bundle_path("cache", "myrack-1.0.0.gem")} If you trust the API at https://gem.repo2/, to resolve this issue you can: - 1. remove the gem at #{default_bundle_path("cache", "rack-1.0.0.gem")} + 1. remove the gem at #{default_bundle_path("cache", "myrack-1.0.0.gem")} 2. run `bundle install` To ignore checksum security warnings, disable checksum validation with @@ -371,15 +371,15 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs from the other source and warns about ambiguous gems when the sources have the same checksum", bundler: "< 3" do - gem_checksum = checksum_digest(gem_repo2, "rack", "1.0.0") - bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_RACK_CHECKSUM" => gem_checksum, "DEBUG" => "1" } + gem_checksum = checksum_digest(gem_repo2, "myrack", "1.0.0") + bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_MYRACK_CHECKSUM" => gem_checksum, "DEBUG" => "1" } - expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include("Warning: the gem 'myrack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo2") checksums = checksums_section_when_existing do |c| - c.checksum gem_repo3, "depends_on_rack", "1.0.1" - c.checksum gem_repo2, "rack", "1.0.0" + c.checksum gem_repo3, "depends_on_myrack", "1.0.1" + c.checksum gem_repo2, "myrack", "1.0.0" end expect(lockfile).to eq <<~L @@ -387,26 +387,26 @@ RSpec.describe "bundle install with gems on multiple sources" do remote: https://gem.repo1/ remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) GEM remote: https://gem.repo3/ specs: - depends_on_rack (1.0.1) - rack + depends_on_myrack (1.0.1) + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES - depends_on_rack! + depends_on_myrack! #{checksums} BUNDLED WITH #{Bundler::VERSION} L previous_lockfile = lockfile - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0") expect(lockfile).to eq(previous_lockfile) end @@ -414,12 +414,12 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "config set --local disable_checksum_validation true" bundle :install, artifice: "compact_index" - expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include("Warning: the gem 'myrack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo2") checksums = checksums_section_when_existing do |c| - c.no_checksum "depends_on_rack", "1.0.1" - c.no_checksum "rack", "1.0.0" + c.no_checksum "depends_on_myrack", "1.0.1" + c.no_checksum "myrack", "1.0.0" end expect(lockfile).to eq <<~L @@ -427,26 +427,26 @@ RSpec.describe "bundle install with gems on multiple sources" do remote: https://gem.repo1/ remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) GEM remote: https://gem.repo3/ specs: - depends_on_rack (1.0.1) - rack + depends_on_myrack (1.0.1) + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES - depends_on_rack! + depends_on_myrack! #{checksums} BUNDLED WITH #{Bundler::VERSION} L previous_lockfile = lockfile - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0") expect(lockfile).to eq(previous_lockfile) end @@ -461,33 +461,33 @@ RSpec.describe "bundle install with gems on multiple sources" do before do # need this to be broken to check for correct source ordering build_repo gem_repo2 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0" do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end end gemfile <<-G - source "https://gem.repo3" # contains depends_on_rack - source "https://gem.repo2" # contains broken rack + source "https://gem.repo3" # contains depends_on_myrack + source "https://gem.repo2" # contains broken myrack - gem "depends_on_rack" # installed from gem_repo3 - gem "rack", :source => "https://gem.repo1" + gem "depends_on_myrack" # installed from gem_repo3 + gem "myrack", :source => "https://gem.repo1" G end it "installs the dependency from the pinned source without warning", bundler: "< 3" do bundle :install, artifice: "compact_index" - expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") + expect(err).not_to include("Warning: the gem 'myrack' was found in multiple sources.") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0") # In https://github.com/rubygems/bundler/issues/3585 this failed # when there is already a lock file, and the gems are missing, so try again system_gems [] bundle :install, artifice: "compact_index" - expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") + expect(err).not_to include("Warning: the gem 'myrack' was found in multiple sources.") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0") end it "fails", bundler: "3" do @@ -560,8 +560,8 @@ RSpec.describe "bundle install with gems on multiple sources" do context "when a top-level gem has an indirect dependency" do before do build_repo gem_repo2 do - build_gem "depends_on_rack", "1.0.1" do |s| - s.add_dependency "rack" + build_gem "depends_on_myrack", "1.0.1" do |s| + s.add_dependency "myrack" end end @@ -572,7 +572,7 @@ RSpec.describe "bundle install with gems on multiple sources" do gemfile <<-G source "https://gem.repo2" - gem "depends_on_rack" + gem "depends_on_myrack" source "https://gem.repo3" do gem "unrelated_gem" @@ -583,15 +583,15 @@ RSpec.describe "bundle install with gems on multiple sources" do context "and the dependency is only in the top-level source" do before do update_repo gem_repo2 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end end it "installs the dependency from the top-level source without warning" do bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote2") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0", "unrelated_gem 1.0.0") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0", source: "remote2") expect(the_bundle).to include_gems("unrelated_gem 1.0.0", source: "remote3") end end @@ -599,8 +599,8 @@ RSpec.describe "bundle install with gems on multiple sources" do context "and the dependency is only in a pinned source" do before do update_repo gem_repo3 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0" do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end end end @@ -610,10 +610,10 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(err).to end_with <<~E.strip Could not find compatible versions - Because every version of depends_on_rack depends on rack >= 0 - and rack >= 0 could not be found in rubygems repository https://gem.repo2/ or installed locally, - depends_on_rack cannot be used. - So, because Gemfile depends on depends_on_rack >= 0, + Because every version of depends_on_myrack depends on myrack >= 0 + and myrack >= 0 could not be found in rubygems repository https://gem.repo2/ or installed locally, + depends_on_myrack cannot be used. + So, because Gemfile depends on depends_on_myrack >= 0, version solving has failed. E end @@ -622,12 +622,12 @@ RSpec.describe "bundle install with gems on multiple sources" do context "and the dependency is in both the top-level and a pinned source" do before do update_repo gem_repo2 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end update_repo gem_repo3 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0" do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end end end @@ -635,9 +635,9 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs the dependency from the top-level source without warning" do bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") - expect(run("require 'rack'; puts RACK")).to eq("1.0.0") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote2") + expect(run("require 'myrack'; puts MYRACK")).to eq("1.0.0") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0", "unrelated_gem 1.0.0") + expect(the_bundle).to include_gems("depends_on_myrack 1.0.1", "myrack 1.0.0", source: "remote2") expect(the_bundle).to include_gems("unrelated_gem 1.0.0", source: "remote3") end end @@ -646,12 +646,12 @@ RSpec.describe "bundle install with gems on multiple sources" do context "when a scoped gem has a deeply nested indirect dependency" do before do build_repo gem_repo3 do - build_gem "depends_on_depends_on_rack", "1.0.1" do |s| - s.add_dependency "depends_on_rack" + build_gem "depends_on_depends_on_myrack", "1.0.1" do |s| + s.add_dependency "depends_on_myrack" end - build_gem "depends_on_rack", "1.0.1" do |s| - s.add_dependency "rack" + build_gem "depends_on_myrack", "1.0.1" do |s| + s.add_dependency "myrack" end end @@ -659,7 +659,7 @@ RSpec.describe "bundle install with gems on multiple sources" do source "https://gem.repo2" source "https://gem.repo3" do - gem "depends_on_depends_on_rack" + gem "depends_on_depends_on_myrack" end G end @@ -667,15 +667,15 @@ RSpec.describe "bundle install with gems on multiple sources" do context "and the dependency is only in the top-level source" do before do update_repo gem_repo2 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end end it "installs the dependency from the top-level source" do bundle :install, artifice: "compact_index" - expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0") - expect(the_bundle).to include_gems("rack 1.0.0", source: "remote2") - expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", source: "remote3") + expect(the_bundle).to include_gems("depends_on_depends_on_myrack 1.0.1", "depends_on_myrack 1.0.1", "myrack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0", source: "remote2") + expect(the_bundle).to include_gems("depends_on_depends_on_myrack 1.0.1", "depends_on_myrack 1.0.1", source: "remote3") end end @@ -684,32 +684,32 @@ RSpec.describe "bundle install with gems on multiple sources" do build_repo2 update_repo gem_repo3 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end end it "installs the dependency from the pinned source" do bundle :install, artifice: "compact_index" - expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") + expect(the_bundle).to include_gems("depends_on_depends_on_myrack 1.0.1", "depends_on_myrack 1.0.1", "myrack 1.0.0", source: "remote3") end end context "and the dependency is in both the top-level and a pinned source" do before do update_repo gem_repo2 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0.0" do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end end update_repo gem_repo3 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end end it "installs the dependency from the pinned source without warning" do bundle :install, artifice: "compact_index" - expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") + expect(the_bundle).to include_gems("depends_on_depends_on_myrack 1.0.1", "depends_on_myrack 1.0.1", "myrack 1.0.0", source: "remote3") end end end @@ -742,12 +742,12 @@ RSpec.describe "bundle install with gems on multiple sources" do end build_gem "minitest", "5.14.3" - build_gem "rack", "2.2.3" + build_gem "myrack", "2.2.3" build_gem "redis", "4.2.5" build_gem "sidekiq", "6.1.3" do |s| s.add_dependency "connection_pool", ">= 2.2.2" - s.add_dependency "rack", "~> 2.0" + s.add_dependency "myrack", "~> 2.0" s.add_dependency "redis", ">= 4.2.0" end @@ -789,7 +789,7 @@ RSpec.describe "bundle install with gems on multiple sources" do c.checksum gem_repo2, "connection_pool", "2.2.3" c.checksum gem_repo2, "i18n", "1.8.9" c.checksum gem_repo2, "minitest", "5.14.3" - c.checksum gem_repo2, "rack", "2.2.3" + c.checksum gem_repo2, "myrack", "2.2.3" c.checksum gem_repo2, "redis", "4.2.5" c.checksum gem_repo2, "sidekiq", "6.1.3" c.checksum gem_repo3, "sidekiq-pro", "5.2.1" @@ -814,11 +814,11 @@ RSpec.describe "bundle install with gems on multiple sources" do i18n (1.8.9) concurrent-ruby (~> 1.0) minitest (5.14.3) - rack (2.2.3) + myrack (2.2.3) redis (4.2.5) sidekiq (6.1.3) connection_pool (>= 2.2.2) - rack (~> 2.0) + myrack (~> 2.0) redis (>= 4.2.0) sidekiq-pro (5.2.1) connection_pool (>= 2.2.3) @@ -866,11 +866,11 @@ RSpec.describe "bundle install with gems on multiple sources" do i18n (1.8.9) concurrent-ruby (~> 1.0) minitest (5.14.3) - rack (2.2.3) + myrack (2.2.3) redis (4.2.5) sidekiq (6.1.3) connection_pool (>= 2.2.2) - rack (~> 2.0) + myrack (~> 2.0) redis (>= 4.2.0) thread_safe (0.3.6) tzinfo (1.2.9) @@ -957,11 +957,11 @@ RSpec.describe "bundle install with gems on multiple sources" do i18n (1.8.9) concurrent-ruby (~> 1.0) minitest (5.14.3) - rack (2.2.3) + myrack (2.2.3) redis (4.2.5) sidekiq (6.1.3) connection_pool (>= 2.2.2) - rack (~> 2.0) + myrack (~> 2.0) redis (>= 4.2.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) @@ -1014,11 +1014,11 @@ RSpec.describe "bundle install with gems on multiple sources" do i18n (1.8.9) concurrent-ruby (~> 1.0) minitest (5.14.3) - rack (2.2.3) + myrack (2.2.3) redis (4.2.5) sidekiq (6.1.3) connection_pool (>= 2.2.2) - rack (~> 2.0) + myrack (~> 2.0) redis (>= 4.2.0) thread_safe (0.3.6) tzinfo (1.2.9) @@ -1174,7 +1174,7 @@ RSpec.describe "bundle install with gems on multiple sources" do context "with an existing lockfile" do before do - system_gems "rack-0.9.1", "rack-1.0.0", path: default_bundle_path + system_gems "myrack-0.9.1", "myrack-1.0.0", path: default_bundle_path lockfile <<-L GEM @@ -1184,26 +1184,26 @@ RSpec.describe "bundle install with gems on multiple sources" do GEM remote: https://gem.repo3 specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack! + myrack! L gemfile <<-G source "https://gem.repo1" source "https://gem.repo3" do - gem 'rack' + gem 'myrack' end G end # Reproduction of https://github.com/rubygems/bundler/issues/3298 it "does not unlock the installed gem on exec" do - expect(the_bundle).to include_gems("rack 0.9.1") + expect(the_bundle).to include_gems("myrack 0.9.1") end end @@ -1214,13 +1214,13 @@ RSpec.describe "bundle install with gems on multiple sources" do remote: https://gem.repo1/ remote: https://gem.repo3/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack! + myrack! #{checksums_section} BUNDLED WITH #{Bundler::VERSION} @@ -1236,13 +1236,13 @@ RSpec.describe "bundle install with gems on multiple sources" do GEM remote: https://gem.repo3/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack! + myrack! BUNDLED WITH #{Bundler::VERSION} @@ -1251,13 +1251,13 @@ RSpec.describe "bundle install with gems on multiple sources" do before do build_repo gem_repo3 do - build_gem "rack", "0.9.1" + build_gem "myrack", "0.9.1" end gemfile <<-G source "https://gem.repo1" source "https://gem.repo3" do - gem 'rack' + gem 'myrack' end G @@ -1272,7 +1272,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(aggregate_gem_section_lockfile) expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.") - expect(the_bundle).to include_gems("rack 0.9.1", source: "remote3") + expect(the_bundle).to include_gems("myrack 0.9.1", source: "remote3") end it "prints a checksum warning when the checksums from both sources do not match", bundler: "< 3" do @@ -1280,16 +1280,16 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "install", artifice: "compact_index", raise_on_error: false - api_checksum1 = checksum_digest(gem_repo1, "rack", "0.9.1") - api_checksum3 = checksum_digest(gem_repo3, "rack", "0.9.1") + api_checksum1 = checksum_digest(gem_repo1, "myrack", "0.9.1") + api_checksum3 = checksum_digest(gem_repo3, "myrack", "0.9.1") expect(exitstatus).to eq(37) expect(err).to eq(<<~E.strip) [DEPRECATED] Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure. Bundler found mismatched checksums. This is a potential security risk. - rack (0.9.1) sha256=#{api_checksum3} + myrack (0.9.1) sha256=#{api_checksum3} from the API at https://gem.repo3/ - rack (0.9.1) sha256=#{api_checksum1} + myrack (0.9.1) sha256=#{api_checksum1} from the API at https://gem.repo1/ Mismatched checksums each have an authoritative source: @@ -1318,8 +1318,8 @@ RSpec.describe "bundle install with gems on multiple sources" do build_lib "foo" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :source => "https://gem.repo1" + source "https://gem.repo1" + gem "myrack", :source => "https://gem.repo1" gem "foo", :path => "#{lib_path("foo-1.0")}" G end @@ -1336,17 +1336,17 @@ RSpec.describe "bundle install with gems on multiple sources" do context "when an older version of the same gem also ships with Ruby" do before do - system_gems "rack-0.9.1" + system_gems "myrack-0.9.1" install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" - gem "rack" # should come from repo1! + gem "myrack" # should come from repo1! G end it "installs the gems without any warning" do expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("rack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0") end end @@ -1361,7 +1361,7 @@ RSpec.describe "bundle install with gems on multiple sources" do # Installing this gemfile... gemfile <<-G source 'https://gem.repo1' - gem 'rack' + gem 'myrack' gem 'foo', '~> 0.1', :source => 'https://gem.repo4' gem 'bar', '~> 0.1', :source => 'https://gem.repo4' G @@ -1380,7 +1380,7 @@ RSpec.describe "bundle install with gems on multiple sources" do # And install this gemfile, updating only foo. install_gemfile <<-G, artifice: "compact_index" source 'https://gem.repo1' - gem 'rack' + gem 'myrack' gem 'foo', '~> 0.2', :source => 'https://gem.repo4' gem 'bar', '~> 0.1', :source => 'https://gem.repo4' G @@ -1394,7 +1394,7 @@ RSpec.describe "bundle install with gems on multiple sources" do context "when there is a mix of sources in the gemfile" do before do build_repo gem_repo3 do - build_gem "rack" + build_gem "myrack" end build_lib "path1" @@ -1407,7 +1407,7 @@ RSpec.describe "bundle install with gems on multiple sources" do gem "rails" source "https://gem.repo3" do - gem "rack" + gem "myrack" end gem "path1", :path => "#{lib_path("path1-1.0")}" @@ -1429,14 +1429,14 @@ RSpec.describe "bundle install with gems on multiple sources" do before do install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" - gem "rack" + gem "myrack" G end context "and the gemfile changes" do it "is still able to find that gem from remote sources" do build_repo4 do - build_gem "rack", "2.0.1.1.forked" + build_gem "myrack", "2.0.1.1.forked" build_gem "thor", "0.19.1.1.forked" end @@ -1445,10 +1445,10 @@ RSpec.describe "bundle install with gems on multiple sources" do source "https://gem.repo1" source "https://gem.repo4" do - gem "rack", "2.0.1.1.forked" + gem "myrack", "2.0.1.1.forked" gem "thor" end - gem "rack-obama" + gem "myrack-obama" G # Then we change the Gemfile by adding a version to thor @@ -1456,13 +1456,13 @@ RSpec.describe "bundle install with gems on multiple sources" do source "https://gem.repo1" source "https://gem.repo4" do - gem "rack", "2.0.1.1.forked" + gem "myrack", "2.0.1.1.forked" gem "thor", "0.19.1.1.forked" end - gem "rack-obama" + gem "myrack-obama" G - # But we should still be able to find rack 2.0.1.1.forked and install it + # But we should still be able to find myrack 2.0.1.1.forked and install it bundle :install, artifice: "compact_index" end end @@ -1473,12 +1473,12 @@ RSpec.describe "bundle install with gems on multiple sources" do install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" - gem "rack" + gem "myrack" G build_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end build_gem "bar" @@ -1490,13 +1490,13 @@ RSpec.describe "bundle install with gems on multiple sources" do install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo2" - gem "rack" + gem "myrack" gemspec :path => "#{tmp("gemspec_test")}" G end it "conservatively installs the existing locked version" do - expect(the_bundle).to include_gems("rack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0") end end @@ -1586,27 +1586,27 @@ RSpec.describe "bundle install with gems on multiple sources" do context "when an indirect dependency is available from multiple ambiguous sources", bundler: "< 3" do it "succeeds but warns, suggesting a source block" do build_repo4 do - build_gem "depends_on_rack" do |s| - s.add_dependency "rack" + build_gem "depends_on_myrack" do |s| + s.add_dependency "myrack" end - build_gem "rack" + build_gem "myrack" end - install_gemfile <<-G, artifice: "compact_index", raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + install_gemfile <<-G, artifice: "compact_index_extra_api", raise_on_error: false + source "https://global.source" - source "https://gem.repo4" do - gem "depends_on_rack" + source "https://scoped.source/extra" do + gem "depends_on_myrack" end - source "https://gem.repo1" do + source "https://scoped.source" do gem "thin" end G expect(err).to eq <<~EOS.strip - Warning: The gem 'rack' was found in multiple relevant sources. - * rubygems repository https://gem.repo1/ - * rubygems repository https://gem.repo4/ + Warning: The gem 'myrack' was found in multiple relevant sources. + * rubygems repository https://scoped.source/ + * rubygems repository https://scoped.source/extra/ You should add this gem to the source block for the source you wish it to be installed from. EOS expect(last_command).to be_success @@ -1617,26 +1617,28 @@ RSpec.describe "bundle install with gems on multiple sources" do context "when an indirect dependency is available from multiple ambiguous sources", bundler: "3" do it "raises, suggesting a source block" do build_repo4 do - build_gem "depends_on_rack" do |s| - s.add_dependency "rack" + build_gem "depends_on_myrack" do |s| + s.add_dependency "myrack" end - build_gem "rack" + build_gem "myrack" end - install_gemfile <<-G, artifice: "compact_index", raise_on_error: false - source "#{file_uri_for(gem_repo1)}" - source "https://gem.repo4" do - gem "depends_on_rack" + install_gemfile <<-G, artifice: "compact_index_extra_api", raise_on_error: false + source "https://global.source" + + source "https://scoped.source/extra" do + gem "depends_on_myrack" end - source "https://gem.repo1" do + + source "https://scoped.source" do gem "thin" end G expect(last_command).to be_failure expect(err).to eq <<~EOS.strip - The gem 'rack' was found in multiple relevant sources. - * rubygems repository https://gem.repo1/ - * rubygems repository https://gem.repo4/ + The gem 'myrack' was found in multiple relevant sources. + * rubygems repository https://scoped.source/ + * rubygems repository https://scoped.source/extra/ You must add this gem to the source block for the source you wish it to be installed from. EOS expect(the_bundle).not_to be_locked diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb index 1fa970e244..89a2719b4e 100644 --- a/spec/bundler/install/gemfile/specific_platform_spec.rb +++ b/spec/bundler/install/gemfile/specific_platform_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "bundle install with specific platforms" do let(:google_protobuf) { <<-G } - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "google-protobuf" G @@ -33,7 +33,7 @@ RSpec.describe "bundle install with specific platforms" do # simulate lockfile created with old bundler, which only locks for ruby platform lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: google-protobuf (3.0.0.alpha.5.0.5.1) @@ -73,7 +73,7 @@ RSpec.describe "bundle install with specific platforms" do # simulate lockfile created with old bundler, which only locks for ruby platform lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: google-protobuf (3.0.0.alpha.4.0) @@ -97,7 +97,7 @@ RSpec.describe "bundle install with specific platforms" do # make sure we're still only locked to ruby expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: google-protobuf (3.0.0.alpha.5.0.5.1) @@ -124,14 +124,14 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.3.10) @@ -268,7 +268,7 @@ RSpec.describe "bundle install with specific platforms" do git = build_git "pg_array_parser", "1.0" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "pg_array_parser", :git => "#{lib_path("pg_array_parser-1.0")}" G @@ -304,7 +304,7 @@ RSpec.describe "bundle install with specific platforms" do simulate_platform "x86_64-darwin-15" do setup_multiplatform_gem_with_different_dependencies_per_platform install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "facter" G allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) @@ -358,14 +358,14 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "sorbet-static", "0.5.6403" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: sorbet-static (0.5.6403-#{Bundler.local_platform}) @@ -389,13 +389,13 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "sorbet-static", "0.5.6433" G error_message = <<~ERROR.strip - Could not find gem 'sorbet-static (= 0.5.6433)' with platform 'arm64-darwin-21' in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally. + Could not find gem 'sorbet-static (= 0.5.6433)' with platform 'arm64-darwin-21' in rubygems repository https://gem.repo4/ or installed locally. The source contains the following gems matching 'sorbet-static (= 0.5.6433)': * sorbet-static-0.5.6433-universal-darwin-20 @@ -425,7 +425,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "sorbet", "0.5.6433" G @@ -434,7 +434,7 @@ RSpec.describe "bundle install with specific platforms" do Could not find compatible versions Because every version of sorbet depends on sorbet-static = 0.5.6433 - and sorbet-static = 0.5.6433 could not be found in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally for any resolution platforms (arm64-darwin-21), + and sorbet-static = 0.5.6433 could not be found in rubygems repository https://gem.repo4/ or installed locally for any resolution platforms (arm64-darwin-21), sorbet cannot be used. So, because Gemfile depends on sorbet = 0.5.6433, version solving has failed. @@ -465,7 +465,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "sorbet-static", "0.5.9889" G @@ -473,7 +473,7 @@ RSpec.describe "bundle install with specific platforms" do bundle "lock", raise_on_error: false, env: { "BUNDLE_FORCE_RUBY_PLATFORM" => "true" } expect(err).to include <<~ERROR.rstrip - Could not find gem 'sorbet-static (= 0.5.9889)' with platform 'ruby' in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally. + Could not find gem 'sorbet-static (= 0.5.9889)' with platform 'ruby' in rubygems repository https://gem.repo4/ or installed locally. The source contains the following gems matching 'sorbet-static (= 0.5.9889)': * sorbet-static-0.5.9889-#{Gem::Platform.local} @@ -499,14 +499,14 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "sorbet-static-and-runtime" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sorbet (0.5.10160) sorbet-static (= 0.5.10160) @@ -537,7 +537,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sorbet (0.5.10160) sorbet-static (= 0.5.10160) @@ -577,7 +577,7 @@ RSpec.describe "bundle install with specific platforms" do simulate_platform "x86_64-darwin-22" do install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" gem "sorbet-static" @@ -591,7 +591,7 @@ RSpec.describe "bundle install with specific platforms" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.12.0) nokogiri (1.12.0-x86_64-darwin) @@ -615,7 +615,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.13.0-x86_64-darwin) sorbet-static (0.5.10601-x86_64-darwin) @@ -651,14 +651,14 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "sorbet-static-and-runtime" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sorbet (0.5.10160) sorbet-static (= 0.5.10160) @@ -689,7 +689,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sorbet (0.5.10160) sorbet-static (= 0.5.10160) @@ -726,7 +726,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" gem "sorbet-static" @@ -734,7 +734,7 @@ RSpec.describe "bundle install with specific platforms" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.14.0-arm-linux) nokogiri (1.14.0-x86_64-linux) @@ -762,7 +762,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.14.0-x86_64-linux) sorbet-static (0.5.10696-x86_64-linux) @@ -794,7 +794,7 @@ RSpec.describe "bundle install with specific platforms" do # Make sure sorbet-static-0.5.10549-universal-darwin-21 is installed install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "sorbet-static", "= 0.5.10549" G @@ -807,7 +807,7 @@ RSpec.describe "bundle install with specific platforms" do # Make sure the lockfile is missing sorbet-static-0.5.10549-universal-darwin-21 lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sorbet-static (0.5.10549-universal-darwin-20) @@ -827,7 +827,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sorbet-static (0.5.10549-universal-darwin-20) sorbet-static (0.5.10549-universal-darwin-21) @@ -856,14 +856,14 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "ibandit", "~> 0.7.0" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: i18n (0.7.0.beta1) ibandit (0.7.0) @@ -883,7 +883,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: i18n (0.7.0) ibandit (0.7.0) @@ -910,16 +910,21 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" gem "tzinfo", "~> 1.2", platform: :#{not_local_tag} G + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "nokogiri", "1.13.8" + c.checksum gem_repo4, "nokogiri", "1.13.8", Gem::Platform.local + end + original_lockfile = <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.13.8) nokogiri (1.13.8-#{Gem::Platform.local}) @@ -930,9 +935,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri tzinfo (~> 1.2) - - CHECKSUMS - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -941,14 +944,9 @@ RSpec.describe "bundle install with specific platforms" do bundle "lock --update" - checksums = checksums_section_when_existing do |c| - c.no_checksum "nokogiri", "1.13.8" - c.no_checksum "nokogiri", "1.13.8", Gem::Platform.local - end - updated_lockfile = <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.13.8) nokogiri (1.13.8-#{Gem::Platform.local}) @@ -970,24 +968,24 @@ RSpec.describe "bundle install with specific platforms" do it "does not remove ruby when adding a new gem to the Gemfile" do build_repo4 do build_gem "concurrent-ruby", "1.2.2" - build_gem "rack", "3.0.7" + build_gem "myrack", "3.0.7" end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "concurrent-ruby" - gem "rack" + gem "myrack" G checksums = checksums_section_when_existing do |c| c.no_checksum "concurrent-ruby", "1.2.2" - c.no_checksum "rack", "3.0.7" + c.no_checksum "myrack", "3.0.7" end lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: concurrent-ruby (1.2.2) @@ -1005,17 +1003,17 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: concurrent-ruby (1.2.2) - rack (3.0.7) + myrack (3.0.7) PLATFORMS #{lockfile_platforms("ruby", generic_local_platform, defaults: [])} DEPENDENCIES concurrent-ruby - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1025,10 +1023,8 @@ RSpec.describe "bundle install with specific platforms" do it "can fallback to a source gem when platform gems are incompatible with current ruby version" do setup_multiplatform_gem_with_source_gem - source = file_uri_for(gem_repo2) - gemfile <<~G - source "#{source}" + source "https://gem.repo2" gem "my-precompiled-gem" G @@ -1038,7 +1034,7 @@ RSpec.describe "bundle install with specific platforms" do # - A source gem with compatible ruby version lockfile <<-L GEM - remote: #{source}/ + remote: https://gem.repo2/ specs: my-precompiled-gem (3.0.0) my-precompiled-gem (3.0.0-#{Bundler.local_platform}) @@ -1074,7 +1070,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri", "1.14.0" G @@ -1085,7 +1081,7 @@ RSpec.describe "bundle install with specific platforms" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.14.0-x86_64-linux) @@ -1107,7 +1103,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq(<<~L) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.14.0) @@ -1136,14 +1132,14 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "sorbet" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: PLATFORMS @@ -1159,7 +1155,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sorbet (0.5.10160) sorbet-static (= 0.5.10160) @@ -1203,7 +1199,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" G @@ -1219,7 +1215,7 @@ RSpec.describe "bundle install with specific platforms" do # locks all compatible platforms, excluding Java and Windows expect(lockfile).to eq(<<~L) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.14.0) nokogiri (1.14.0-arm-linux) @@ -1238,7 +1234,7 @@ RSpec.describe "bundle install with specific platforms" do L gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" gem "sorbet-static" @@ -1255,7 +1251,7 @@ RSpec.describe "bundle install with specific platforms" do # locks only platforms compatible with all gems in the bundle expect(lockfile).to eq(<<~L) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.14.0) nokogiri (1.14.0-x86_64-linux) @@ -1293,7 +1289,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" gem "sass-embedded" @@ -1311,7 +1307,7 @@ RSpec.describe "bundle install with specific platforms" do # locks all compatible platforms, excluding Java and Windows expect(lockfile).to eq(<<~L) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.15.5) sass-embedded (1.69.5) @@ -1343,7 +1339,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" G @@ -1357,7 +1353,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq(<<~L) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.15.5-x86_64-linux) @@ -1387,7 +1383,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "rcee_precompiled", "0.5.0" G @@ -1397,7 +1393,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq(<<~L) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: rcee_precompiled (0.5.0-x86_64-linux) rcee_precompiled (0.5.0-x86_64-linux-musl) @@ -1429,7 +1425,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "rcee_precompiled", "0.5.0" G @@ -1439,7 +1435,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq(<<~L) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: rcee_precompiled (0.5.0-x86_64-linux-gnu) rcee_precompiled (0.5.0-x86_64-linux-musl) @@ -1465,7 +1461,7 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "rcee_precompiled", "0.5.0" G @@ -1475,7 +1471,7 @@ RSpec.describe "bundle install with specific platforms" do expect(lockfile).to eq(<<~L) GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: rcee_precompiled (0.5.0-universal-darwin) @@ -1497,14 +1493,14 @@ RSpec.describe "bundle install with specific platforms" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.0) diff --git a/spec/bundler/install/gemfile_spec.rb b/spec/bundler/install/gemfile_spec.rb index 158645d3eb..0539733d5d 100644 --- a/spec/bundler/install/gemfile_spec.rb +++ b/spec/bundler/install/gemfile_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle install" do context "with duplicated gems" do it "will display a warning" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'rails', '~> 4.0.0' gem 'rails', '~> 4.0.0' @@ -16,8 +16,8 @@ RSpec.describe "bundle install" do context "with --gemfile" do it "finds the gemfile" do gemfile bundled_app("NotGemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle :install, gemfile: bundled_app("NotGemfile") @@ -25,15 +25,15 @@ RSpec.describe "bundle install" do # Specify BUNDLE_GEMFILE for `the_bundle` # to retrieve the proper Gemfile ENV["BUNDLE_GEMFILE"] = "NotGemfile" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end context "with gemfile set via config" do before do gemfile bundled_app("NotGemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle "config set --local gemfile #{bundled_app("NotGemfile")}" @@ -42,34 +42,34 @@ RSpec.describe "bundle install" do bundle "install" bundle "list" - expect(out).to include("rack (1.0.0)") + expect(out).to include("myrack (1.0.0)") end it "uses the gemfile while in a subdirectory" do bundled_app("subdir").mkpath bundle "install", dir: bundled_app("subdir") bundle "list", dir: bundled_app("subdir") - expect(out).to include("rack (1.0.0)") + expect(out).to include("myrack (1.0.0)") end end context "with deprecated features" do it "reports that lib is an invalid option" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack", :lib => "rack" + gem "myrack", :lib => "myrack" G bundle :install, raise_on_error: false - expect(err).to match(/You passed :lib as an option for gem 'rack', but it is invalid/) + expect(err).to match(/You passed :lib as an option for gem 'myrack', but it is invalid/) end end context "with engine specified in symbol", :jruby_only do it "does not raise any error parsing Gemfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "#{RUBY_VERSION}", :engine => :jruby, :engine_version => "#{RUBY_ENGINE_VERSION}" G @@ -78,19 +78,19 @@ RSpec.describe "bundle install" do it "installation succeeds" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" ruby "#{RUBY_VERSION}", :engine => :jruby, :engine_version => "#{RUBY_ENGINE_VERSION}" - gem "rack" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end context "with a Gemfile containing non-US-ASCII characters" do it "reads the Gemfile with the UTF-8 encoding by default" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" str = "Il était une fois ..." puts "The source encoding is: " + str.encoding.name @@ -105,7 +105,7 @@ RSpec.describe "bundle install" do # NOTE: This works thanks to #eval interpreting the magic encoding comment install_gemfile <<-G # encoding: iso-8859-1 - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" str = "Il #{"\xE9".dup.force_encoding("binary")}tait une fois ..." puts "The source encoding is: " + str.encoding.name diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index bd741685d9..30273a6eae 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -7,27 +7,27 @@ RSpec.describe "compact index api" do it "should use the API" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "has a debug mode" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index", env: { "DEBUG_COMPACT_INDEX" => "true" } expect(out).to include("Fetching gem metadata from #{source_uri}") expect(err).to include("[Bundler::CompactIndexClient] available?") expect(err).to include("[Bundler::CompactIndexClient] fetching versions") - expect(err).to include("[Bundler::CompactIndexClient] info(rack)") - expect(err).to include("[Bundler::CompactIndexClient] fetching info/rack") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(err).to include("[Bundler::CompactIndexClient] info(myrack)") + expect(err).to include("[Bundler::CompactIndexClient] fetching info/myrack") + expect(the_bundle).to include_gems "myrack 1.0.0" end it "should URI encode gem names" do @@ -60,22 +60,22 @@ RSpec.describe "compact index api" do it "should handle case sensitivity conflicts" do build_repo4(build_compact_index: false) do - build_gem "rack", "1.0" do |s| - s.add_runtime_dependency("Rack", "0.1") + build_gem "myrack", "1.0" do |s| + s.add_runtime_dependency("Myrack", "0.1") end - build_gem "Rack", "0.1" + build_gem "Myrack", "0.1" end install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" - gem "rack", "1.0" - gem "Rack", "0.1" + gem "myrack", "1.0" + gem "Myrack", "0.1" G # can't use `include_gems` here since the `require` will conflict on a # case-insensitive FS - run "Bundler.require; puts Gem.loaded_specs.values_at('rack', 'Rack').map(&:full_name)" - expect(out).to eq("rack-1.0\nRack-0.1") + run "Bundler.require; puts Gem.loaded_specs.values_at('myrack', 'Myrack').map(&:full_name)" + expect(out).to eq("myrack-1.0\nMyrack-0.1") end it "should handle multiple gem dependencies on the same gem" do @@ -91,7 +91,7 @@ RSpec.describe "compact index api" do it "should use the endpoint when using deployment mode" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index" @@ -99,7 +99,7 @@ RSpec.describe "compact index api" do bundle "config set --local path vendor/bundle" bundle :install, artifice: "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "handles git dependencies that are in rubygems" do @@ -110,7 +110,7 @@ RSpec.describe "compact index api" do gemfile <<-G source "#{source_uri}" - git "#{file_uri_for(lib_path("foo-1.0"))}" do + git "#{lib_path("foo-1.0")}" do gem 'foo' end G @@ -128,7 +128,7 @@ RSpec.describe "compact index api" do gemfile <<-G source "#{source_uri}" - gem 'foo', :git => "#{file_uri_for(lib_path("foo-1.0"))}" + gem 'foo', :git => "#{lib_path("foo-1.0")}" G bundle :install, artifice: "compact_index" @@ -143,7 +143,7 @@ RSpec.describe "compact index api" do build_git "foo" gemfile <<-G source "#{source_uri}" - gem 'foo', :git => "#{file_uri_for(lib_path("foo-1.0"))}" + gem 'foo', :git => "#{lib_path("foo-1.0")}" G bundle "install", artifice: "compact_index" @@ -156,31 +156,31 @@ RSpec.describe "compact index api" do it "falls back when the API URL returns 403 Forbidden" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, verbose: true, artifice: "compact_index_forbidden" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "falls back when the versions endpoint has a checksum mismatch" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, verbose: true, artifice: "compact_index_checksum_mismatch" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(out).to include("The checksum of /versions does not match the checksum provided by the server!") expect(out).to include('Calculated checksums {"sha-256"=>"8KfZiM/fszVkqhP/m5s9lvE6M9xKu4I1bU4Izddp5Ms="} did not match expected {"sha-256"=>"ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="}') - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "shows proper path when permission errors happen", :permissions do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G versions = Pathname.new(Bundler.rubygems.user_home).join( @@ -203,28 +203,28 @@ RSpec.describe "compact index api" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "handles host redirects" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index_host_redirect" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "handles host redirects without Gem::Net::HTTP::Persistent" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G FileUtils.mkdir_p lib_path @@ -242,13 +242,13 @@ RSpec.describe "compact index api" do bundle :install, artifice: "compact_index_host_redirect", requires: [lib_path("disable_net_http_persistent.rb")] expect(out).to_not match(/Too many redirects/) - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "times out when Bundler::Fetcher redirects too much" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index_redirects", raise_on_error: false @@ -259,23 +259,23 @@ RSpec.describe "compact index api" do it "should use the modern index for install" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "install --full-index", artifice: "compact_index" expect(out).to include("Fetching source index from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "should use the modern index for update" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "update --full-index", artifice: "compact_index", all: true expect(out).to include("Fetching source index from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end @@ -303,16 +303,16 @@ RSpec.describe "compact index api" do end end - system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0], gem_repo: gem_repo2 + system_gems %w[myrack-1.0.0 thin-1.0 net_a-1.0], gem_repo: gem_repo2 bundle "config set --local path.system true" ENV["BUNDLER_SPEC_ALL_REQUESTS"] = <<~EOS.strip #{source_uri}/versions - #{source_uri}/info/rack + #{source_uri}/info/myrack EOS install_gemfile <<-G, artifice: "compact_index", verbose: true, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } source "#{source_uri}" - gem "rack" + gem "myrack" G expect(last_command.stdboth).not_to include "Double checking" @@ -357,24 +357,24 @@ RSpec.describe "compact index api" do it "fetches gem versions even when those gems are already installed" do gemfile <<-G source "#{source_uri}" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G bundle :install, artifice: "compact_index_extra_api" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" build_repo4 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end end gemfile <<-G source "#{source_uri}" do; end source "#{source_uri}/extra" - gem "rack", "1.2" + gem "myrack", "1.2" G bundle :install, artifice: "compact_index_extra_api" - expect(the_bundle).to include_gems "rack 1.2" + expect(the_bundle).to include_gems "myrack 1.2" end it "considers all possible versions of dependencies from all api gem sources", bundler: "< 3" do @@ -534,56 +534,56 @@ RSpec.describe "compact index api" do it "installs the binstubs", bundler: "< 3" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "install --binstubs", artifice: "compact_index" - gembin "rackup" + gembin "myrackup" expect(out).to eq("1.0.0") end it "installs the bins when using --path and uses autoclean", bundler: "< 3" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "install --path vendor/bundle", artifice: "compact_index" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "installs the bins when using --path and uses bundle clean", bundler: "< 3" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "install --path vendor/bundle --no-clean", artifice: "compact_index" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "prints post_install_messages" do gemfile <<-G source "#{source_uri}" - gem 'rack-obama' + gem 'myrack-obama' G bundle :install, artifice: "compact_index" - expect(out).to include("Post-install message from rack:") + expect(out).to include("Post-install message from myrack:") end it "should display the post install message for a dependency" do gemfile <<-G source "#{source_uri}" - gem 'rack_middleware' + gem 'myrack_middleware' G bundle :install, artifice: "compact_index" - expect(out).to include("Post-install message from rack:") - expect(out).to include("Rack's post install message") + expect(out).to include("Post-install message from myrack:") + expect(out).to include("Myrack's post install message") end context "when using basic authentication" do @@ -600,53 +600,53 @@ RSpec.describe "compact index api" do it "passes basic authentication details and strips out creds" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index_basic_authentication" expect(out).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "passes basic authentication details and strips out creds also in verbose mode" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, verbose: true, artifice: "compact_index_basic_authentication" expect(out).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "strips http basic auth creds when warning about ambiguous sources", bundler: "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" source "#{file_uri_for(gem_repo1)}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index_basic_authentication" - expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include("Warning: the gem 'myrack' was found in multiple sources.") expect(err).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "does not pass the user / password to different hosts on redirect" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index_creds_diff_host" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end describe "with authentication details in bundle config" do before do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G end @@ -656,7 +656,7 @@ RSpec.describe "compact index api" do bundle :install, artifice: "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "reads authentication details by full url from bundle config" do @@ -666,26 +666,26 @@ RSpec.describe "compact index api" do bundle :install, artifice: "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "should use the API" do bundle "config set #{source_hostname} #{user}:#{password}" bundle :install, artifice: "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "prefers auth supplied in the source uri" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle "config set #{source_hostname} otheruser:wrong" bundle :install, artifice: "compact_index_strict_basic_authentication" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "shows instructions if auth is not provided for the source" do @@ -716,11 +716,11 @@ RSpec.describe "compact index api" do it "passes basic authentication details" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index_basic_authentication" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end end @@ -741,10 +741,10 @@ RSpec.describe "compact index api" do it "explains what to do to get it" do gemfile <<-G source "#{source_uri.gsub(/http/, "https")}" - gem "rack" + gem "myrack" G - bundle :install, env: { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, raise_on_error: false + bundle :install, env: { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, raise_on_error: false, artifice: nil expect(err).to include("OpenSSL") end end @@ -761,7 +761,7 @@ RSpec.describe "compact index api" do end source "#{source_uri.gsub(/http/, "https")}" - gem "rack" + gem "myrack" G bundle :install, raise_on_error: false @@ -778,7 +778,7 @@ RSpec.describe "compact index api" do begin gemfile <<-G source "#{source_uri}" - gem 'rack' + gem 'myrack' G bundle :install, artifice: "compact_index_forbidden" @@ -797,7 +797,7 @@ RSpec.describe "compact index api" do gemfile <<-G source "#{source_uri}" - gem 'rack', '0.9.1' + gem 'myrack', '0.9.1' G # Initial install creates the cached versions file and etag file @@ -809,20 +809,20 @@ RSpec.describe "compact index api" do # Update the Gemfile so we can check subsequent install was successful gemfile <<-G source "#{source_uri}" - gem 'rack', '1.0.0' + gem 'myrack', '1.0.0' G # Second install should match etag bundle :install, artifice: "compact_index_etag_match" expect(versions_etag.binread).to eq(previous_content) - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "performs full update when range is ignored" do gemfile <<-G source "#{source_uri}" - gem 'rack', '0.9.1' + gem 'myrack', '0.9.1' G # Initial install creates the cached versions file and etag file @@ -830,7 +830,7 @@ RSpec.describe "compact index api" do gemfile <<-G source "#{source_uri}" - gem 'rack', '1.0.0' + gem 'myrack', '1.0.0' G versions = Pathname.new(Bundler.rubygems.user_home).join( @@ -843,36 +843,36 @@ RSpec.describe "compact index api" do bundle :install, artifice: "compact_index_range_ignored" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "performs partial update with a non-empty range" do build_repo4 do - build_gem "rack", "0.9.1" + build_gem "myrack", "0.9.1" end # Initial install creates the cached versions file install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" - gem 'rack', '0.9.1' + gem 'myrack', '0.9.1' G update_repo4 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end install_gemfile <<-G, artifice: "compact_index_partial_update", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" - gem 'rack', '1.0.0' + gem 'myrack', '1.0.0' G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "performs partial update while local cache is updated by another process" do gemfile <<-G source "#{source_uri}" - gem 'rack' + gem 'myrack' G # Create a partial cache versions file @@ -886,92 +886,92 @@ RSpec.describe "compact index api" do bundle :install, artifice: "compact_index_concurrent_download" expect(versions.read).to start_with("created_at") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "performs a partial update that fails digest check, then a full update" do build_repo4 do - build_gem "rack", "0.9.1" + build_gem "myrack", "0.9.1" end install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" - gem 'rack', '0.9.1' + gem 'myrack', '0.9.1' G update_repo4 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end install_gemfile <<-G, artifice: "compact_index_partial_update_bad_digest", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" - gem 'rack', '1.0.0' + gem 'myrack', '1.0.0' G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "performs full update if server endpoints serve partial content responses but don't have incremental content and provide no digest" do build_repo4 do - build_gem "rack", "0.9.1" + build_gem "myrack", "0.9.1" end install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" - gem 'rack', '0.9.1' + gem 'myrack', '0.9.1' G update_repo4 do - build_gem "rack", "1.0.0" + build_gem "myrack", "1.0.0" end install_gemfile <<-G, artifice: "compact_index_partial_update_no_digest_not_incremental", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" - gem 'rack', '1.0.0' + gem 'myrack', '1.0.0' G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "performs full update of compact index info cache if range is not satisfiable" do gemfile <<-G source "#{source_uri}" - gem 'rack', '0.9.1' + gem 'myrack', '0.9.1' G bundle :install, artifice: "compact_index" + cache_path = File.join(Bundler.rubygems.user_home, ".bundle", "cache", "compact_index", "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5") + # We must remove the etag so that we don't ignore the range and get a 304 Not Modified. - rake_info_etag_path = File.join(Bundler.rubygems.user_home, ".bundle", "cache", "compact_index", - "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "info-etags", "rack-11690b09f16021ff06a6857d784a1870") - File.unlink(rake_info_etag_path) if File.exist?(rake_info_etag_path) + myrack_info_etag_path = File.join(cache_path, "info-etags", "myrack-92f3313ce5721296f14445c3a6b9c073") + File.unlink(myrack_info_etag_path) if File.exist?(myrack_info_etag_path) - rake_info_path = File.join(Bundler.rubygems.user_home, ".bundle", "cache", "compact_index", - "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "info", "rack") - expected_rack_info_content = File.read(rake_info_path) + myrack_info_path = File.join(cache_path, "info", "myrack") + expected_myrack_info_content = File.read(myrack_info_path) # Modify the cache files to make the range not satisfiable - File.open(rake_info_path, "a") {|f| f << "0.9.2 |checksum:c55b525b421fd833a93171ad3d7f04528ca8e87d99ac273f8933038942a5888c" } + File.open(myrack_info_path, "a") {|f| f << "0.9.2 |checksum:c55b525b421fd833a93171ad3d7f04528ca8e87d99ac273f8933038942a5888c" } # Update the Gemfile so the next install does its normal things gemfile <<-G source "#{source_uri}" - gem 'rack', '1.0.0' + gem 'myrack', '1.0.0' G # The cache files now being longer means the requested range is going to be not satisfiable # Bundler must end up requesting the whole file to fix things up. bundle :install, artifice: "compact_index_range_not_satisfiable" - resulting_rack_info_content = File.read(rake_info_path) + resulting_myrack_info_content = File.read(myrack_info_path) - expect(resulting_rack_info_content).to eq(expected_rack_info_content) + expect(resulting_myrack_info_content).to eq(expected_myrack_info_content) end it "fails gracefully when the source URI has an invalid scheme" do install_gemfile <<-G, raise_on_error: false source "htps://rubygems.org" - gem "rack" + gem "myrack" G expect(exitstatus).to eq(15) expect(err).to end_with(<<-E.strip) @@ -985,7 +985,7 @@ RSpec.describe "compact index api" do GEM remote: #{source_uri} specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS ruby @@ -998,35 +998,35 @@ RSpec.describe "compact index api" do end it "handles checksums from the server in base64" do - api_checksum = checksum_digest(gem_repo1, "rack", "1.0.0") - rack_checksum = [[api_checksum].pack("H*")].pack("m0") - install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_RACK_CHECKSUM" => rack_checksum } + api_checksum = checksum_digest(gem_repo1, "myrack", "1.0.0") + myrack_checksum = [[api_checksum].pack("H*")].pack("m0") + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_MYRACK_CHECKSUM" => myrack_checksum } source "#{source_uri}" - gem "rack" + gem "myrack" G expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems("rack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0") end it "raises when the checksum does not match" do install_gemfile <<-G, artifice: "compact_index_wrong_gem_checksum", raise_on_error: false source "#{source_uri}" - gem "rack" + gem "myrack" G gem_path = if Bundler.feature_flag.global_gem_cache? - default_cache_path.dirname.join("cache", "gems", "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "rack-1.0.0.gem") + default_cache_path.dirname.join("cache", "gems", "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "myrack-1.0.0.gem") else - default_cache_path.dirname.join("rack-1.0.0.gem") + default_cache_path.dirname.join("myrack-1.0.0.gem") end expect(exitstatus).to eq(37) expect(err).to eq <<~E.strip Bundler found mismatched checksums. This is a potential security risk. - rack (1.0.0) sha256=2222222222222222222222222222222222222222222222222222222222222222 + myrack (1.0.0) sha256=2222222222222222222222222222222222222222222222222222222222222222 from the API at http://localgemserver.test/ - #{checksum_to_lock(gem_repo1, "rack", "1.0.0")} + #{checksum_to_lock(gem_repo1, "myrack", "1.0.0")} from the gem at #{gem_path} If you trust the API at http://localgemserver.test/, to resolve this issue you can: @@ -1039,19 +1039,19 @@ RSpec.describe "compact index api" do end it "raises when the checksum is the wrong length" do - install_gemfile <<-G, artifice: "compact_index_wrong_gem_checksum", env: { "BUNDLER_SPEC_RACK_CHECKSUM" => "checksum!", "DEBUG" => "1" }, verbose: true, raise_on_error: false + install_gemfile <<-G, artifice: "compact_index_wrong_gem_checksum", env: { "BUNDLER_SPEC_MYRACK_CHECKSUM" => "checksum!", "DEBUG" => "1" }, verbose: true, raise_on_error: false source "#{source_uri}" - gem "rack" + gem "myrack" G expect(exitstatus).to eq(14) - expect(err).to include('Invalid checksum for rack-0.9.1: "checksum!" is not a valid SHA256 hex or base64 digest') + expect(err).to include('Invalid checksum for myrack-0.9.1: "checksum!" is not a valid SHA256 hex or base64 digest') end it "does not raise when disable_checksum_validation is set" do bundle "config set disable_checksum_validation true" install_gemfile <<-G, artifice: "compact_index_wrong_gem_checksum" source "#{source_uri}" - gem "rack" + gem "myrack" G end end @@ -1060,7 +1060,7 @@ RSpec.describe "compact index api" do install_gemfile <<-G, artifice: "compact_index" File.umask(0000) source "#{source_uri}" - gem "rack" + gem "myrack" G end @@ -1083,7 +1083,7 @@ Running `bundle update rails` should fix the problem. it "does not duplicate specs in the lockfile when updating and a dependency is not installed" do install_gemfile <<-G, artifice: "compact_index" - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" source "#{source_uri}" do gem "rails" gem "activemerchant" diff --git a/spec/bundler/realworld/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_fallback_spec.rb index ee5c0e3d0a..56a71f252b 100644 --- a/spec/bundler/realworld/dependency_api_spec.rb +++ b/spec/bundler/install/gems/dependency_api_fallback_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require_relative "../support/silent_logger" +require_relative "../../support/silent_logger" -RSpec.describe "gemcutter's dependency API", realworld: true do +RSpec.describe "gemcutter's dependency API" do context "when Gemcutter API takes too long to respond" do before do require_rack @@ -10,7 +10,7 @@ RSpec.describe "gemcutter's dependency API", realworld: true do port = find_unused_port @server_uri = "http://127.0.0.1:#{port}" - require_relative "../support/artifice/endpoint_timeout" + require_relative "../../support/artifice/endpoint_timeout" @t = Thread.new do server = Rack::Server.start(app: EndpointTimeout, @@ -34,13 +34,13 @@ RSpec.describe "gemcutter's dependency API", realworld: true do end it "times out and falls back on the modern index" do - install_gemfile <<-G, artifice: nil + install_gemfile <<-G, artifice: nil, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } source "#{@server_uri}" - gem "rack" + gem "myrack" G expect(out).to include("Fetching source index from #{@server_uri}/") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end end diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb index 35468b3a1c..f3c1d9dc60 100644 --- a/spec/bundler/install/gems/dependency_api_spec.rb +++ b/spec/bundler/install/gems/dependency_api_spec.rb @@ -7,12 +7,12 @@ RSpec.describe "gemcutter's dependency API" do it "should use the API" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "should URI encode gem names" do @@ -56,7 +56,7 @@ RSpec.describe "gemcutter's dependency API" do it "should use the endpoint when using deployment mode" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint" @@ -64,7 +64,7 @@ RSpec.describe "gemcutter's dependency API" do bundle "config set --local path vendor/bundle" bundle :install, artifice: "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "handles git dependencies that are in rubygems" do @@ -75,7 +75,7 @@ RSpec.describe "gemcutter's dependency API" do gemfile <<-G source "#{source_uri}" - git "#{file_uri_for(lib_path("foo-1.0"))}" do + git "#{lib_path("foo-1.0")}" do gem 'foo' end G @@ -93,7 +93,7 @@ RSpec.describe "gemcutter's dependency API" do gemfile <<-G source "#{source_uri}" - gem 'foo', :git => "#{file_uri_for(lib_path("foo-1.0"))}" + gem 'foo', :git => "#{lib_path("foo-1.0")}" G bundle :install, artifice: "endpoint" @@ -108,7 +108,7 @@ RSpec.describe "gemcutter's dependency API" do build_git "foo" gemfile <<-G source "#{source_uri}" - gem 'foo', :git => "#{file_uri_for(lib_path("foo-1.0"))}" + gem 'foo', :git => "#{lib_path("foo-1.0")}" G bundle "install", artifice: "endpoint" @@ -147,7 +147,7 @@ RSpec.describe "gemcutter's dependency API" do gem "actionmailer" gem "activeresource" gem "thin" - gem "rack" + gem "myrack" gem "rails" G bundle :install, artifice: "endpoint_fallback" @@ -160,7 +160,7 @@ RSpec.describe "gemcutter's dependency API" do "activeresource 2.3.2", "activesupport 2.3.2", "thin 1.0.0", - "rack 1.0.0", + "myrack 1.0.0", "rails 2.3.2" ) end @@ -168,39 +168,39 @@ RSpec.describe "gemcutter's dependency API" do it "falls back when Gemcutter API doesn't return proper Marshal format" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, verbose: true, artifice: "endpoint_marshal_fail" expect(out).to include("could not fetch from the dependency API, trying the full index") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "falls back when the API URL returns 403 Forbidden" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, verbose: true, artifice: "endpoint_api_forbidden" expect(out).to include("Fetching source index from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "handles host redirects" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint_host_redirect" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "handles host redirects without Gem::Net::HTTP::Persistent" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G FileUtils.mkdir_p lib_path @@ -218,13 +218,13 @@ RSpec.describe "gemcutter's dependency API" do bundle :install, artifice: "endpoint_host_redirect", requires: [lib_path("disable_net_http_persistent.rb")] expect(out).to_not match(/Too many redirects/) - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "timeouts when Bundler::Fetcher redirects too much" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint_redirect", raise_on_error: false @@ -235,23 +235,23 @@ RSpec.describe "gemcutter's dependency API" do it "should use the modern index for install" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "install --full-index", artifice: "endpoint" expect(out).to include("Fetching source index from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "should use the modern index for update" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "update --full-index", artifice: "endpoint", all: true expect(out).to include("Fetching source index from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end @@ -295,23 +295,23 @@ RSpec.describe "gemcutter's dependency API" do it "fetches gem versions even when those gems are already installed" do gemfile <<-G source "#{source_uri}" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G bundle :install, artifice: "endpoint_extra_api" build_repo4 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end end gemfile <<-G source "#{source_uri}" do; end source "#{source_uri}/extra" - gem "rack", "1.2" + gem "myrack", "1.2" G bundle :install, artifice: "endpoint_extra_api" - expect(the_bundle).to include_gems "rack 1.2" + expect(the_bundle).to include_gems "myrack 1.2" end it "considers all possible versions of dependencies from all api gem sources", bundler: "< 3" do @@ -475,56 +475,56 @@ RSpec.describe "gemcutter's dependency API" do it "installs the binstubs", bundler: "< 3" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "install --binstubs", artifice: "endpoint" - gembin "rackup" + gembin "myrackup" expect(out).to eq("1.0.0") end it "installs the bins when using --path and uses autoclean", bundler: "< 3" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "install --path vendor/bundle", artifice: "endpoint" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "installs the bins when using --path and uses bundle clean", bundler: "< 3" do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G bundle "install --path vendor/bundle --no-clean", artifice: "endpoint" - expect(vendored_gems("bin/rackup")).to exist + expect(vendored_gems("bin/myrackup")).to exist end it "prints post_install_messages" do gemfile <<-G source "#{source_uri}" - gem 'rack-obama' + gem 'myrack-obama' G bundle :install, artifice: "endpoint" - expect(out).to include("Post-install message from rack:") + expect(out).to include("Post-install message from myrack:") end it "should display the post install message for a dependency" do gemfile <<-G source "#{source_uri}" - gem 'rack_middleware' + gem 'myrack_middleware' G bundle :install, artifice: "endpoint" - expect(out).to include("Post-install message from rack:") - expect(out).to include("Rack's post install message") + expect(out).to include("Post-install message from myrack:") + expect(out).to include("Myrack's post install message") end context "when using basic authentication" do @@ -541,40 +541,40 @@ RSpec.describe "gemcutter's dependency API" do it "passes basic authentication details and strips out creds" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint_basic_authentication" expect(out).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "passes basic authentication details and strips out creds also in verbose mode" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, verbose: true, artifice: "endpoint_basic_authentication" expect(out).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "strips http basic authentication creds for modern index" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint_marshal_fail_basic_authentication" expect(out).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "strips http basic auth creds when it can't reach the server" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint_500", raise_on_error: false @@ -585,30 +585,30 @@ RSpec.describe "gemcutter's dependency API" do gemfile <<-G source "#{basic_auth_source_uri}" source "#{file_uri_for(gem_repo1)}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint_basic_authentication" - expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include("Warning: the gem 'myrack' was found in multiple sources.") expect(err).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "does not pass the user / password to different hosts on redirect" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint_creds_diff_host" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end describe "with host including dashes" do before do gemfile <<-G source "http://local-gemserver.test" - gem "rack" + gem "myrack" G end @@ -616,7 +616,7 @@ RSpec.describe "gemcutter's dependency API" do bundle :install, artifice: "endpoint_strict_basic_authentication", env: { "BUNDLE_LOCAL___GEMSERVER__TEST" => "#{user}:#{password}" } expect(out).to include("Fetching gem metadata from http://local-gemserver.test") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end @@ -624,7 +624,7 @@ RSpec.describe "gemcutter's dependency API" do before do gemfile <<-G source "#{source_uri}" - gem "rack" + gem "myrack" G end @@ -634,7 +634,7 @@ RSpec.describe "gemcutter's dependency API" do bundle :install, artifice: "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "reads authentication details by full url from bundle config" do @@ -644,26 +644,26 @@ RSpec.describe "gemcutter's dependency API" do bundle :install, artifice: "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "should use the API" do bundle "config set #{source_hostname} #{user}:#{password}" bundle :install, artifice: "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "prefers auth supplied in the source uri" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle "config set #{source_hostname} otheruser:wrong" bundle :install, artifice: "endpoint_strict_basic_authentication" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "shows instructions if auth is not provided for the source" do @@ -685,11 +685,11 @@ RSpec.describe "gemcutter's dependency API" do it "passes basic authentication details" do gemfile <<-G source "#{basic_auth_source_uri}" - gem "rack" + gem "myrack" G bundle :install, artifice: "endpoint_basic_authentication" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end end @@ -710,10 +710,10 @@ RSpec.describe "gemcutter's dependency API" do it "explains what to do to get it" do gemfile <<-G source "#{source_uri.gsub(/http/, "https")}" - gem "rack" + gem "myrack" G - bundle :install, env: { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, raise_on_error: false + bundle :install, artifice: "fail", env: { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, raise_on_error: false expect(err).to include("OpenSSL") end end @@ -730,7 +730,7 @@ RSpec.describe "gemcutter's dependency API" do end source "#{source_uri.gsub(/http/, "https")}" - gem "rack" + gem "myrack" G bundle :install, raise_on_error: false @@ -747,7 +747,7 @@ RSpec.describe "gemcutter's dependency API" do begin gemfile <<-G source "#{source_uri}" - gem 'rack' + gem 'myrack' G bundle "install", artifice: "endpoint_marshal_fail" diff --git a/spec/bundler/install/gems/env_spec.rb b/spec/bundler/install/gems/env_spec.rb index a6dfadcfc8..6d5aa456fe 100644 --- a/spec/bundler/install/gems/env_spec.rb +++ b/spec/bundler/install/gems/env_spec.rb @@ -4,104 +4,104 @@ RSpec.describe "bundle install with ENV conditionals" do describe "when just setting an ENV key as a string" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" env "BUNDLER_TEST" do - gem "rack" + gem "myrack" end G end it "excludes the gems when the ENV variable is not set" do bundle :install - expect(the_bundle).not_to include_gems "rack" + expect(the_bundle).not_to include_gems "myrack" end it "includes the gems when the ENV variable is set" do ENV["BUNDLER_TEST"] = "1" bundle :install - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end describe "when just setting an ENV key as a symbol" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" env :BUNDLER_TEST do - gem "rack" + gem "myrack" end G end it "excludes the gems when the ENV variable is not set" do bundle :install - expect(the_bundle).not_to include_gems "rack" + expect(the_bundle).not_to include_gems "myrack" end it "includes the gems when the ENV variable is set" do ENV["BUNDLER_TEST"] = "1" bundle :install - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end describe "when setting a string to match the env" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" env "BUNDLER_TEST" => "foo" do - gem "rack" + gem "myrack" end G end it "excludes the gems when the ENV variable is not set" do bundle :install - expect(the_bundle).not_to include_gems "rack" + expect(the_bundle).not_to include_gems "myrack" end it "excludes the gems when the ENV variable is set but does not match the condition" do ENV["BUNDLER_TEST"] = "1" bundle :install - expect(the_bundle).not_to include_gems "rack" + expect(the_bundle).not_to include_gems "myrack" end it "includes the gems when the ENV variable is set and matches the condition" do ENV["BUNDLER_TEST"] = "foo" bundle :install - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end describe "when setting a regex to match the env" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" env "BUNDLER_TEST" => /foo/ do - gem "rack" + gem "myrack" end G end it "excludes the gems when the ENV variable is not set" do bundle :install - expect(the_bundle).not_to include_gems "rack" + expect(the_bundle).not_to include_gems "myrack" end it "excludes the gems when the ENV variable is set but does not match the condition" do ENV["BUNDLER_TEST"] = "fo" bundle :install - expect(the_bundle).not_to include_gems "rack" + expect(the_bundle).not_to include_gems "myrack" end it "includes the gems when the ENV variable is set and matches the condition" do ENV["BUNDLER_TEST"] = "foobar" bundle :install - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end end diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb index 5e0c88fc95..cddf84d831 100644 --- a/spec/bundler/install/gems/flex_spec.rb +++ b/spec/bundler/install/gems/flex_spec.rb @@ -3,30 +3,30 @@ RSpec.describe "bundle flex_install" do it "installs the gems as expected" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(the_bundle).to be_locked end it "installs even when the lockfile is invalid" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(the_bundle).to be_locked gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack', '1.0' + source "https://gem.repo1" + gem 'myrack', '1.0' G bundle :install - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(the_bundle).to be_locked end @@ -34,19 +34,19 @@ RSpec.describe "bundle flex_install" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack-obama" + source "https://gem.repo2" + gem "myrack-obama" G - expect(the_bundle).to include_gems "rack 1.0.0", "rack-obama 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0", "myrack-obama 1.0.0" update_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack-obama", "1.0" + source "https://gem.repo2" + gem "myrack-obama", "1.0" G - expect(the_bundle).to include_gems "rack 1.0.0", "rack-obama 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0", "myrack-obama 1.0.0" end describe "adding new gems" do @@ -54,38 +54,38 @@ RSpec.describe "bundle flex_install" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack' + source "https://gem.repo2" + gem 'myrack' G update_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack' + source "https://gem.repo2" + gem 'myrack' gem 'activesupport', '2.3.5' G - expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to include_gems "myrack 1.0.0", "activesupport 2.3.5" end it "keeps child dependencies pinned" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack-obama" + source "https://gem.repo2" + gem "myrack-obama" G update_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack-obama" + source "https://gem.repo2" + gem "myrack-obama" gem "thin" G - expect(the_bundle).to include_gems "rack 1.0.0", "rack-obama 1.0", "thin 1.0" + expect(the_bundle).to include_gems "myrack 1.0.0", "myrack-obama 1.0", "thin 1.0" end end @@ -93,43 +93,43 @@ RSpec.describe "bundle flex_install" do it "removes gems without changing the versions of remaining gems" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack' + source "https://gem.repo2" + gem 'myrack' gem 'activesupport', '2.3.5' G update_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack' + source "https://gem.repo2" + gem 'myrack' G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(the_bundle).not_to include_gems "activesupport 2.3.5" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack' + source "https://gem.repo2" + gem 'myrack' gem 'activesupport', '2.3.2' G - expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.2" + expect(the_bundle).to include_gems "myrack 1.0.0", "activesupport 2.3.2" end it "removes top level dependencies when removed from the Gemfile while leaving other dependencies intact" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack' + source "https://gem.repo2" + gem 'myrack' gem 'activesupport', '2.3.5' G update_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack' + source "https://gem.repo2" + gem 'myrack' G expect(the_bundle).not_to include_gems "activesupport 2.3.5" @@ -138,21 +138,21 @@ RSpec.describe "bundle flex_install" do it "removes child dependencies" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem 'rack-obama' + source "https://gem.repo2" + gem 'myrack-obama' gem 'activesupport' G - expect(the_bundle).to include_gems "rack 1.0.0", "rack-obama 1.0.0", "activesupport 2.3.5" + expect(the_bundle).to include_gems "myrack 1.0.0", "myrack-obama 1.0.0", "activesupport 2.3.5" update_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'activesupport' G expect(the_bundle).to include_gems "activesupport 2.3.5" - expect(the_bundle).not_to include_gems "rack-obama", "rack" + expect(the_bundle).not_to include_gems "myrack-obama", "myrack" end end @@ -160,25 +160,25 @@ RSpec.describe "bundle flex_install" do before(:each) do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack_middleware" + source "https://gem.repo2" + gem "myrack_middleware" G - expect(the_bundle).to include_gems "rack_middleware 1.0", "rack 0.9.1" + expect(the_bundle).to include_gems "myrack_middleware 1.0", "myrack 0.9.1" build_repo2 do - build_gem "rack-obama", "2.0" do |s| - s.add_dependency "rack", "=1.2" + build_gem "myrack-obama", "2.0" do |s| + s.add_dependency "myrack", "=1.2" end - build_gem "rack_middleware", "2.0" do |s| - s.add_dependency "rack", ">=1.0" + build_gem "myrack_middleware", "2.0" do |s| + s.add_dependency "myrack", ">=1.0" end end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack-obama", "2.0" - gem "rack_middleware" + source "https://gem.repo2" + gem "myrack-obama", "2.0" + gem "myrack_middleware" G end @@ -187,7 +187,7 @@ RSpec.describe "bundle flex_install" do ruby <<-RUBY, raise_on_error: false require 'bundler/setup' RUBY - expect(err).to match(/could not find gem 'rack-obama/i) + expect(err).to match(/could not find gem 'myrack-obama/i) end it "discards the locked gems when the Gemfile requires different versions than the lock" do @@ -196,10 +196,10 @@ RSpec.describe "bundle flex_install" do nice_error = <<~E.strip Could not find compatible versions - Because rack-obama >= 2.0 depends on rack = 1.2 - and rack = 1.2 could not be found in rubygems repository #{file_uri_for(gem_repo2)}/ or installed locally, - rack-obama >= 2.0 cannot be used. - So, because Gemfile depends on rack-obama = 2.0, + Because myrack-obama >= 2.0 depends on myrack = 1.2 + and myrack = 1.2 could not be found in rubygems repository https://gem.repo2/ or installed locally, + myrack-obama >= 2.0 cannot be used. + So, because Gemfile depends on myrack-obama = 2.0, version solving has failed. E @@ -211,12 +211,12 @@ RSpec.describe "bundle flex_install" do bundle "config set force_ruby_platform true" bad_error = <<~E.strip - Bundler could not find compatible versions for gem "rack-obama": + Bundler could not find compatible versions for gem "myrack-obama": In Gemfile: - rack-obama (= 2.0) + myrack-obama (= 2.0) E - bundle "update rack_middleware", retry: 0, raise_on_error: false + bundle "update myrack_middleware", retry: 0, raise_on_error: false expect(err).not_to end_with(bad_error) end end @@ -233,12 +233,12 @@ RSpec.describe "bundle flex_install" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "jekyll-feed", "~> 0.12" G gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "github-pages", "~> 226" gem "jekyll-feed", "~> 0.12" G @@ -253,15 +253,15 @@ RSpec.describe "bundle flex_install" do describe "subtler cases" do before :each do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack" + gem "myrack-obama" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" - gem "rack-obama" + source "https://gem.repo1" + gem "myrack", "0.9.1" + gem "myrack-obama" G end @@ -269,24 +269,24 @@ RSpec.describe "bundle flex_install" do bundle "install" checksums = checksums_section_when_existing do |c| - c.checksum gem_repo1, "rack", "0.9.1" - c.checksum gem_repo1, "rack-obama", "1.0" + c.checksum gem_repo1, "myrack", "0.9.1" + c.checksum gem_repo1, "myrack-obama", "1.0" end expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (0.9.1) - rack-obama (1.0) - rack + myrack (0.9.1) + myrack-obama (1.0) + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack (= 0.9.1) - rack-obama + myrack (= 0.9.1) + myrack-obama #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -294,7 +294,7 @@ RSpec.describe "bundle flex_install" do end it "should work when you update" do - bundle "update rack" + bundle "update myrack" end end @@ -302,36 +302,36 @@ RSpec.describe "bundle flex_install" do it "updates the lockfile" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - source "#{file_uri_for(gem_repo2)}" do + source "https://gem.repo1" + source "https://gem.repo2" do end - gem "rack" + gem "myrack" G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo1, "rack", "1.0.0" + c.checksum gem_repo1, "myrack", "1.0.0" end expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -344,17 +344,17 @@ RSpec.describe "bundle flex_install" do before(:each) do build_repo2 do build_gem "capybara", "0.3.9" do |s| - s.add_dependency "rack", ">= 1.0.0" + s.add_dependency "myrack", ">= 1.0.0" end - build_gem "rack", "1.1.0" + build_gem "myrack", "1.1.0" build_gem "rails", "3.0.0.rc4" do |s| - s.add_dependency "rack", "~> 1.1.0" + s.add_dependency "myrack", "~> 1.1.0" end - build_gem "rack", "1.2.1" + build_gem "myrack", "1.2.1" build_gem "rails", "3.0.0" do |s| - s.add_dependency "rack", "~> 1.2.1" + s.add_dependency "myrack", "~> 1.2.1" end end end @@ -362,14 +362,14 @@ RSpec.describe "bundle flex_install" do it "resolves them" do # install Rails 3.0.0.rc install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0.0.rc4" gem "capybara", "0.3.9" G # upgrade Rails to 3.0.0 and then install again install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "rails", "3.0.0" gem "capybara", "0.3.9" G diff --git a/spec/bundler/install/gems/fund_spec.rb b/spec/bundler/install/gems/fund_spec.rb index c0d72b9c50..0855a62b86 100644 --- a/spec/bundler/install/gems/fund_spec.rb +++ b/spec/bundler/install/gems/fund_spec.rb @@ -31,21 +31,21 @@ RSpec.describe "bundle install" do context "when gems include a fund URI" do it "displays the plural fund message after installing" do - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo2" gem 'has_funding_and_other_metadata' gem 'has_funding' - gem 'rack-obama' + gem 'myrack-obama' G expect(out).to include("2 installed gems you directly depend on are looking for funding.") end it "displays the singular fund message after installing" do - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo2" gem 'has_funding' - gem 'rack-obama' + gem 'myrack-obama' G expect(out).to include("1 installed gem you directly depend on is looking for funding.") @@ -58,21 +58,21 @@ RSpec.describe "bundle install" do end it "does not display the plural fund message after installing" do - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo2" gem 'has_funding_and_other_metadata' gem 'has_funding' - gem 'rack-obama' + gem 'myrack-obama' G expect(out).not_to include("2 installed gems you directly depend on are looking for funding.") end it "does not display the singular fund message after installing" do - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo2" gem 'has_funding' - gem 'rack-obama' + gem 'myrack-obama' G expect(out).not_to include("1 installed gem you directly depend on is looking for funding.") @@ -81,7 +81,7 @@ RSpec.describe "bundle install" do context "when gems do not include fund messages" do it "does not display any fund messages" do - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo2" gem "activesupport" G @@ -92,7 +92,7 @@ RSpec.describe "bundle install" do context "when a dependency includes a fund message" do it "does not display the fund message" do - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo2" gem 'gem_with_dependent_funding' G @@ -110,7 +110,7 @@ RSpec.describe "bundle install" do "funding_uri" => "https://example.com/also_has_funding/funding", } end - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo1" gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}' G @@ -124,7 +124,7 @@ RSpec.describe "bundle install" do "funding_uri" => "https://example.com/also_has_funding/funding", } end - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo1" gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}' G @@ -134,7 +134,7 @@ RSpec.describe "bundle install" do "funding_uri" => "https://example.com/also_has_funding/funding", } end - install_gemfile <<-G, artifice: "compact_index" + install_gemfile <<-G source "https://gem.repo1" gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.1")}' G @@ -153,10 +153,10 @@ RSpec.describe "bundle install" do gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}' G - bundle :install, artifice: "compact_index" + bundle :install expect(out).to include("1 installed gem you directly depend on is looking for funding.") - bundle :install, artifice: "compact_index" + bundle :install expect(out).to include("1 installed gem you directly depend on is looking for funding.") end end diff --git a/spec/bundler/install/gems/mirror_spec.rb b/spec/bundler/install/gems/mirror_spec.rb index 9611973701..70c0da50ef 100644 --- a/spec/bundler/install/gems/mirror_spec.rb +++ b/spec/bundler/install/gems/mirror_spec.rb @@ -4,17 +4,17 @@ RSpec.describe "bundle install with a mirror configured" do describe "when the mirror does not match the gem source" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G bundle "config set --local mirror.http://gems.example.org http://gem-mirror.example.org" end it "installs from the normal location" do bundle :install - expect(out).to include("Fetching source index from #{file_uri_for(gem_repo1)}") - expect(the_bundle).to include_gems "rack 1.0" + expect(out).to include("Fetching gem metadata from https://gem.repo1") + expect(the_bundle).to include_gems "myrack 1.0" end end @@ -22,18 +22,18 @@ RSpec.describe "bundle install with a mirror configured" do before :each do gemfile <<-G # This source is bogus and doesn't have the gem we're looking for - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - gem "rack" + gem "myrack" G - bundle "config set --local mirror.#{file_uri_for(gem_repo2)} #{file_uri_for(gem_repo1)}" + bundle "config set --local mirror.https://gem.repo2 https://gem.repo1" end it "installs the gem from the mirror" do - bundle :install - expect(out).to include("Fetching source index from #{file_uri_for(gem_repo1)}") - expect(out).not_to include("Fetching source index from #{file_uri_for(gem_repo2)}") - expect(the_bundle).to include_gems "rack 1.0" + bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } + expect(out).to include("Fetching gem metadata from https://gem.repo1") + expect(out).not_to include("Fetching gem metadata from https://gem.repo2") + expect(the_bundle).to include_gems "myrack 1.0" end end end diff --git a/spec/bundler/install/gems/native_extensions_spec.rb b/spec/bundler/install/gems/native_extensions_spec.rb index 907778a384..874818fa87 100644 --- a/spec/bundler/install/gems/native_extensions_spec.rb +++ b/spec/bundler/install/gems/native_extensions_spec.rb @@ -33,7 +33,7 @@ RSpec.describe "installing a gem with native extensions" do end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "c_extension" G @@ -78,7 +78,7 @@ RSpec.describe "installing a gem with native extensions" do bundle "config set build.c_extension --with-c_extension=hello" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump} G @@ -127,13 +127,13 @@ RSpec.describe "installing a gem with native extensions" do # 1st time, require only one gem -- only one of the extensions gets built. install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "c_extension_one", :git => #{lib_path("gems").to_s.dump} G # 2nd time, require both gems -- we need both extensions to be built now. install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "c_extension_one", :git => #{lib_path("gems").to_s.dump} gem "c_extension_two", :git => #{lib_path("gems").to_s.dump} G @@ -174,7 +174,7 @@ RSpec.describe "installing a gem with native extensions" do bundle "config set build.c_extension --with-c_extension=hello --with-c_extension_bundle-dir=hola" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump} G diff --git a/spec/bundler/install/gems/post_install_spec.rb b/spec/bundler/install/gems/post_install_spec.rb index 7426f54877..af753dba3e 100644 --- a/spec/bundler/install/gems/post_install_spec.rb +++ b/spec/bundler/install/gems/post_install_spec.rb @@ -5,26 +5,26 @@ RSpec.describe "bundle install" do context "when gems include post install messages" do it "should display the post-install messages after installing" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' gem 'thin' - gem 'rack-obama' + gem 'myrack-obama' G bundle :install - expect(out).to include("Post-install message from rack:") - expect(out).to include("Rack's post install message") + expect(out).to include("Post-install message from myrack:") + expect(out).to include("Myrack's post install message") expect(out).to include("Post-install message from thin:") expect(out).to include("Thin's post install message") - expect(out).to include("Post-install message from rack-obama:") - expect(out).to include("Rack-obama's post install message") + expect(out).to include("Post-install message from myrack-obama:") + expect(out).to include("Myrack-obama's post install message") end end context "when gems do not include post install messages" do it "should not display any post-install messages" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" G @@ -36,13 +36,13 @@ RSpec.describe "bundle install" do context "when a dependency includes a post install message" do it "should display the post install message" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack_middleware' + source "https://gem.repo1" + gem 'myrack_middleware' G bundle :install - expect(out).to include("Post-install message from rack:") - expect(out).to include("Rack's post install message") + expect(out).to include("Post-install message from myrack:") + expect(out).to include("Myrack's post install message") end end end @@ -54,7 +54,7 @@ RSpec.describe "bundle install" do s.post_install_message = "Foo's post install message" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => '#{lib_path("foo-1.0")}' G @@ -68,7 +68,7 @@ RSpec.describe "bundle install" do s.post_install_message = "Foo's post install message" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => '#{lib_path("foo-1.0")}' G bundle :install @@ -77,7 +77,7 @@ RSpec.describe "bundle install" do s.post_install_message = "Foo's 1.1 post install message" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => '#{lib_path("foo-1.1")}' G bundle :install @@ -91,7 +91,7 @@ RSpec.describe "bundle install" do s.post_install_message = "Foo's post install message" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => '#{lib_path("foo-1.0")}' G @@ -110,7 +110,7 @@ RSpec.describe "bundle install" do s.post_install_message = nil end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => '#{lib_path("foo-1.0")}' G @@ -123,11 +123,11 @@ RSpec.describe "bundle install" do context "when ignore post-install messages for gem is set" do it "doesn't display any post-install messages" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - bundle "config set ignore_messages.rack true" + bundle "config set ignore_messages.myrack true" bundle :install expect(out).not_to include("Post-install message") @@ -137,8 +137,8 @@ RSpec.describe "bundle install" do context "when ignore post-install messages for all gems" do it "doesn't display any post-install messages" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "config set ignore_messages true" diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb index b54674898d..589415a983 100644 --- a/spec/bundler/install/gems/resolving_spec.rb +++ b/spec/bundler/install/gems/resolving_spec.rb @@ -66,7 +66,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs gems with implicit rake dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "with_implicit_rake_dep" gem "another_implicit_rake_dep" gem "rake" @@ -84,7 +84,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs gems with implicit rake dependencies without rake previously installed" do with_path_as("") do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "with_implicit_rake_dep" gem "another_implicit_rake_dep" gem "rake" @@ -100,7 +100,7 @@ RSpec.describe "bundle install with install-time dependencies" do expect(out).to eq("YES\nYES") end - it "installs gems with a dependency with no type" do + it "does not install gems with a dependency with no type" do build_repo2 path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz" @@ -112,18 +112,20 @@ RSpec.describe "bundle install with install-time dependencies" do f.write Gem.deflate(Marshal.dump(spec)) end - install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + install_gemfile <<-G, raise_on_error: false + source "https://gem.repo2" gem "actionpack", "2.3.2" G - expect(the_bundle).to include_gems "actionpack 2.3.2", "activesupport 2.3.2" + expect(err).to include("Downloading actionpack-2.3.2 revealed dependencies not in the API or the lockfile (activesupport (= 2.3.2)).") + + expect(the_bundle).not_to include_gems "actionpack 2.3.2", "activesupport 2.3.2" end describe "with crazy rubygem plugin stuff" do it "installs plugins" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "net_b" G @@ -132,7 +134,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs plugins depended on by other plugins" do install_gemfile <<-G, env: { "DEBUG" => "1" } - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "net_a" G @@ -141,7 +143,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs multiple levels of dependencies" do install_gemfile <<-G, env: { "DEBUG" => "1" } - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "net_c" gem "net_e" G @@ -152,7 +154,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['BUNDLER_DEBUG_RESOLVER'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "net_c" gem "net_e" G @@ -166,7 +168,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['DEBUG_RESOLVER'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "net_c" gem "net_e" G @@ -180,7 +182,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['DEBUG_RESOLVER_TREE'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "net_c" gem "net_e" G @@ -199,11 +201,11 @@ RSpec.describe "bundle install with install-time dependencies" do context "allows only an older version" do it "installs the older version" do build_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end - build_gem "rack", "9001.0.0" do |s| + build_gem "myrack", "9001.0.0" do |s| s.required_ruby_version = "> 9000" end end @@ -211,20 +213,20 @@ RSpec.describe "bundle install with install-time dependencies" do install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } ruby "#{Gem.ruby_version}" source "http://localgemserver.test/" - gem 'rack' + gem 'myrack' G - expect(err).to_not include("rack-9001.0.0 requires ruby version > 9000") - expect(the_bundle).to include_gems("rack 1.2") + expect(err).to_not include("myrack-9001.0.0 requires ruby version > 9000") + expect(the_bundle).to include_gems("myrack 1.2") end it "installs the older version when using servers not implementing the compact index API" do build_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end - build_gem "rack", "9001.0.0" do |s| + build_gem "myrack", "9001.0.0" do |s| s.required_ruby_version = "> 9000" end end @@ -232,11 +234,11 @@ RSpec.describe "bundle install with install-time dependencies" do install_gemfile <<-G, artifice: "endpoint", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } ruby "#{Gem.ruby_version}" source "http://localgemserver.test/" - gem 'rack' + gem 'myrack' G - expect(err).to_not include("rack-9001.0.0 requires ruby version > 9000") - expect(the_bundle).to include_gems("rack 1.2") + expect(err).to_not include("myrack-9001.0.0 requires ruby version > 9000") + expect(the_bundle).to include_gems("myrack 1.2") end context "when there is a lockfile using the newer incompatible version" do @@ -405,13 +407,13 @@ RSpec.describe "bundle install with install-time dependencies" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem 'sorbet', '= 0.5.10554' G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: sorbet (0.5.10554) sorbet-static (= 0.5.10554) @@ -434,7 +436,7 @@ RSpec.describe "bundle install with install-time dependencies" do end nice_error = <<~E.strip - Could not find gems matching 'sorbet-static (= 0.5.10554)' valid for all resolution platforms (arm64-darwin-21, aarch64-linux) in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally. + Could not find gems matching 'sorbet-static (= 0.5.10554)' valid for all resolution platforms (arm64-darwin-21, aarch64-linux) in rubygems repository https://gem.repo4/ or installed locally. The source contains the following gems matching 'sorbet-static (= 0.5.10554)': * sorbet-static-0.5.10554-universal-darwin-21 @@ -461,7 +463,7 @@ RSpec.describe "bundle install with install-time dependencies" do lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: nokogiri (1.14.0-arm-linux) nokogiri (1.14.0-x86_64-linux) @@ -478,7 +480,7 @@ RSpec.describe "bundle install with install-time dependencies" do L gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri" gem "sorbet-static" @@ -490,7 +492,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "raises a proper error" do nice_error = <<~E.strip - Could not find gems matching 'sorbet-static' valid for all resolution platforms (arm-linux, x86_64-linux) in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally. + Could not find gems matching 'sorbet-static' valid for all resolution platforms (arm-linux, x86_64-linux) in rubygems repository https://gem.repo4/ or installed locally. The source contains the following gems matching 'sorbet-static': * sorbet-static-0.5.10696-x86_64-linux @@ -513,7 +515,7 @@ RSpec.describe "bundle install with install-time dependencies" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gemspec G @@ -531,47 +533,47 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs the older version under rate limiting conditions" do build_repo4 do - build_gem "rack", "9001.0.0" do |s| + build_gem "myrack", "9001.0.0" do |s| s.required_ruby_version = "> 9000" end - build_gem "rack", "1.2" + build_gem "myrack", "1.2" build_gem "foo1", "1.0" end install_gemfile <<-G, artifice: "compact_index_rate_limited", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } ruby "#{Gem.ruby_version}" source "http://localgemserver.test/" - gem 'rack' + gem 'myrack' gem 'foo1' G - expect(err).to_not include("rack-9001.0.0 requires ruby version > 9000") - expect(the_bundle).to include_gems("rack 1.2") + expect(err).to_not include("myrack-9001.0.0 requires ruby version > 9000") + expect(the_bundle).to include_gems("myrack 1.2") end it "installs the older not platform specific version" do build_repo4 do - build_gem "rack", "9001.0.0" do |s| + build_gem "myrack", "9001.0.0" do |s| s.required_ruby_version = "> 9000" end - build_gem "rack", "1.2" do |s| + build_gem "myrack", "1.2" do |s| s.platform = x86_mingw32 s.required_ruby_version = "> 9000" end - build_gem "rack", "1.2" + build_gem "myrack", "1.2" end simulate_platform x86_mingw32 do install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } ruby "#{Gem.ruby_version}" source "http://localgemserver.test/" - gem 'rack' + gem 'myrack' G end - expect(err).to_not include("rack-9001.0.0 requires ruby version > 9000") - expect(err).to_not include("rack-1.2-#{Bundler.local_platform} requires ruby version > 9000") - expect(the_bundle).to include_gems("rack 1.2") + expect(err).to_not include("myrack-9001.0.0 requires ruby version > 9000") + expect(err).to_not include("myrack-1.2-#{Bundler.local_platform} requires ruby version > 9000") + expect(the_bundle).to include_gems("myrack 1.2") end end @@ -656,7 +658,7 @@ RSpec.describe "bundle install with install-time dependencies" do end install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'require_rubygems' G diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb index 46cab2dfeb..86589796ed 100644 --- a/spec/bundler/install/gems/standalone_spec.rb +++ b/spec/bundler/install/gems/standalone_spec.rb @@ -8,9 +8,9 @@ RSpec.shared_examples "bundle install --standalone" do end it "still makes system gems unavailable to normal bundler" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" - expect(the_bundle).to_not include_gems("rack") + expect(the_bundle).to_not include_gems("myrack") end it "generates a bundle/bundler/setup.rb" do @@ -63,14 +63,14 @@ RSpec.shared_examples "bundle install --standalone" do end it "makes system gems unavailable without bundler" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" testrb = String.new <<-RUBY $:.unshift File.expand_path("bundle") require "bundler/setup" begin - require "rack" + require "myrack" rescue LoadError puts "LoadError" end @@ -122,7 +122,7 @@ RSpec.shared_examples "bundle install --standalone" do describe "with simple gems" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G bundle "config set --local path #{bundled_app("bundle")}" @@ -141,6 +141,8 @@ RSpec.shared_examples "bundle install --standalone" do describe "with default gems and a lockfile", :ruby_repo do before do + skip "Does not work on old Windows Rubies" if Gem.ruby_version < Gem::Version.new("3.2") && Gem.win_platform? + realworld_system_gems "tsort --version 0.1.0" necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.1.0"] @@ -170,9 +172,9 @@ RSpec.shared_examples "bundle install --standalone" do bundle "lock", dir: cwd, artifice: "compact_index" end - it "works and points to the vendored copies, not to the default copies", :realworld do + it "works and points to the vendored copies, not to the default copies" do bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, standalone: true, dir: cwd, artifice: "compact_index", env: { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } + bundle :install, standalone: true, dir: cwd, env: { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } load_path_lines = bundled_app("bundle/bundler/setup.rb").read.split("\n").select {|line| line.start_with?("$:.unshift") } @@ -190,7 +192,7 @@ RSpec.shared_examples "bundle install --standalone" do Dir.mkdir bundled_app("app") gemfile bundled_app("app/Gemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "minitest", :path => "#{lib_path("minitest")}" G @@ -220,7 +222,7 @@ RSpec.shared_examples "bundle install --standalone" do build_lib "minitest", "1.0.0", path: bundled_app("app/vendor/minitest") gemfile bundled_app("app/Gemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "minitest", :path => "vendor/minitest" G @@ -246,7 +248,7 @@ RSpec.shared_examples "bundle install --standalone" do before do bundle "config set --local path #{bundled_app("bundle")}" install_gemfile <<-G, standalone: true, dir: cwd - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "very_simple_binary" G end @@ -284,7 +286,7 @@ RSpec.shared_examples "bundle install --standalone" do end bundle "config set --local path #{bundled_app("bundle")}" install_gemfile <<-G, standalone: true, dir: cwd, raise_on_error: false - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :git => "#{lib_path("bar-1.0")}" G end @@ -300,7 +302,7 @@ RSpec.shared_examples "bundle install --standalone" do build_git "devise", "1.0" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" gem "devise", :git => "#{lib_path("devise-1.0")}" G @@ -324,12 +326,12 @@ RSpec.shared_examples "bundle install --standalone" do build_git "devise", "1.0" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" group :test do gem "rspec" - gem "rack-test" + gem "myrack-test" end G bundle "config set --local path #{bundled_app("bundle")}" @@ -442,7 +444,7 @@ RSpec.shared_examples "bundle install --standalone" do describe "with --binstubs", bundler: "< 3" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G bundle "config set --local path #{bundled_app("bundle")}" @@ -502,23 +504,23 @@ end RSpec.describe "bundle install --standalone --local" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - system_gems "rack-1.0.0", path: default_bundle_path + system_gems "myrack-1.0.0", path: default_bundle_path end it "generates script pointing to system gems" do bundle "install --standalone --local --verbose" - expect(out).to include("Using rack 1.0.0") + expect(out).to include("Using myrack 1.0.0") load_error_ruby <<-RUBY, "spec" require "./bundler/setup" - require "rack" - puts RACK + require "myrack" + puts MYRACK require "spec" RUBY diff --git a/spec/bundler/install/gems/win32_spec.rb b/spec/bundler/install/gems/win32_spec.rb index 419b14ff0f..be37673aa1 100644 --- a/spec/bundler/install/gems/win32_spec.rb +++ b/spec/bundler/install/gems/win32_spec.rb @@ -4,22 +4,22 @@ RSpec.describe "bundle install with win32-generated lockfile" do it "should read lockfile" do File.open(bundled_app_lock, "wb") do |f| f << "GEM\r\n" - f << " remote: #{file_uri_for(gem_repo1)}/\r\n" + f << " remote: https://gem.repo1/\r\n" f << " specs:\r\n" f << "\r\n" - f << " rack (1.0.0)\r\n" + f << " myrack (1.0.0)\r\n" f << "\r\n" f << "PLATFORMS\r\n" f << " ruby\r\n" f << "\r\n" f << "DEPENDENCIES\r\n" - f << " rack\r\n" + f << " myrack\r\n" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - gem "rack" + gem "myrack" G end end diff --git a/spec/bundler/install/gemspecs_spec.rb b/spec/bundler/install/gemspecs_spec.rb index 420b34ca04..41232bd47b 100644 --- a/spec/bundler/install/gemspecs_spec.rb +++ b/spec/bundler/install/gemspecs_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "bundle install" do it "still installs correctly" do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "yaml_spec" G bundle :install @@ -21,7 +21,7 @@ RSpec.describe "bundle install" do build_lib "yaml_spec", gemspec: :yaml install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'yaml_spec', :path => "#{lib_path("yaml_spec-1.0")}" G expect(err).to be_empty @@ -31,22 +31,22 @@ RSpec.describe "bundle install" do it "should use gemspecs in the system cache when available" do gemfile <<-G source "http://localtestserver.gem" - gem 'rack' + gem 'myrack' G - system_gems "rack-1.0.0", path: default_bundle_path + system_gems "myrack-1.0.0", path: default_bundle_path FileUtils.mkdir_p "#{default_bundle_path}/specifications" - File.open("#{default_bundle_path}/specifications/rack-1.0.0.gemspec", "w+") do |f| + File.open("#{default_bundle_path}/specifications/myrack-1.0.0.gemspec", "w+") do |f| spec = Gem::Specification.new do |s| - s.name = "rack" + s.name = "myrack" s.version = "1.0.0" s.add_runtime_dependency "activesupport", "2.3.2" end f.write spec.to_ruby end bundle :install, artifice: "endpoint_marshal_fail" # force gemspec load - expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.2" + expect(the_bundle).to include_gems "myrack 1.0.0", "activesupport 2.3.2" end it "does not hang when gemspec has incompatible encoding" do @@ -60,7 +60,7 @@ RSpec.describe "bundle install" do G install_gemfile <<-G, env: { "LANG" => "C" } - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G @@ -86,7 +86,7 @@ RSpec.describe "bundle install" do G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G @@ -102,7 +102,7 @@ RSpec.describe "bundle install" do install_gemfile <<-G ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G expect(the_bundle).to include_gems "foo 1.0" @@ -116,7 +116,7 @@ RSpec.describe "bundle install" do install_gemfile <<-G, raise_on_error: false ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{RUBY_PATCHLEVEL}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G expect(the_bundle).to include_gems "foo 1.0" @@ -131,7 +131,7 @@ RSpec.describe "bundle install" do install_gemfile <<-G, raise_on_error: false ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{patchlevel}' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G @@ -149,7 +149,7 @@ RSpec.describe "bundle install" do install_gemfile <<-G, raise_on_error: false ruby '#{version}', :engine_version => '#{version}', :engine => 'ruby' - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G @@ -162,7 +162,7 @@ RSpec.describe "bundle install" do build_lib "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec path: "#{lib_path("foo-1.0")}" module Monkey diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb index c8d574baf3..179e6df4b4 100644 --- a/spec/bundler/install/git_spec.rb +++ b/spec/bundler/install/git_spec.rb @@ -6,11 +6,11 @@ RSpec.describe "bundle install" do build_git "foo", "1.0", path: lib_path("foo") install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo"))}" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo")}" G - expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{revision_for(lib_path("foo"))[0..6]})") + expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at main@#{revision_for(lib_path("foo"))[0..6]})") expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" end @@ -18,11 +18,11 @@ RSpec.describe "bundle install" do build_git "foo", "1.0", path: lib_path("foo"), default_branch: "main" install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo"))}" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo")}" G - expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{revision_for(lib_path("foo"))[0..6]})") + expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at main@#{revision_for(lib_path("foo"))[0..6]})") expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" end @@ -36,17 +36,17 @@ RSpec.describe "bundle install" do update_git "foo", "3.0", path: lib_path("foo"), gemspec: true install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo"))}", :ref => "main~2" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo")}", :ref => "main~2" G - expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main~2@#{rev})") + expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at main~2@#{rev})") expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" update_git "foo", "4.0", path: lib_path("foo"), gemspec: true bundle :update, all: true, verbose: true - expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at main~2@#{rev2})") + expect(out).to include("Using foo 2.0 (was 1.0) from #{lib_path("foo")} (at main~2@#{rev2})") expect(the_bundle).to include_gems "foo 2.0", source: "git@#{lib_path("foo")}" end @@ -54,13 +54,13 @@ RSpec.describe "bundle install" do revision = build_git("foo").ref_for("HEAD") gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :group => :development + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo-1.0")}", :group => :development G lockfile <<-L GIT - remote: #{file_uri_for(lib_path("foo-1.0"))} + remote: #{lib_path("foo-1.0")} revision: #{revision} specs: foo (1.0) @@ -87,9 +87,9 @@ RSpec.describe "bundle install" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "foo", :git => "#{file_uri_for(lib_path("gems"))}", :glob => "foo/*.gemspec" - gem "zebra", :git => "#{file_uri_for(lib_path("gems"))}", :glob => "zebra/*.gemspec" + source "https://gem.repo2" + gem "foo", :git => "#{lib_path("gems")}", :glob => "foo/*.gemspec" + gem "zebra", :git => "#{lib_path("gems")}", :glob => "zebra/*.gemspec" G bundle "info foo" @@ -112,7 +112,7 @@ RSpec.describe "bundle install" do other_ref = other.ref_for("HEAD") gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "test", git: #{test.path.to_s.inspect} gem "other", ref: #{other_ref.inspect}, git: #{other.path.to_s.inspect} @@ -133,7 +133,7 @@ RSpec.describe "bundle install" do other (1.0.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -178,11 +178,11 @@ RSpec.describe "bundle install" do bundle "config set path vendor/bundle" bundle "config set clean true" install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo"))}" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo")}" G - expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{rev[0..6]})") + expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at main@#{rev[0..6]})") expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" old_lockfile = lockfile @@ -191,14 +191,14 @@ RSpec.describe "bundle install" do rev2 = revision_for(lib_path("foo")) bundle :update, all: true, verbose: true - expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at main@#{rev2[0..6]})") + expect(out).to include("Using foo 2.0 (was 1.0) from #{lib_path("foo")} (at main@#{rev2[0..6]})") expect(out).to include("Removing foo (#{rev[0..11]})") expect(the_bundle).to include_gems "foo 2.0", source: "git@#{lib_path("foo")}" lockfile(old_lockfile) bundle :install, verbose: true - expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{rev[0..6]})") + expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at main@#{rev[0..6]})") expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" end end diff --git a/spec/bundler/install/global_cache_spec.rb b/spec/bundler/install/global_cache_spec.rb index 0da4de05b2..df4559c42e 100644 --- a/spec/bundler/install/global_cache_spec.rb +++ b/spec/bundler/install/global_cache_spec.rb @@ -18,133 +18,133 @@ RSpec.describe "global gem caching" do it "caches gems into the global cache on download" do install_gemfile <<-G, artifice: "compact_index" source "#{source}" - gem "rack" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0.0" - expect(source_global_cache("rack-1.0.0.gem")).to exist + expect(the_bundle).to include_gems "myrack 1.0.0" + expect(source_global_cache("myrack-1.0.0.gem")).to exist end it "uses globally cached gems if they exist" do source_global_cache.mkpath - FileUtils.cp(gem_repo1("gems/rack-1.0.0.gem"), source_global_cache("rack-1.0.0.gem")) + FileUtils.cp(gem_repo1("gems/myrack-1.0.0.gem"), source_global_cache("myrack-1.0.0.gem")) install_gemfile <<-G, artifice: "compact_index_no_gem" source "#{source}" - gem "rack" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "shows a proper error message if a cached gem is corrupted" do source_global_cache.mkpath - FileUtils.touch(source_global_cache("rack-1.0.0.gem")) + FileUtils.touch(source_global_cache("myrack-1.0.0.gem")) install_gemfile <<-G, artifice: "compact_index_no_gem", raise_on_error: false source "#{source}" - gem "rack" + gem "myrack" G - expect(err).to include("Gem::Package::FormatError: package metadata is missing in #{source_global_cache("rack-1.0.0.gem")}") + expect(err).to include("Gem::Package::FormatError: package metadata is missing in #{source_global_cache("myrack-1.0.0.gem")}") end describe "when the same gem from different sources is installed" do it "should use the appropriate one from the global cache" do install_gemfile <<-G, artifice: "compact_index" source "#{source}" - gem "rack" + gem "myrack" G simulate_new_machine - expect(the_bundle).not_to include_gems "rack 1.0.0" - expect(source_global_cache("rack-1.0.0.gem")).to exist - # rack 1.0.0 is not installed and it is in the global cache + expect(the_bundle).not_to include_gems "myrack 1.0.0" + expect(source_global_cache("myrack-1.0.0.gem")).to exist + # myrack 1.0.0 is not installed and it is in the global cache install_gemfile <<-G, artifice: "compact_index" source "#{source2}" - gem "rack", "0.9.1" + gem "myrack", "0.9.1" G simulate_new_machine - expect(the_bundle).not_to include_gems "rack 0.9.1" - expect(source2_global_cache("rack-0.9.1.gem")).to exist - # rack 0.9.1 is not installed and it is in the global cache + expect(the_bundle).not_to include_gems "myrack 0.9.1" + expect(source2_global_cache("myrack-0.9.1.gem")).to exist + # myrack 0.9.1 is not installed and it is in the global cache gemfile <<-G source "#{source}" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G bundle :install, artifice: "compact_index_no_gem" - # rack 1.0.0 is installed and rack 0.9.1 is not - expect(the_bundle).to include_gems "rack 1.0.0" - expect(the_bundle).not_to include_gems "rack 0.9.1" + # myrack 1.0.0 is installed and myrack 0.9.1 is not + expect(the_bundle).to include_gems "myrack 1.0.0" + expect(the_bundle).not_to include_gems "myrack 0.9.1" simulate_new_machine gemfile <<-G source "#{source2}" - gem "rack", "0.9.1" + gem "myrack", "0.9.1" G bundle :install, artifice: "compact_index_no_gem" - # rack 0.9.1 is installed and rack 1.0.0 is not - expect(the_bundle).to include_gems "rack 0.9.1" - expect(the_bundle).not_to include_gems "rack 1.0.0" + # myrack 0.9.1 is installed and myrack 1.0.0 is not + expect(the_bundle).to include_gems "myrack 0.9.1" + expect(the_bundle).not_to include_gems "myrack 1.0.0" end it "should not install if the wrong source is provided" do gemfile <<-G source "#{source}" - gem "rack" + gem "myrack" G bundle :install, artifice: "compact_index" simulate_new_machine - expect(the_bundle).not_to include_gems "rack 1.0.0" - expect(source_global_cache("rack-1.0.0.gem")).to exist - # rack 1.0.0 is not installed and it is in the global cache + expect(the_bundle).not_to include_gems "myrack 1.0.0" + expect(source_global_cache("myrack-1.0.0.gem")).to exist + # myrack 1.0.0 is not installed and it is in the global cache gemfile <<-G source "#{source2}" - gem "rack", "0.9.1" + gem "myrack", "0.9.1" G bundle :install, artifice: "compact_index" simulate_new_machine - expect(the_bundle).not_to include_gems "rack 0.9.1" - expect(source2_global_cache("rack-0.9.1.gem")).to exist - # rack 0.9.1 is not installed and it is in the global cache + expect(the_bundle).not_to include_gems "myrack 0.9.1" + expect(source2_global_cache("myrack-0.9.1.gem")).to exist + # myrack 0.9.1 is not installed and it is in the global cache gemfile <<-G source "#{source2}" - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G - expect(source_global_cache("rack-1.0.0.gem")).to exist - expect(source2_global_cache("rack-0.9.1.gem")).to exist + expect(source_global_cache("myrack-1.0.0.gem")).to exist + expect(source2_global_cache("myrack-0.9.1.gem")).to exist bundle :install, artifice: "compact_index_no_gem", raise_on_error: false expect(err).to include("Internal Server Error 500") expect(err).not_to include("ERROR REPORT TEMPLATE") - # rack 1.0.0 is not installed and rack 0.9.1 is not - expect(the_bundle).not_to include_gems "rack 1.0.0" - expect(the_bundle).not_to include_gems "rack 0.9.1" + # myrack 1.0.0 is not installed and myrack 0.9.1 is not + expect(the_bundle).not_to include_gems "myrack 1.0.0" + expect(the_bundle).not_to include_gems "myrack 0.9.1" gemfile <<-G source "#{source}" - gem "rack", "0.9.1" + gem "myrack", "0.9.1" G - expect(source_global_cache("rack-1.0.0.gem")).to exist - expect(source2_global_cache("rack-0.9.1.gem")).to exist + expect(source_global_cache("myrack-1.0.0.gem")).to exist + expect(source2_global_cache("myrack-0.9.1.gem")).to exist bundle :install, artifice: "compact_index_no_gem", raise_on_error: false expect(err).to include("Internal Server Error 500") expect(err).not_to include("ERROR REPORT TEMPLATE") - # rack 0.9.1 is not installed and rack 1.0.0 is not - expect(the_bundle).not_to include_gems "rack 0.9.1" - expect(the_bundle).not_to include_gems "rack 1.0.0" + # myrack 0.9.1 is not installed and myrack 1.0.0 is not + expect(the_bundle).not_to include_gems "myrack 0.9.1" + expect(the_bundle).not_to include_gems "myrack 1.0.0" end end @@ -152,29 +152,29 @@ RSpec.describe "global gem caching" do it "uses the global cache as a source" do install_gemfile <<-G, artifice: "compact_index" source "#{source}" - gem "rack" + gem "myrack" gem "activesupport" G # Both gems are installed and in the global cache - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" expect(the_bundle).to include_gems "activesupport 2.3.5" - expect(source_global_cache("rack-1.0.0.gem")).to exist + expect(source_global_cache("myrack-1.0.0.gem")).to exist expect(source_global_cache("activesupport-2.3.5.gem")).to exist simulate_new_machine # Both gems are now only in the global cache - expect(the_bundle).not_to include_gems "rack 1.0.0" + expect(the_bundle).not_to include_gems "myrack 1.0.0" expect(the_bundle).not_to include_gems "activesupport 2.3.5" install_gemfile <<-G, artifice: "compact_index_no_gem" source "#{source}" - gem "rack" + gem "myrack" G - # rack is installed and both are in the global cache - expect(the_bundle).to include_gems "rack 1.0.0" + # myrack is installed and both are in the global cache + expect(the_bundle).to include_gems "myrack 1.0.0" expect(the_bundle).not_to include_gems "activesupport 2.3.5" - expect(source_global_cache("rack-1.0.0.gem")).to exist + expect(source_global_cache("myrack-1.0.0.gem")).to exist expect(source_global_cache("activesupport-2.3.5.gem")).to exist create_file bundled_app2("gems.rb"), <<-G @@ -183,9 +183,9 @@ RSpec.describe "global gem caching" do G # Neither gem is installed and both are in the global cache - expect(the_bundle).not_to include_gems "rack 1.0.0", dir: bundled_app2 + expect(the_bundle).not_to include_gems "myrack 1.0.0", dir: bundled_app2 expect(the_bundle).not_to include_gems "activesupport 2.3.5", dir: bundled_app2 - expect(source_global_cache("rack-1.0.0.gem")).to exist + expect(source_global_cache("myrack-1.0.0.gem")).to exist expect(source_global_cache("activesupport-2.3.5.gem")).to exist # Install using the global cache instead of by downloading the .gem @@ -193,10 +193,10 @@ RSpec.describe "global gem caching" do bundle :install, artifice: "compact_index_no_gem", dir: bundled_app2 # activesupport is installed and both are in the global cache - expect(the_bundle).not_to include_gems "rack 1.0.0", dir: bundled_app2 + expect(the_bundle).not_to include_gems "myrack 1.0.0", dir: bundled_app2 expect(the_bundle).to include_gems "activesupport 2.3.5", dir: bundled_app2 - expect(source_global_cache("rack-1.0.0.gem")).to exist + expect(source_global_cache("myrack-1.0.0.gem")).to exist expect(source_global_cache("activesupport-2.3.5.gem")).to exist end end @@ -211,7 +211,7 @@ RSpec.describe "global gem caching" do revision = revision_for(lib_path("very_simple_git_binary-1.0"))[0, 12] install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "very_simple_binary" gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}" @@ -219,7 +219,7 @@ RSpec.describe "global gem caching" do G gem_binary_cache = home(".bundle", "cache", "extensions", local_platform.to_s, Bundler.ruby_scope, - Digest(:MD5).hexdigest("#{gem_repo1}/"), "very_simple_binary-1.0") + "gem.repo1.443.#{Digest(:MD5).hexdigest("gem.repo1.443./")}", "very_simple_binary-1.0") git_binary_cache = home(".bundle", "cache", "extensions", local_platform.to_s, Bundler.ruby_scope, "very_simple_git_binary-1.0-#{revision}", "very_simple_git_binary-1.0") diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb index 0a30e402b7..8d32e033d6 100644 --- a/spec/bundler/install/path_spec.rb +++ b/spec/bundler/install/path_spec.rb @@ -3,27 +3,27 @@ RSpec.describe "bundle install" do describe "with path configured" do before :each do - build_gem "rack", "1.0.0", to_system: true do |s| - s.write "lib/rack.rb", "puts 'FAIL'" + build_gem "myrack", "1.0.0", to_system: true do |s| + s.write "lib/myrack.rb", "puts 'FAIL'" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end it "does not use available system gems with `vendor/bundle" do bundle "config set --local path vendor/bundle" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "uses system gems with `path.system` configured with more priority than `path`" do bundle "config set --local path.system true" bundle "config set --global path vendor/bundle" bundle :install - run "require 'rack'", raise_on_error: false + run "require 'myrack'", raise_on_error: false expect(out).to include("FAIL") end @@ -55,8 +55,8 @@ RSpec.describe "bundle install" do FileUtils.rm_rf bundled_app("vendor") bundle "install" - expect(vendored_gems("gems/rack-1.0.0")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + expect(vendored_gems("gems/myrack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "myrack 1.0.0" end context "with path_relative_to_cwd set to true" do @@ -66,7 +66,7 @@ RSpec.describe "bundle install" do bundle "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle", dir: bundled_app.parent expect(out).to include("installed into `./vendor/bundle`") expect(bundled_app("../vendor/bundle")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "installs the standalone bundle relative to the cwd" do @@ -87,13 +87,13 @@ RSpec.describe "bundle install" do describe "when BUNDLE_PATH or the global path config is set" do before :each do - build_lib "rack", "1.0.0", to_system: true do |s| - s.write "lib/rack.rb", "raise 'FAIL'" + build_lib "myrack", "1.0.0", to_system: true do |s| + s.write "lib/myrack.rb", "raise 'FAIL'" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end @@ -112,9 +112,9 @@ RSpec.describe "bundle install" do bundle "config set --local path vendor/bundle" bundle :install - expect(vendored_gems("gems/rack-1.0.0")).to be_directory + expect(vendored_gems("gems/myrack-1.0.0")).to be_directory expect(bundled_app("vendor2")).not_to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "installs gems to ." do @@ -123,9 +123,9 @@ RSpec.describe "bundle install" do bundle :install - paths_to_exist = %w[cache/rack-1.0.0.gem gems/rack-1.0.0 specifications/rack-1.0.0.gemspec].map {|path| bundled_app(Bundler.ruby_scope, path) } + paths_to_exist = %w[cache/myrack-1.0.0.gem gems/myrack-1.0.0 specifications/myrack-1.0.0.gemspec].map {|path| bundled_app(Bundler.ruby_scope, path) } expect(paths_to_exist).to all exist - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "installs gems to the path" do @@ -133,8 +133,8 @@ RSpec.describe "bundle install" do bundle :install - expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + expect(bundled_app("vendor", Bundler.ruby_scope, "gems/myrack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "myrack 1.0.0" end it "installs gems to the path relative to root when relative" do @@ -143,8 +143,8 @@ RSpec.describe "bundle install" do FileUtils.mkdir_p bundled_app("lol") bundle :install, dir: bundled_app("lol") - expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + expect(bundled_app("vendor", Bundler.ruby_scope, "gems/myrack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "myrack 1.0.0" end end end @@ -154,26 +154,26 @@ RSpec.describe "bundle install" do bundle :install - expect(vendored_gems("gems/rack-1.0.0")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + expect(vendored_gems("gems/myrack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "myrack 1.0.0" end it "sets BUNDLE_PATH as the first argument to bundle install" do bundle "config set --local path ./vendor/bundle" bundle :install - expect(vendored_gems("gems/rack-1.0.0")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + expect(vendored_gems("gems/myrack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "myrack 1.0.0" end it "disables system gems when passing a path to install" do # This is so that vendored gems can be distributed to others - build_gem "rack", "1.1.0", to_system: true + build_gem "myrack", "1.1.0", to_system: true bundle "config set --local path ./vendor/bundle" bundle :install - expect(vendored_gems("gems/rack-1.0.0")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + expect(vendored_gems("gems/myrack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "myrack 1.0.0" end it "re-installs gems whose extensions have been deleted" do @@ -182,7 +182,7 @@ RSpec.describe "bundle install" do end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "very_simple_binary" G @@ -214,8 +214,8 @@ RSpec.describe "bundle install" do it "reports the file exists" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "config set --local path bundle" diff --git a/spec/bundler/install/prereleases_spec.rb b/spec/bundler/install/prereleases_spec.rb index 629eb89dac..cde27c14fc 100644 --- a/spec/bundler/install/prereleases_spec.rb +++ b/spec/bundler/install/prereleases_spec.rb @@ -13,7 +13,7 @@ RSpec.describe "bundle install" do describe "when prerelease gems are available" do it "finds prereleases" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "not_released" G expect(the_bundle).to include_gems "not_released 1.0.pre" @@ -21,7 +21,7 @@ RSpec.describe "bundle install" do it "uses regular releases if available" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "has_prerelease" G expect(the_bundle).to include_gems "has_prerelease 1.0" @@ -29,7 +29,7 @@ RSpec.describe "bundle install" do it "uses prereleases if requested" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "has_prerelease", "1.1.pre" G expect(the_bundle).to include_gems "has_prerelease 1.1.pre" @@ -39,16 +39,16 @@ RSpec.describe "bundle install" do describe "when prerelease gems are not available" do it "still works" do build_repo gem_repo3 do - build_gem "rack" + build_gem "myrack" end FileUtils.rm_rf Dir[gem_repo3("prerelease*")] install_gemfile <<-G - source "#{file_uri_for(gem_repo3)}" - gem "rack" + source "https://gem.repo3" + gem "myrack" G - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end end diff --git a/spec/bundler/install/process_lock_spec.rb b/spec/bundler/install/process_lock_spec.rb index 1f8c62f26e..8082ec40fa 100644 --- a/spec/bundler/install/process_lock_spec.rb +++ b/spec/bundler/install/process_lock_spec.rb @@ -8,17 +8,17 @@ RSpec.describe "process lock spec" do thread = Thread.new do Bundler::ProcessLock.lock(default_bundle_path) do sleep 1 # ignore quality_spec - expect(the_bundle).not_to include_gems "rack 1.0" + expect(the_bundle).not_to include_gems "myrack 1.0" end end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G thread.join - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end context "when creating a lock raises Errno::ENOTSUP" do diff --git a/spec/bundler/install/redownload_spec.rb b/spec/bundler/install/redownload_spec.rb index 3a72c356d9..b522e22bd5 100644 --- a/spec/bundler/install/redownload_spec.rb +++ b/spec/bundler/install/redownload_spec.rb @@ -3,29 +3,29 @@ RSpec.describe "bundle install" do before :each do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end shared_examples_for "an option to force redownloading gems" do it "re-installs installed gems" do - rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb") + myrack_lib = default_bundle_path("gems/myrack-1.0.0/lib/myrack.rb") bundle :install - rack_lib.open("w") {|f| f.write("blah blah blah") } + myrack_lib.open("w") {|f| f.write("blah blah blah") } bundle :install, flag => true - expect(out).to include "Installing rack 1.0.0" - expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(out).to include "Installing myrack 1.0.0" + expect(myrack_lib.open(&:read)).to eq("MYRACK = '1.0.0'\n") + expect(the_bundle).to include_gems "myrack 1.0.0" end it "works on first bundle install" do bundle :install, flag => true - expect(out).to include "Installing rack 1.0.0" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(out).to include "Installing myrack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end context "with a git gem" do @@ -33,7 +33,7 @@ RSpec.describe "bundle install" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G end diff --git a/spec/bundler/install/security_policy_spec.rb b/spec/bundler/install/security_policy_spec.rb index befeb81da5..e7f64dc227 100644 --- a/spec/bundler/install/security_policy_spec.rb +++ b/spec/bundler/install/security_policy_spec.rb @@ -9,8 +9,8 @@ RSpec.describe "policies with unsigned gems" do before do build_security_repo gemfile <<-G - source "#{file_uri_for(security_repo)}" - gem "rack" + source "https://gems.security" + gem "myrack" gem "signed_gem" G end @@ -18,7 +18,7 @@ RSpec.describe "policies with unsigned gems" do it "will work after you try to deploy without a lock" do bundle "install --deployment", raise_on_error: false bundle :install - expect(the_bundle).to include_gems "rack 1.0", "signed_gem 1.0" + expect(the_bundle).to include_gems "myrack 1.0", "signed_gem 1.0" end it "will fail when given invalid security policy" do @@ -45,7 +45,7 @@ RSpec.describe "policies with signed gems and no CA" do before do build_security_repo gemfile <<-G - source "#{file_uri_for(security_repo)}" + source "https://gems.security" gem "signed_gem" G end diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb index 5aeabd2f23..b2edd11acd 100644 --- a/spec/bundler/install/yanked_spec.rb +++ b/spec/bundler/install/yanked_spec.rb @@ -10,7 +10,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do it "throws an error when the original gem version is yanked" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: foo (10.0.0) @@ -23,7 +23,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do L install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "foo", "10.0.0" G @@ -35,7 +35,8 @@ RSpec.context "when installing a bundle that includes yanked gems" do skip "Materialization on Windows is not yet strict, so the example does not detect the gem has been yanked" if Gem.win_platform? build_repo4 do - build_gem "foo", "1.0.0", "1.0.1" + build_gem "foo", "1.0.0" + build_gem "foo", "1.0.1" build_gem "actiontext", "6.1.7" do |s| s.add_dependency "nokogiri", ">= 1.8" end @@ -76,10 +77,10 @@ RSpec.context "when installing a bundle that includes yanked gems" do end context "and the old index is used" do - let(:source_uri) { file_uri_for(gem_repo4) } + let(:source_uri) { "https://gem.repo4" } it "reports the yanked gem properly" do - bundle "install", raise_on_error: false + bundle "install", artifice: "endpoint", raise_on_error: false, verbose: true expect(err).to include("Your bundle is locked to nokogiri (1.13.8-#{Bundler.local_platform})") end @@ -100,7 +101,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do bundle "config set force_ruby_platform true" install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "foo", "10.0.0" G @@ -120,7 +121,7 @@ RSpec.context "when resolving a bundle that includes yanked gems, but unlocking lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)} + remote: https://gem.repo4 specs: foo (9.0.0) bar (1.0.0) @@ -137,7 +138,7 @@ RSpec.context "when resolving a bundle that includes yanked gems, but unlocking L gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "foo" gem "bar" G @@ -148,7 +149,7 @@ RSpec.context "when resolving a bundle that includes yanked gems, but unlocking expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: bar (2.0.0) foo (9.0.0) @@ -169,65 +170,65 @@ end RSpec.context "when using gem before installing" do it "does not suggest the author has yanked the gem" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)} + remote: https://gem.repo1 specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack (= 0.9.1) + myrack (= 0.9.1) L bundle :list, raise_on_error: false - expect(err).to include("Could not find rack-0.9.1 in locally installed gems") - expect(err).to_not include("Your bundle is locked to rack (0.9.1) from") - expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.") - expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.") + expect(err).to include("Could not find myrack-0.9.1 in locally installed gems") + expect(err).to_not include("Your bundle is locked to myrack (0.9.1) from") + expect(err).to_not include("If you haven't changed sources, that means the author of myrack (0.9.1) has removed it.") + expect(err).to_not include("You'll need to update your bundle to a different version of myrack (0.9.1) that hasn't been removed in order to install.") # Check error message is still correct when multiple platforms are locked lockfile lockfile.gsub(/PLATFORMS\n #{lockfile_platforms}/m, "PLATFORMS\n #{lockfile_platforms("ruby")}") bundle :list, raise_on_error: false - expect(err).to include("Could not find rack-0.9.1 in locally installed gems") + expect(err).to include("Could not find myrack-0.9.1 in locally installed gems") end it "does not suggest the author has yanked the gem when using more than one gem, but shows all gems that couldn't be found in the source" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" - gem "rack_middleware", "1.0" + source "https://gem.repo1" + gem "myrack", "0.9.1" + gem "myrack_middleware", "1.0" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)} + remote: https://gem.repo1 specs: - rack (0.9.1) - rack_middleware (1.0) + myrack (0.9.1) + myrack_middleware (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack (= 0.9.1) - rack_middleware (1.0) + myrack (= 0.9.1) + myrack_middleware (1.0) L bundle :list, raise_on_error: false - expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in locally installed gems") + expect(err).to include("Could not find myrack-0.9.1, myrack_middleware-1.0 in locally installed gems") expect(err).to include("Install missing gems with `bundle install`.") - expect(err).to_not include("Your bundle is locked to rack (0.9.1) from") - expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.") - expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.") + expect(err).to_not include("Your bundle is locked to myrack (0.9.1) from") + expect(err).to_not include("If you haven't changed sources, that means the author of myrack (0.9.1) has removed it.") + expect(err).to_not include("You'll need to update your bundle to a different version of myrack (0.9.1) that hasn't been removed in order to install.") end end diff --git a/spec/bundler/lock/git_spec.rb b/spec/bundler/lock/git_spec.rb index ad13e8ffc6..13c661ae14 100644 --- a/spec/bundler/lock/git_spec.rb +++ b/spec/bundler/lock/git_spec.rb @@ -5,7 +5,7 @@ RSpec.describe "bundle lock with git gems" do build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{lib_path("foo-1.0")}" G end @@ -24,7 +24,7 @@ RSpec.describe "bundle lock with git gems" do it "prints a proper error when changing a locked Gemfile to point to a bad branch" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{lib_path("foo-1.0")}", :branch => "bad" G @@ -42,7 +42,7 @@ RSpec.describe "bundle lock with git gems" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -87,7 +87,7 @@ RSpec.describe "bundle lock with git gems" do git "branch -D foo ", lib_path("foo-1.0") gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{lib_path("foo-1.0")}" G @@ -99,7 +99,7 @@ RSpec.describe "bundle lock with git gems" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -123,7 +123,7 @@ RSpec.describe "bundle lock with git gems" do annotated_tag = git("rev-parse v1.0", lib_path("foo-1.0")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{lib_path("foo-1.0")}" G @@ -135,7 +135,7 @@ RSpec.describe "bundle lock with git gems" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index 7341d5c1e8..703b535e2e 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -7,26 +7,26 @@ RSpec.describe "the lockfile format" do it "generates a simple lockfile for a single source, gem" do checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo2, "rack", "1.0.0") + c.checksum(gem_repo2, "myrack", "1.0.0") end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - gem "rack" + gem "myrack" G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -43,25 +43,25 @@ RSpec.describe "the lockfile format" do specs: GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES omg! - rack + myrack BUNDLED WITH 1.8.2 L install_gemfile <<-G, verbose: true, env: { "BUNDLER_VERSION" => Bundler::VERSION } - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - gem "rack" + gem "myrack" G expect(out).not_to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with 1.8.2.") @@ -69,44 +69,50 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH #{Bundler::VERSION} G end - it "does not update the lockfile's bundler version if nothing changed during bundle install, but uses the locked version", rubygems: ">= 3.3.0.a", realworld: true do + it "does not update the lockfile's bundler version if nothing changed during bundle install, but uses the locked version", rubygems: ">= 3.3.0.a" do version = "2.3.0" + build_repo4 do + build_gem "myrack", "1.0.0" + + build_bundler version + end + lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo4/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH #{version} L - install_gemfile <<-G, verbose: true, artifice: "vcr" - source "#{file_uri_for(gem_repo2)}" + install_gemfile <<-G, verbose: true, preserve_ruby_flags: true + source "https://gem.repo4" - gem "rack" + gem "myrack" G expect(out).to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with #{version}.") @@ -114,15 +120,15 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo4/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH #{version} @@ -132,30 +138,36 @@ RSpec.describe "the lockfile format" do it "does not update the lockfile's bundler version if nothing changed during bundle install, and uses the latest version", rubygems: "< 3.3.0.a" do version = "#{Bundler::VERSION.split(".").first}.0.0.a" + build_repo4 do + build_gem "myrack", "1.0.0" + + build_bundler version + end + checksums = checksums_section do |c| - c.checksum(gem_repo2, "rack", "1.0.0") + c.checksum(gem_repo4, "myrack", "1.0.0") end lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo4/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{version} L install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo4" - gem "rack" + gem "myrack" G expect(out).not_to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with #{version}.") @@ -163,15 +175,15 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo4/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{version} @@ -181,34 +193,34 @@ RSpec.describe "the lockfile format" do it "adds the BUNDLED WITH section if not present" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack L install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" - gem "rack", "> 0" + gem "myrack", "> 0" G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack (> 0) + myrack (> 0) BUNDLED WITH #{Bundler::VERSION} @@ -223,39 +235,39 @@ RSpec.describe "the lockfile format" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH #{older_major} L install_gemfile <<-G, env: { "BUNDLER_VERSION" => Bundler::VERSION } - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" - gem "rack" + gem "myrack" G expect(err).to be_empty expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH #{current_version} @@ -264,29 +276,29 @@ RSpec.describe "the lockfile format" do it "generates a simple lockfile for a single source, gem with dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" - gem "rack-obama" + gem "myrack-obama" G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo2, "rack", "1.0.0" - c.checksum gem_repo2, "rack-obama", "1.0" + c.checksum gem_repo2, "myrack", "1.0.0" + c.checksum gem_repo2, "myrack-obama", "1.0" end expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) - rack-obama (1.0) - rack + myrack (1.0.0) + myrack-obama (1.0) + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack-obama + myrack-obama #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -295,29 +307,29 @@ RSpec.describe "the lockfile format" do it "generates a simple lockfile for a single source, gem with a version requirement" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" - gem "rack-obama", ">= 1.0" + gem "myrack-obama", ">= 1.0" G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo2, "rack", "1.0.0" - c.checksum gem_repo2, "rack-obama", "1.0" + c.checksum gem_repo2, "myrack", "1.0.0" + c.checksum gem_repo2, "myrack-obama", "1.0" end expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) - rack-obama (1.0) - rack + myrack (1.0.0) + myrack-obama (1.0) + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack-obama (>= 1.0) + myrack-obama (>= 1.0) #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -325,46 +337,46 @@ RSpec.describe "the lockfile format" do end it "generates a lockfile without credentials" do - bundle "config set http://localgemserver.test/ user:pass" + bundle "config set https://localgemserver.test/ user:pass" install_gemfile(<<-G, artifice: "endpoint_strict_basic_authentication", quiet: true) - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" - source "http://localgemserver.test/" do + source "https://localgemserver.test/" do end - source "http://user:[email protected]/" do - gem "rack-obama", ">= 1.0" + source "https://user:[email protected]/" do + gem "myrack-obama", ">= 1.0" end G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo2, "rack", "1.0.0" - c.checksum gem_repo2, "rack-obama", "1.0" + c.checksum gem_repo2, "myrack", "1.0.0" + c.checksum gem_repo2, "myrack-obama", "1.0" end expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: GEM - remote: http://localgemserver.test/ + remote: https://localgemserver.test/ specs: GEM - remote: http://othergemserver.test/ + remote: https://othergemserver.test/ specs: - rack (1.0.0) - rack-obama (1.0) - rack + myrack (1.0.0) + myrack-obama (1.0) + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack-obama (>= 1.0)! + myrack-obama (>= 1.0)! #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -375,43 +387,43 @@ RSpec.describe "the lockfile format" do bundle "config set http://localgemserver.test/ user:pass" gemfile <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" source "http://localgemserver.test/" do end source "http://user:[email protected]/" do - gem "rack-obama", ">= 1.0" + gem "myrack-obama", ">= 1.0" end G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo2, "rack", "1.0.0" - c.checksum gem_repo2, "rack-obama", "1.0" + c.checksum gem_repo2, "myrack", "1.0.0" + c.checksum gem_repo2, "myrack-obama", "1.0" end lockfile_without_credentials = <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: http://localgemserver.test/ specs: GEM - remote: http://localgemserver.test/ + remote: http://othergemserver.test/ specs: + myrack (1.0.0) + myrack-obama (1.0) + myrack GEM - remote: http://othergemserver.test/ + remote: https://gem.repo1/ specs: - rack (1.0.0) - rack-obama (1.0) - rack PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack-obama (>= 1.0)! + myrack-obama (>= 1.0)! #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -428,7 +440,7 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq lockfile_without_credentials # when re-resolving without ful unlocking - bundle "update rack-obama", artifice: "endpoint_strict_basic_authentication" + bundle "update myrack-obama", artifice: "endpoint_strict_basic_authentication" expect(lockfile).to eq lockfile_without_credentials end @@ -436,43 +448,43 @@ RSpec.describe "the lockfile format" do bundle "config set http://localgemserver.test/ user:pass" gemfile <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" source "http://localgemserver.test/" do end source "http://user:[email protected]/" do - gem "rack-obama", ">= 1.0" + gem "myrack-obama", ">= 1.0" end G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo2, "rack", "1.0.0" - c.checksum gem_repo2, "rack-obama", "1.0" + c.checksum gem_repo2, "myrack", "1.0.0" + c.checksum gem_repo2, "myrack-obama", "1.0" end lockfile_with_credentials = <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: http://localgemserver.test/ specs: GEM - remote: http://localgemserver.test/ + remote: http://user:[email protected]/ specs: + myrack (1.0.0) + myrack-obama (1.0) + myrack GEM - remote: http://user:[email protected]/ + remote: https://gem.repo1/ specs: - rack (1.0.0) - rack-obama (1.0) - rack PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack-obama (>= 1.0)! + myrack-obama (>= 1.0)! #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -487,7 +499,7 @@ RSpec.describe "the lockfile format" do it "generates lockfiles with multiple requirements" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" gem "net-sftp" G @@ -498,7 +510,7 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: net-sftp (1.1.1) net-ssh (>= 1.0.0, < 1.99.0) @@ -521,7 +533,7 @@ RSpec.describe "the lockfile format" do git = build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -537,7 +549,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -555,13 +567,13 @@ RSpec.describe "the lockfile format" do build_lib "omg", path: lib_path("omg") gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" platforms :#{not_local_tag} do gem "omg", :path => "#{lib_path("omg")}" end - gem "rack" + gem "myrack" G lockfile <<-L @@ -571,23 +583,23 @@ RSpec.describe "the lockfile format" do specs: GEM - remote: #{file_uri_for(gem_repo2)}// + remote: https://gem.repo2// specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{not_local} DEPENDENCIES omg! - rack + myrack BUNDLED WITH #{Bundler::VERSION} L bundle "install" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "serializes global git sources" do @@ -598,7 +610,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}" do gem "foo" end @@ -612,7 +624,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -635,7 +647,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg" G @@ -648,7 +660,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -671,7 +683,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}", :tag => "omg" G @@ -684,7 +696,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -714,7 +726,7 @@ RSpec.describe "the lockfile format" do s.add_dependency "orm_adapter" end - update_git "ckeditor", path: lib_path("ckeditor"), remote: file_uri_for(@remote.path) + update_git "ckeditor", path: lib_path("ckeditor"), remote: @remote.path update_git "ckeditor", path: lib_path("ckeditor"), tag: "v4.0.7" old_git = update_git "ckeditor", path: lib_path("ckeditor"), push: "v4.0.7" @@ -728,7 +740,7 @@ RSpec.describe "the lockfile format" do new_git = update_git "ckeditor", path: lib_path("ckeditor"), push: "v4.0.8" gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "ckeditor", :git => "#{@remote.path}", :tag => "v4.0.8" G @@ -742,7 +754,7 @@ RSpec.describe "the lockfile format" do orm_adapter GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: orm_adapter (0.4.1) @@ -769,7 +781,7 @@ RSpec.describe "the lockfile format" do orm_adapter GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: orm_adapter (0.4.1) @@ -792,7 +804,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo-1.0")}" G @@ -803,7 +815,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -825,7 +837,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :path => "#{lib_path("foo-1.0")}" G @@ -840,7 +852,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -861,13 +873,13 @@ RSpec.describe "the lockfile format" do checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" c.no_checksum "bar", "1.0" - c.checksum gem_repo2, "rack", "1.0.0" + c.checksum gem_repo2, "myrack", "1.0.0" end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" - gem "rack" + gem "myrack" gem "foo", :path => "#{lib_path("foo-1.0")}" gem "bar", :git => "#{lib_path("bar-1.0")}" G @@ -885,9 +897,9 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} @@ -895,7 +907,7 @@ RSpec.describe "the lockfile format" do DEPENDENCIES bar! foo! - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -904,26 +916,26 @@ RSpec.describe "the lockfile format" do it "removes redundant sources" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" - gem "rack", :source => "#{file_uri_for(gem_repo2)}/" + gem "myrack", :source => "https://gem.repo2/" G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo2, "rack", "1.0.0" + c.checksum gem_repo2, "myrack", "1.0.0" end expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack! + myrack! #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -932,40 +944,40 @@ RSpec.describe "the lockfile format" do it "lists gems alphabetically" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" gem "thin" gem "actionpack" - gem "rack-obama" + gem "myrack-obama" G checksums = checksums_section_when_existing do |c| c.checksum gem_repo2, "actionpack", "2.3.2" c.checksum gem_repo2, "activesupport", "2.3.2" - c.checksum gem_repo2, "rack", "1.0.0" - c.checksum gem_repo2, "rack-obama", "1.0" + c.checksum gem_repo2, "myrack", "1.0.0" + c.checksum gem_repo2, "myrack-obama", "1.0" c.checksum gem_repo2, "thin", "1.0" end expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: actionpack (2.3.2) activesupport (= 2.3.2) activesupport (2.3.2) - rack (1.0.0) - rack-obama (1.0) - rack + myrack (1.0.0) + myrack-obama (1.0) + myrack thin (1.0) - rack + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES actionpack - rack-obama + myrack-obama thin #{checksums} BUNDLED WITH @@ -975,7 +987,7 @@ RSpec.describe "the lockfile format" do it "orders dependencies' dependencies in alphabetical order" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" gem "rails" G @@ -992,7 +1004,7 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: actionmailer (2.3.2) activesupport (= 2.3.2) @@ -1034,7 +1046,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2" gem 'double_deps' G @@ -1045,7 +1057,7 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: double_deps (1.0) net-ssh @@ -1065,29 +1077,29 @@ RSpec.describe "the lockfile format" do it "does not add the :require option to the lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" - gem "rack-obama", ">= 1.0", :require => "rack/obama" + gem "myrack-obama", ">= 1.0", :require => "myrack/obama" G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo2, "rack", "1.0.0" - c.checksum gem_repo2, "rack-obama", "1.0" + c.checksum gem_repo2, "myrack", "1.0.0" + c.checksum gem_repo2, "myrack-obama", "1.0" end expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) - rack-obama (1.0) - rack + myrack (1.0.0) + myrack-obama (1.0) + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack-obama (>= 1.0) + myrack-obama (>= 1.0) #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1096,29 +1108,29 @@ RSpec.describe "the lockfile format" do it "does not add the :group option to the lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" - gem "rack-obama", ">= 1.0", :group => :test + gem "myrack-obama", ">= 1.0", :group => :test G checksums = checksums_section_when_existing do |c| - c.checksum gem_repo2, "rack", "1.0.0" - c.checksum gem_repo2, "rack-obama", "1.0" + c.checksum gem_repo2, "myrack", "1.0.0" + c.checksum gem_repo2, "myrack-obama", "1.0" end expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) - rack-obama (1.0) - rack + myrack (1.0.0) + myrack-obama (1.0) + myrack PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack-obama (>= 1.0) + myrack-obama (>= 1.0) #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1133,7 +1145,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "foo" do gem "foo" end @@ -1146,7 +1158,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1168,7 +1180,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "../foo" do gem "foo" end @@ -1181,7 +1193,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1203,7 +1215,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path File.expand_path("foo", __dir__) do gem "foo" end @@ -1216,7 +1228,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1238,7 +1250,7 @@ RSpec.describe "the lockfile format" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec :path => "../foo" G @@ -1249,7 +1261,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: PLATFORMS @@ -1265,44 +1277,44 @@ RSpec.describe "the lockfile format" do it "keeps existing platforms in the lockfile" do checksums = checksums_section_when_existing do |c| - c.no_checksum "rack", "1.0.0" + c.no_checksum "myrack", "1.0.0" end lockfile <<-G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS java DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} G install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" - gem "rack" + gem "myrack" G - checksums.checksum(gem_repo2, "rack", "1.0.0") + checksums.checksum(gem_repo2, "myrack", "1.0.0") expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms("java", local_platform, defaults: [])} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1323,14 +1335,14 @@ RSpec.describe "the lockfile format" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "google-protobuf" G bundle "lock --add-platform x64-mingw-ucrt" expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: google-protobuf (3.25.1) google-protobuf (3.25.1-arm64-darwin-23) @@ -1359,7 +1371,7 @@ RSpec.describe "the lockfile format" do simulate_platform "universal-java-16" install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "platform_specific" G @@ -1369,7 +1381,7 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: platform_specific (1.0-universal-java-16) @@ -1387,33 +1399,33 @@ RSpec.describe "the lockfile format" do it "does not add duplicate gems" do checksums = checksums_section_when_existing do |c| c.checksum(gem_repo2, "activesupport", "2.3.5") - c.checksum(gem_repo2, "rack", "1.0.0") + c.checksum(gem_repo2, "myrack", "1.0.0") end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" - gem "rack" + source "https://gem.repo2/" + gem "myrack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" - gem "rack" + source "https://gem.repo2/" + gem "myrack" gem "activesupport" G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: activesupport (2.3.5) - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES activesupport - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1422,26 +1434,26 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies" do checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo2, "rack", "1.0.0") + c.checksum(gem_repo2, "myrack", "1.0.0") end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" - gem "rack" - gem "rack" + source "https://gem.repo2/" + gem "myrack" + gem "myrack" G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1450,26 +1462,26 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies with versions" do checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo2, "rack", "1.0.0") + c.checksum(gem_repo2, "myrack", "1.0.0") end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" - gem "rack", "1.0" - gem "rack", "1.0" + source "https://gem.repo2/" + gem "myrack", "1.0" + gem "myrack", "1.0" G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack (= 1.0) + myrack (= 1.0) #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1478,26 +1490,26 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies in different groups" do checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo2, "rack", "1.0.0") + c.checksum(gem_repo2, "myrack", "1.0.0") end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" - gem "rack", "1.0", :group => :one - gem "rack", "1.0", :group => :two + source "https://gem.repo2/" + gem "myrack", "1.0", :group => :one + gem "myrack", "1.0", :group => :two G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack (= 1.0) + myrack (= 1.0) #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1506,47 +1518,47 @@ RSpec.describe "the lockfile format" do it "raises if two different versions are used" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}/" - gem "rack", "1.0" - gem "rack", "1.1" + source "https://gem.repo2/" + gem "myrack", "1.0" + gem "myrack", "1.1" G expect(bundled_app_lock).not_to exist - expect(err).to include "rack (= 1.0) and rack (= 1.1)" + expect(err).to include "myrack (= 1.0) and myrack (= 1.1)" end it "raises if two different sources are used" do install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}/" - gem "rack" - gem "rack", :git => "git://hubz.com" + source "https://gem.repo2/" + gem "myrack" + gem "myrack", :git => "git://hubz.com" G expect(bundled_app_lock).not_to exist - expect(err).to include "rack (>= 0) should come from an unspecified source and git://hubz.com" + expect(err).to include "myrack (>= 0) should come from an unspecified source and git://hubz.com" end it "works correctly with multiple version dependencies" do checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo2, "rack", "0.9.1") + c.checksum(gem_repo2, "myrack", "0.9.1") end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" - gem "rack", "> 0.9", "< 1.0" + source "https://gem.repo2/" + gem "myrack", "> 0.9", "< 1.0" G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack (> 0.9, < 1.0) + myrack (> 0.9, < 1.0) #{checksums} BUNDLED WITH #{Bundler::VERSION} @@ -1555,26 +1567,26 @@ RSpec.describe "the lockfile format" do it "captures the Ruby version in the lockfile" do checksums = checksums_section_when_existing do |c| - c.checksum(gem_repo2, "rack", "0.9.1") + c.checksum(gem_repo2, "myrack", "0.9.1") end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}/" + source "https://gem.repo2/" ruby '#{Gem.ruby_version}' - gem "rack", "> 0.9", "< 1.0" + gem "myrack", "> 0.9", "< 1.0" G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack (> 0.9, < 1.0) + myrack (> 0.9, < 1.0) #{checksums} RUBY VERSION #{Bundler::RubyVersion.system} @@ -1587,24 +1599,24 @@ RSpec.describe "the lockfile format" do it "raises a helpful error message when the lockfile is missing deps" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack_middleware (1.0) + myrack_middleware (1.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack_middleware + myrack_middleware L install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}" - gem "rack_middleware" + source "https://gem.repo2" + gem "myrack_middleware" G - expect(err).to include("Downloading rack_middleware-1.0 revealed dependencies not in the API or the lockfile (#{Gem::Dependency.new("rack", "= 0.9.1")})."). - and include("Running `bundle update rack_middleware` should fix the problem.") + expect(err).to include("Downloading myrack_middleware-1.0 revealed dependencies not in the API or the lockfile (#{Gem::Dependency.new("myrack", "= 0.9.1")})."). + and include("Running `bundle update myrack_middleware` should fix the problem.") end it "regenerates a lockfile with no specs" do @@ -1620,7 +1632,7 @@ RSpec.describe "the lockfile format" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: PLATFORMS @@ -1634,14 +1646,14 @@ RSpec.describe "the lockfile format" do G install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "direct_dependency" G expect(lockfile).to eq <<~G GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: direct_dependency (4.5.6) indirect_dependency @@ -1669,14 +1681,14 @@ RSpec.describe "the lockfile format" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "minitest-bisect" G # Corrupt lockfile (completely missing path_expander) lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: minitest-bisect (1.6.0) @@ -1695,7 +1707,7 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: minitest-bisect (1.6.0) path_expander (~> 1.1) @@ -1735,13 +1747,13 @@ RSpec.describe "the lockfile format" do end gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "minitest-bisect" G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: minitest-bisect (1.6.0) path_expander (~> 1.1) @@ -1761,7 +1773,7 @@ RSpec.describe "the lockfile format" do expect(lockfile).to eq <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: minitest-bisect (1.6.0) path_expander (~> 1.1) @@ -1787,36 +1799,36 @@ RSpec.describe "the lockfile format" do build_repo2 install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "rack" + source "https://gem.repo2" + gem "myrack" G set_lockfile_mtime_to_known_value end it "generates Gemfile.lock with \\n line endings" do expect(File.read(bundled_app_lock)).not_to match("\r\n") - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end context "during updates" do it "preserves Gemfile.lock \\n line endings" do update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end end expect { bundle "update", all: true }.to change { File.mtime(bundled_app_lock) } expect(File.read(bundled_app_lock)).not_to match("\r\n") - expect(the_bundle).to include_gems "rack 1.2" + expect(the_bundle).to include_gems "myrack 1.2" end it "preserves Gemfile.lock \\n\\r line endings" do skip "needs to be adapted" if Gem.win_platform? update_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" + build_gem "myrack", "1.2" do |s| + s.executables = "myrackup" end end @@ -1827,7 +1839,7 @@ RSpec.describe "the lockfile format" do expect { bundle "update", all: true }.to change { File.mtime(bundled_app_lock) } expect(File.read(bundled_app_lock)).to match("\r\n") - expect(the_bundle).to include_gems "rack 1.2" + expect(the_bundle).to include_gems "myrack 1.2" end end @@ -1859,27 +1871,27 @@ RSpec.describe "the lockfile format" do it "refuses to install if Gemfile.lock contains conflict markers" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}// + remote: https://gem.repo2// specs: <<<<<<< - rack (1.0.0) + myrack (1.0.0) ======= - rack (1.0.1) + myrack (1.0.1) >>>>>>> PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH #{Bundler::VERSION} L install_gemfile <<-G, raise_on_error: false - source "#{file_uri_for(gem_repo2)}/" - gem "rack" + source "https://gem.repo2/" + gem "myrack" G expect(err).to match(/your Gemfile.lock contains merge conflicts/i) diff --git a/spec/bundler/other/ext_spec.rb b/spec/bundler/other/ext_spec.rb index 4d954b474f..9fc0414b4d 100644 --- a/spec/bundler/other/ext_spec.rb +++ b/spec/bundler/other/ext_spec.rb @@ -53,8 +53,8 @@ end RSpec.describe "Gem::SourceIndex#refresh!" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index e7577d38b4..192dc7413e 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -6,8 +6,8 @@ RSpec.describe "major deprecations" do describe "Bundler" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end @@ -114,8 +114,8 @@ RSpec.describe "major deprecations" do context "bundle check --path" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "check --path vendor/bundle", raise_on_error: false @@ -136,8 +136,8 @@ RSpec.describe "major deprecations" do context "bundle check --path=" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "check --path=vendor/bundle", raise_on_error: false @@ -158,8 +158,8 @@ RSpec.describe "major deprecations" do context "bundle cache --all" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "cache --all", raise_on_error: false @@ -180,8 +180,8 @@ RSpec.describe "major deprecations" do context "bundle cache --path" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "cache --path foo", raise_on_error: false @@ -300,8 +300,8 @@ RSpec.describe "major deprecations" do describe "bundle update" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end @@ -321,8 +321,8 @@ RSpec.describe "major deprecations" do describe "bundle install --binstubs" do before do install_gemfile <<-G, binstubs: true - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end @@ -335,9 +335,9 @@ RSpec.describe "major deprecations" do context "bundle install with both gems.rb and Gemfile present" do it "should not warn about gems.rb" do - create_file "gems.rb", <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + gemfile "gems.rb", <<-G + source "https://gem.repo1" + gem "myrack" G bundle :install @@ -345,17 +345,17 @@ RSpec.describe "major deprecations" do end it "should print a proper warning, and use gems.rb" do - create_file "gems.rb", "source \"#{file_uri_for(gem_repo1)}\"" + gemfile "gems.rb", "source 'https://gem.repo1'" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G expect(warnings).to include( "Multiple gemfiles (gems.rb and Gemfile) detected. Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.locked." ) - expect(the_bundle).not_to include_gem "rack 1.0" + expect(the_bundle).not_to include_gem "myrack 1.0" end end @@ -364,8 +364,8 @@ RSpec.describe "major deprecations" do bundle "config set --local path vendor/bundle" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end @@ -407,8 +407,8 @@ RSpec.describe "major deprecations" do context "bundle install with multiple sources" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo3)}" - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo3" + source "https://gem.repo1" G end @@ -455,28 +455,28 @@ RSpec.describe "major deprecations" do context "bundle install in frozen mode with a lockfile with a single rubygems section with multiple remotes" do before do build_repo gem_repo3 do - build_gem "rack", "0.9.1" + build_gem "myrack", "0.9.1" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - source "#{file_uri_for(gem_repo3)}" do - gem 'rack' + source "https://gem.repo1" + source "https://gem.repo3" do + gem 'myrack' end G lockfile <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ - remote: #{file_uri_for(gem_repo3)}/ + remote: https://gem.repo1/ + remote: https://gem.repo3/ specs: - rack (0.9.1) + myrack (0.9.1) PLATFORMS ruby DEPENDENCIES - rack! + myrack! BUNDLED WITH #{Bundler::VERSION} @@ -496,10 +496,10 @@ RSpec.describe "major deprecations" do context "when Bundler.setup is run in a ruby script" do before do - create_file "gems.rb", "source \"#{file_uri_for(gem_repo1)}\"" + create_file "gems.rb", "source 'https://gem.repo1'" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :group => :test + source "https://gem.repo1" + gem "myrack", :group => :test G ruby <<-RUBY @@ -537,8 +537,8 @@ RSpec.describe "major deprecations" do context "bundle show" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end @@ -558,14 +558,14 @@ RSpec.describe "major deprecations" do context "bundle remove" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end context "with --install" do it "shows a deprecation warning", bundler: "< 3" do - bundle "remove rack --install" + bundle "remove myrack --install" expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default." end @@ -590,7 +590,7 @@ RSpec.describe "major deprecations" do context "bundle viz", :realworld do before do realworld_system_gems "ruby-graphviz --version 1.2.5" - create_file "gems.rb", "source \"#{file_uri_for(gem_repo1)}\"" + create_file "gems.rb", "source 'https://gem.repo1'" bundle "viz" end diff --git a/spec/bundler/plugins/command_spec.rb b/spec/bundler/plugins/command_spec.rb index af132d6550..f8dacb0e51 100644 --- a/spec/bundler/plugins/command_spec.rb +++ b/spec/bundler/plugins/command_spec.rb @@ -18,7 +18,7 @@ RSpec.describe "command plugins" do end end - bundle "plugin install command-mah --source #{file_uri_for(gem_repo2)}" + bundle "plugin install command-mah --source https://gem.repo2" end it "executes without arguments" do @@ -29,7 +29,7 @@ RSpec.describe "command plugins" do end it "accepts the arguments" do - build_repo2 do + update_repo2 do build_plugin "the-echoer" do |s| s.write "plugins.rb", <<-RUBY module Resonance @@ -46,7 +46,7 @@ RSpec.describe "command plugins" do end end - bundle "plugin install the-echoer --source #{file_uri_for(gem_repo2)}" + bundle "plugin install the-echoer --source https://gem.repo2" expect(out).to include("Installed plugin the-echoer") bundle "echo tacos tofu lasange" @@ -54,7 +54,7 @@ RSpec.describe "command plugins" do end it "raises error on redeclaration of command" do - build_repo2 do + update_repo2 do build_plugin "copycat" do |s| s.write "plugins.rb", <<-RUBY module CopyCat @@ -69,7 +69,7 @@ RSpec.describe "command plugins" do end end - bundle "plugin install copycat --source #{file_uri_for(gem_repo2)}", raise_on_error: false + bundle "plugin install copycat --source https://gem.repo2", raise_on_error: false expect(out).not_to include("Installed plugin copycat") diff --git a/spec/bundler/plugins/hook_spec.rb b/spec/bundler/plugins/hook_spec.rb index 977fcefab3..3f9053bbc8 100644 --- a/spec/bundler/plugins/hook_spec.rb +++ b/spec/bundler/plugins/hook_spec.rb @@ -13,17 +13,17 @@ RSpec.describe "hook plugins" do end end - bundle "plugin install before-install-all-plugin --source #{file_uri_for(gem_repo2)}" + bundle "plugin install before-install-all-plugin --source https://gem.repo2" end it "runs before all rubygems are installed" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" - gem "rack" + gem "myrack" G - expect(out).to include "gems to be installed rake, rack" + expect(out).to include "gems to be installed rake, myrack" end end @@ -39,18 +39,18 @@ RSpec.describe "hook plugins" do end end - bundle "plugin install before-install-plugin --source #{file_uri_for(gem_repo2)}" + bundle "plugin install before-install-plugin --source https://gem.repo2" end it "runs before each rubygem is installed" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" - gem "rack" + gem "myrack" G expect(out).to include "installing gem rake" - expect(out).to include "installing gem rack" + expect(out).to include "installing gem myrack" end end @@ -66,17 +66,17 @@ RSpec.describe "hook plugins" do end end - bundle "plugin install after-install-all-plugin --source #{file_uri_for(gem_repo2)}" + bundle "plugin install after-install-all-plugin --source https://gem.repo2" end it "runs after each all rubygems are installed" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" - gem "rack" + gem "myrack" G - expect(out).to include "installed gems rake, rack" + expect(out).to include "installed gems rake, myrack" end end @@ -92,18 +92,18 @@ RSpec.describe "hook plugins" do end end - bundle "plugin install after-install-plugin --source #{file_uri_for(gem_repo2)}" + bundle "plugin install after-install-plugin --source https://gem.repo2" end it "runs after each rubygem is installed" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" - gem "rack" + gem "myrack" G expect(out).to include "installed gem rake : installed" - expect(out).to include "installed gem rack : installed" + expect(out).to include "installed gem myrack : installed" end end @@ -119,12 +119,12 @@ RSpec.describe "hook plugins" do end end - bundle "plugin install before-require-all-plugin --source #{file_uri_for(gem_repo2)}" + bundle "plugin install before-require-all-plugin --source https://gem.repo2" end it "runs before all rubygems are required" do install_gemfile_and_bundler_require - expect(out).to include "gems to be required rake, rack" + expect(out).to include "gems to be required rake, myrack" end end @@ -140,13 +140,13 @@ RSpec.describe "hook plugins" do end end - bundle "plugin install before-require-plugin --source #{file_uri_for(gem_repo2)}" + bundle "plugin install before-require-plugin --source https://gem.repo2" end it "runs before each rubygem is required" do install_gemfile_and_bundler_require expect(out).to include "requiring gem rake" - expect(out).to include "requiring gem rack" + expect(out).to include "requiring gem myrack" end end @@ -162,12 +162,12 @@ RSpec.describe "hook plugins" do end end - bundle "plugin install after-require-all-plugin --source #{file_uri_for(gem_repo2)}" + bundle "plugin install after-require-all-plugin --source https://gem.repo2" end it "runs after all rubygems are required" do install_gemfile_and_bundler_require - expect(out).to include "required gems rake, rack" + expect(out).to include "required gems rake, myrack" end end @@ -183,21 +183,21 @@ RSpec.describe "hook plugins" do end end - bundle "plugin install after-require-plugin --source #{file_uri_for(gem_repo2)}" + bundle "plugin install after-require-plugin --source https://gem.repo2" end it "runs after each rubygem is required" do install_gemfile_and_bundler_require expect(out).to include "required gem rake" - expect(out).to include "required gem rack" + expect(out).to include "required gem myrack" end end def install_gemfile_and_bundler_require install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" - gem "rack" + gem "myrack" G ruby <<-RUBY diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb index 20c2f1fd26..d0de607e6c 100644 --- a/spec/bundler/plugins/install_spec.rb +++ b/spec/bundler/plugins/install_spec.rb @@ -9,28 +9,28 @@ RSpec.describe "bundler plugin install" do end it "shows proper message when gem in not found in the source" do - bundle "plugin install no-foo --source #{file_uri_for(gem_repo1)}", raise_on_error: false + bundle "plugin install no-foo --source https://gem.repo1", raise_on_error: false expect(err).to include("Could not find") plugin_should_not_be_installed("no-foo") end it "installs from rubygems source" do - bundle "plugin install foo --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo --source https://gem.repo2" expect(out).to include("Installed plugin foo") plugin_should_be_installed("foo") end it "installs from rubygems source in frozen mode" do - bundle "plugin install foo --source #{file_uri_for(gem_repo2)}", env: { "BUNDLE_DEPLOYMENT" => "true" } + bundle "plugin install foo --source https://gem.repo2", env: { "BUNDLE_DEPLOYMENT" => "true" } expect(out).to include("Installed plugin foo") plugin_should_be_installed("foo") end it "installs from sources configured as Gem.sources without any flags" do - bundle "plugin install foo", env: { "BUNDLER_SPEC_GEM_SOURCES" => file_uri_for(gem_repo2).to_s } + bundle "plugin install foo", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_SOURCES" => "https://gem.repo2" } expect(out).to include("Installed plugin foo") plugin_should_be_installed("foo") @@ -45,18 +45,18 @@ RSpec.describe "bundler plugin install" do context "plugin is already installed" do before do - bundle "plugin install foo --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo --source https://gem.repo2" end it "doesn't install plugin again" do - bundle "plugin install foo --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo --source https://gem.repo2" expect(out).not_to include("Installing plugin foo") expect(out).not_to include("Installed plugin foo") end end it "installs multiple plugins" do - bundle "plugin install foo kung-foo --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo kung-foo --source https://gem.repo2" expect(out).to include("Installed plugin foo") expect(out).to include("Installed plugin kung-foo") @@ -70,7 +70,7 @@ RSpec.describe "bundler plugin install" do build_plugin "kung-foo", "1.1" end - bundle "plugin install foo kung-foo --version '1.0' --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo kung-foo --version '1.0' --source https://gem.repo2" expect(out).to include("Installing foo 1.0") expect(out).to include("Installing kung-foo 1.0") @@ -82,18 +82,18 @@ RSpec.describe "bundler plugin install" do build_plugin "foo", "1.1" end - bundle "plugin install foo --version 1.0 --source #{file_uri_for(gem_repo2)} --verbose" + bundle "plugin install foo --version 1.0 --source https://gem.repo2 --verbose" expect(out).to include("Installing foo 1.0") - bundle "plugin install foo --source #{file_uri_for(gem_repo2)} --verbose" + bundle "plugin install foo --source https://gem.repo2 --verbose" expect(out).to include("Installing foo 1.1") - bundle "plugin install foo --source #{file_uri_for(gem_repo2)} --verbose" + bundle "plugin install foo --source https://gem.repo2 --verbose" expect(out).to include("Using foo 1.1") end it "raises an error when when --branch specified" do - bundle "plugin install foo --branch main --source #{file_uri_for(gem_repo2)}", raise_on_error: false + bundle "plugin install foo --branch main --source https://gem.repo2", raise_on_error: false expect(out).not_to include("Installed plugin foo") @@ -101,13 +101,13 @@ RSpec.describe "bundler plugin install" do end it "raises an error when --ref specified" do - bundle "plugin install foo --ref v1.2.3 --source #{file_uri_for(gem_repo2)}", raise_on_error: false + bundle "plugin install foo --ref v1.2.3 --source https://gem.repo2", raise_on_error: false expect(err).to include("--ref can only be used with git sources") end it "raises error when both --branch and --ref options are specified" do - bundle "plugin install foo --source #{file_uri_for(gem_repo2)} --branch main --ref v1.2.3", raise_on_error: false + bundle "plugin install foo --source https://gem.repo2 --branch main --ref v1.2.3", raise_on_error: false expect(out).not_to include("Installed plugin foo") @@ -131,7 +131,7 @@ RSpec.describe "bundler plugin install" do s.write("src/fubar.rb") end end - bundle "plugin install testing --source #{file_uri_for(gem_repo2)}" + bundle "plugin install testing --source https://gem.repo2" bundle "check2", "no-color" => false expect(out).to eq("mate") @@ -144,17 +144,17 @@ RSpec.describe "bundler plugin install" do build_plugin "kung-foo", "1.1" end - bundle "plugin install foo kung-foo --version '1.0' --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo kung-foo --version '1.0' --source https://gem.repo2" expect(out).to include("Installing foo 1.0") expect(out).to include("Installing kung-foo 1.0") plugin_should_be_installed("foo", "kung-foo") - build_repo2 do + update_repo2 do build_gem "charlie" end - bundle "plugin install charlie --source #{file_uri_for(gem_repo2)}", raise_on_error: false + bundle "plugin install charlie --source https://gem.repo2", raise_on_error: false expect(err).to include("Failed to install plugin `charlie`, due to Bundler::Plugin::MalformattedPlugin (plugins.rb was not found in the plugin.)") @@ -173,7 +173,7 @@ RSpec.describe "bundler plugin install" do end end - bundle "plugin install chaplin --source #{file_uri_for(gem_repo2)}", raise_on_error: false + bundle "plugin install chaplin --source https://gem.repo2", raise_on_error: false expect(global_plugin_gem("chaplin-1.0")).not_to be_directory @@ -187,7 +187,7 @@ RSpec.describe "bundler plugin install" do s.write "plugins.rb" end - bundle "plugin install foo --git #{file_uri_for(lib_path("foo-1.0"))}" + bundle "plugin install foo --git #{lib_path("foo-1.0")}" expect(out).to include("Installed plugin foo") plugin_should_be_installed("foo") @@ -257,9 +257,9 @@ RSpec.describe "bundler plugin install" do it "installs plugins listed in gemfile" do gemfile <<-G - source '#{file_uri_for(gem_repo2)}' + source 'https://gem.repo2' plugin 'foo' - gem 'rack', "1.0.0" + gem 'myrack', "1.0.0" G bundle "install" @@ -268,7 +268,7 @@ RSpec.describe "bundler plugin install" do expect(out).to include("Bundle complete!") - expect(the_bundle).to include_gems("rack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0") plugin_should_be_installed("foo") end @@ -278,7 +278,7 @@ RSpec.describe "bundler plugin install" do end gemfile <<-G - source '#{file_uri_for(gem_repo2)}' + source 'https://gem.repo2' plugin 'foo', "1.0" G @@ -297,7 +297,7 @@ RSpec.describe "bundler plugin install" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" plugin 'ga-plugin', :git => "#{lib_path("ga-plugin-1.0")}" G @@ -311,7 +311,7 @@ RSpec.describe "bundler plugin install" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" plugin 'ga-plugin', :path => "#{lib_path("ga-plugin-1.0")}" G @@ -326,7 +326,7 @@ RSpec.describe "bundler plugin install" do path = lib_path("ga-plugin-1.0").relative_path_from(bundled_app) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" plugin 'ga-plugin', :path => "#{path}" G @@ -337,22 +337,22 @@ RSpec.describe "bundler plugin install" do context "in deployment mode" do it "installs plugins" do install_gemfile <<-G - source '#{file_uri_for(gem_repo2)}' - gem 'rack', "1.0.0" + source 'https://gem.repo2' + gem 'myrack', "1.0.0" G bundle "config set --local deployment true" install_gemfile <<-G - source '#{file_uri_for(gem_repo2)}' + source 'https://gem.repo2' plugin 'foo' - gem 'rack', "1.0.0" + gem 'myrack', "1.0.0" G expect(out).to include("Installed plugin foo") expect(out).to include("Bundle complete!") - expect(the_bundle).to include_gems("rack 1.0.0") + expect(the_bundle).to include_gems("myrack 1.0.0") plugin_should_be_installed("foo") end end @@ -364,12 +364,12 @@ RSpec.describe "bundler plugin install" do require "bundler/inline" gemfile do - source '#{file_uri_for(gem_repo2)}' + source 'https://gem.repo2' plugin 'foo' end RUBY - ruby code, env: { "BUNDLER_VERSION" => Bundler::VERSION } + ruby code, artifice: "compact_index", env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(local_plugin_gem("foo-1.0", "plugins.rb")).to exist end end @@ -378,7 +378,7 @@ RSpec.describe "bundler plugin install" do it "is installed when inside an app" do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) gemfile "" - bundle "plugin install foo --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo --source https://gem.repo2" plugin_should_be_installed("foo") expect(local_plugin_gem("foo-1.0")).to be_directory @@ -401,7 +401,7 @@ RSpec.describe "bundler plugin install" do end # inside the app - gemfile "source '#{file_uri_for(gem_repo2)}'\nplugin 'fubar'" + gemfile "source 'https://gem.repo2'\nplugin 'fubar'" bundle "install" update_repo2 do @@ -419,7 +419,7 @@ RSpec.describe "bundler plugin install" do end # outside the app - bundle "plugin install fubar --source #{file_uri_for(gem_repo2)}", dir: tmp + bundle "plugin install fubar --source https://gem.repo2", dir: tmp end it "inside the app takes precedence over global plugin" do diff --git a/spec/bundler/plugins/list_spec.rb b/spec/bundler/plugins/list_spec.rb index 4a686415ad..30e3f82467 100644 --- a/spec/bundler/plugins/list_spec.rb +++ b/spec/bundler/plugins/list_spec.rb @@ -38,7 +38,7 @@ RSpec.describe "bundler plugin list" do context "single plugin installed" do it "shows plugin name with commands list" do - bundle "plugin install foo --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo --source https://gem.repo2" plugin_should_be_installed("foo") bundle "plugin list" @@ -49,7 +49,7 @@ RSpec.describe "bundler plugin list" do context "multiple plugins installed" do it "shows plugin names with commands list" do - bundle "plugin install foo bar --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo bar --source https://gem.repo2" plugin_should_be_installed("foo", "bar") bundle "plugin list" diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb index e569f3e415..17a1f23221 100644 --- a/spec/bundler/plugins/source/example_spec.rb +++ b/spec/bundler/plugins/source/example_spec.rb @@ -52,7 +52,7 @@ RSpec.describe "real source plugins" do build_lib "a-path-gem" gemfile <<-G - source "#{file_uri_for(gem_repo2)}" # plugin source + source "https://gem.repo2" # plugin source source "#{lib_path("a-path-gem-1.0")}", :type => :mpath do gem "a-path-gem" end @@ -82,7 +82,7 @@ RSpec.describe "real source plugins" do a-path-gem (1.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: PLATFORMS @@ -110,7 +110,7 @@ RSpec.describe "real source plugins" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" # plugin source + source "https://gem.repo2" # plugin source source "#{lib_path("gem_with_bin-1.0")}", :type => :mpath do gem "gem_with_bin" end @@ -170,7 +170,7 @@ RSpec.describe "real source plugins" do a-path-gem (1.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: PLATFORMS @@ -323,8 +323,8 @@ RSpec.describe "real source plugins" do build_git "ma-gitp-gem" gemfile <<-G - source "#{file_uri_for(gem_repo2)}" # plugin source - source "#{file_uri_for(lib_path("ma-gitp-gem-1.0"))}", :type => :gitp do + source "https://gem.repo2" # plugin source + source "#{lib_path("ma-gitp-gem-1.0")}", :type => :gitp do gem "ma-gitp-gem" end G @@ -346,14 +346,14 @@ RSpec.describe "real source plugins" do expect(lockfile).to eq <<~G PLUGIN SOURCE - remote: #{file_uri_for(lib_path("ma-gitp-gem-1.0"))} + remote: #{lib_path("ma-gitp-gem-1.0")} type: gitp revision: #{revision} specs: ma-gitp-gem (1.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: PLATFORMS @@ -372,14 +372,14 @@ RSpec.describe "real source plugins" do revision = revision_for(lib_path("ma-gitp-gem-1.0")) lockfile <<-G PLUGIN SOURCE - remote: #{file_uri_for(lib_path("ma-gitp-gem-1.0"))} + remote: #{lib_path("ma-gitp-gem-1.0")} type: gitp revision: #{revision} specs: ma-gitp-gem (1.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: PLATFORMS @@ -423,8 +423,8 @@ RSpec.describe "real source plugins" do it "updates the deps on change in gemfile" do update_git "ma-gitp-gem", "1.1", path: lib_path("ma-gitp-gem-1.0"), gemspec: true gemfile <<-G - source "#{file_uri_for(gem_repo2)}" # plugin source - source "#{file_uri_for(lib_path("ma-gitp-gem-1.0"))}", :type => :gitp do + source "https://gem.repo2" # plugin source + source "#{lib_path("ma-gitp-gem-1.0")}", :type => :gitp do gem "ma-gitp-gem", "1.1" end G @@ -440,7 +440,7 @@ RSpec.describe "real source plugins" do ref = git.ref_for("main", 11) install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" # plugin source + source "https://gem.repo2" # plugin source source '#{lib_path("foo-1.0")}', :type => :gitp do gem "foo" end diff --git a/spec/bundler/plugins/source_spec.rb b/spec/bundler/plugins/source_spec.rb index 14643e5c81..995e50e653 100644 --- a/spec/bundler/plugins/source_spec.rb +++ b/spec/bundler/plugins/source_spec.rb @@ -16,8 +16,8 @@ RSpec.describe "bundler source plugin" do it "installs bundler-source-* gem when no handler for source is present" do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - source "#{file_uri_for(lib_path("gitp"))}", :type => :psource do + source "https://gem.repo2" + source "#{lib_path("gitp")}", :type => :psource do end G @@ -38,8 +38,8 @@ RSpec.describe "bundler source plugin" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - source "#{file_uri_for(lib_path("gitp"))}", :type => :psource do + source "https://gem.repo2" + source "#{lib_path("gitp")}", :type => :psource do end G @@ -62,11 +62,11 @@ RSpec.describe "bundler source plugin" do context "explicit presence in gemfile" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" plugin "another-psource" - source "#{file_uri_for(lib_path("gitp"))}", :type => :psource do + source "#{lib_path("gitp")}", :type => :psource do end G end @@ -88,11 +88,11 @@ RSpec.describe "bundler source plugin" do context "explicit default source" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" plugin "bundler-source-psource" - source "#{file_uri_for(lib_path("gitp"))}", :type => :psource do + source "#{lib_path("gitp")}", :type => :psource do end G end diff --git a/spec/bundler/plugins/uninstall_spec.rb b/spec/bundler/plugins/uninstall_spec.rb index 555c6a7002..dedcc9f37c 100644 --- a/spec/bundler/plugins/uninstall_spec.rb +++ b/spec/bundler/plugins/uninstall_spec.rb @@ -14,7 +14,7 @@ RSpec.describe "bundler plugin uninstall" do end it "uninstalls specified plugins" do - bundle "plugin install foo kung-foo --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo kung-foo --source https://gem.repo2" plugin_should_be_installed("foo") plugin_should_be_installed("kung-foo") @@ -40,9 +40,9 @@ RSpec.describe "bundler plugin uninstall" do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) install_gemfile <<-G - source '#{file_uri_for(gem_repo2)}' + source 'https://gem.repo2' plugin 'path_plugin', :path => "#{path}" - gem 'rack', '1.0.0' + gem 'myrack', '1.0.0' G plugin_should_be_installed("path_plugin") @@ -57,7 +57,7 @@ RSpec.describe "bundler plugin uninstall" do describe "with --all" do it "uninstalls all installed plugins" do - bundle "plugin install foo kung-foo --source #{file_uri_for(gem_repo2)}" + bundle "plugin install foo kung-foo --source https://gem.repo2" plugin_should_be_installed("foo") plugin_should_be_installed("kung-foo") diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index 7cdb993017..c7fce17b62 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -236,6 +236,21 @@ RSpec.describe "The library itself" do expect(all_bad_requires).to be_empty, "#{all_bad_requires.size} internal requires that should use `require_relative`: #{all_bad_requires}" end + # We don't want our artifice code to activate bundler, but it needs to use the + # namespaced implementation of `Net::HTTP`. So we duplicate the file in + # bundler that loads that. + it "keeps vendored_net_http spec code in sync with the lib implementation" do + lib_implementation_path = File.join(source_lib_dir, "bundler", "vendored_net_http.rb") + expect(File.exist?(lib_implementation_path)).to be_truthy + lib_code = File.read(lib_implementation_path) + + spec_implementation_path = File.join(spec_dir, "support", "vendored_net_http.rb") + expect(File.exist?(spec_implementation_path)).to be_truthy + spec_code = File.read(spec_implementation_path) + + expect(lib_code).to eq(spec_code) + end + private def each_line(filename, &block) diff --git a/spec/bundler/resolver/basic_spec.rb b/spec/bundler/resolver/basic_spec.rb index 4a0dd37bf9..f152907d35 100644 --- a/spec/bundler/resolver/basic_spec.rb +++ b/spec/bundler/resolver/basic_spec.rb @@ -6,15 +6,15 @@ RSpec.describe "Resolving" do end it "resolves a single gem" do - dep "rack" + dep "myrack" - should_resolve_as %w[rack-1.1] + should_resolve_as %w[myrack-1.1] end it "resolves a gem with dependencies" do dep "actionpack" - should_resolve_as %w[actionpack-2.3.5 activesupport-2.3.5 rack-1.0] + should_resolve_as %w[actionpack-2.3.5 activesupport-2.3.5 myrack-1.0] end it "resolves a conflicting index" do @@ -84,7 +84,7 @@ RSpec.describe "Resolving" do dep "activesupport", "= 3.0.0.beta" dep "actionpack" - should_resolve_as %w[activesupport-3.0.0.beta actionpack-3.0.0.beta rack-1.1 rack-mount-0.6] + should_resolve_as %w[activesupport-3.0.0.beta actionpack-3.0.0.beta myrack-1.1 myrack-mount-0.6] end it "prefers non-pre-releases when doing conservative updates" do @@ -313,10 +313,10 @@ RSpec.describe "Resolving" do it "handles versions that redundantly depend on themselves" do @index = build_index do - gem "rack", "3.0.0" + gem "myrack", "3.0.0" gem "standalone_migrations", "7.1.0" do - dep "rack", "~> 2.0" + dep "myrack", "~> 2.0" end gem "standalone_migrations", "2.0.4" do @@ -324,22 +324,22 @@ RSpec.describe "Resolving" do end gem "standalone_migrations", "1.0.13" do - dep "rack", ">= 0" + dep "myrack", ">= 0" end end - dep "rack", "~> 3.0" + dep "myrack", "~> 3.0" dep "standalone_migrations" - should_resolve_as %w[rack-3.0.0 standalone_migrations-2.0.4] + should_resolve_as %w[myrack-3.0.0 standalone_migrations-2.0.4] end it "ignores versions that incorrectly depend on themselves" do @index = build_index do - gem "rack", "3.0.0" + gem "myrack", "3.0.0" gem "standalone_migrations", "7.1.0" do - dep "rack", "~> 2.0" + dep "myrack", "~> 2.0" end gem "standalone_migrations", "2.0.4" do @@ -347,22 +347,22 @@ RSpec.describe "Resolving" do end gem "standalone_migrations", "1.0.13" do - dep "rack", ">= 0" + dep "myrack", ">= 0" end end - dep "rack", "~> 3.0" + dep "myrack", "~> 3.0" dep "standalone_migrations" - should_resolve_as %w[rack-3.0.0 standalone_migrations-1.0.13] + should_resolve_as %w[myrack-3.0.0 standalone_migrations-1.0.13] end it "does not ignore versions that incorrectly depend on themselves when dependency_api is not available" do @index = build_index do - gem "rack", "3.0.0" + gem "myrack", "3.0.0" gem "standalone_migrations", "7.1.0" do - dep "rack", "~> 2.0" + dep "myrack", "~> 2.0" end gem "standalone_migrations", "2.0.4" do @@ -370,13 +370,13 @@ RSpec.describe "Resolving" do end gem "standalone_migrations", "1.0.13" do - dep "rack", ">= 0" + dep "myrack", ">= 0" end end - dep "rack", "~> 3.0" + dep "myrack", "~> 3.0" dep "standalone_migrations" - should_resolve_without_dependency_api %w[rack-3.0.0 standalone_migrations-2.0.4] + should_resolve_without_dependency_api %w[myrack-3.0.0 standalone_migrations-2.0.4] end end diff --git a/spec/bundler/runtime/executable_spec.rb b/spec/bundler/runtime/executable_spec.rb index 36ce6dcf67..b11c48539a 100644 --- a/spec/bundler/runtime/executable_spec.rb +++ b/spec/bundler/runtime/executable_spec.rb @@ -3,83 +3,83 @@ RSpec.describe "Running bin/* commands" do before :each do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end it "runs the bundled command when in the bundle" do - bundle "binstubs rack" + bundle "binstubs myrack" - build_gem "rack", "2.0", to_system: true do |s| - s.executables = "rackup" + build_gem "myrack", "2.0", to_system: true do |s| + s.executables = "myrackup" end - gembin "rackup" + gembin "myrackup" expect(out).to eq("1.0.0") end it "allows the location of the gem stubs to be specified" do - bundle "binstubs rack", path: "gbin" + bundle "binstubs myrack", path: "gbin" expect(bundled_app("bin")).not_to exist - expect(bundled_app("gbin/rackup")).to exist + expect(bundled_app("gbin/myrackup")).to exist - gembin bundled_app("gbin/rackup") + gembin bundled_app("gbin/myrackup") expect(out).to eq("1.0.0") end it "allows absolute paths as a specification of where to install bin stubs" do - bundle "binstubs rack", path: tmp("bin") + bundle "binstubs myrack", path: tmp("bin") - gembin tmp("bin/rackup") + gembin tmp("bin/myrackup") expect(out).to eq("1.0.0") end it "uses the default ruby install name when shebang is not specified" do - bundle "binstubs rack" - expect(File.readlines(bundled_app("bin/rackup")).first).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n") + bundle "binstubs myrack" + expect(File.readlines(bundled_app("bin/myrackup")).first).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n") end it "allows the name of the shebang executable to be specified" do - bundle "binstubs rack", shebang: "ruby-foo" - expect(File.readlines(bundled_app("bin/rackup")).first).to eq("#!/usr/bin/env ruby-foo\n") + bundle "binstubs myrack", shebang: "ruby-foo" + expect(File.readlines(bundled_app("bin/myrackup")).first).to eq("#!/usr/bin/env ruby-foo\n") end it "runs the bundled command when out of the bundle" do - bundle "binstubs rack" + bundle "binstubs myrack" - build_gem "rack", "2.0", to_system: true do |s| - s.executables = "rackup" + build_gem "myrack", "2.0", to_system: true do |s| + s.executables = "myrackup" end - gembin "rackup", dir: tmp + gembin "myrackup", dir: tmp expect(out).to eq("1.0.0") end it "works with gems in path" do - build_lib "rack", path: lib_path("rack") do |s| - s.executables = "rackup" + build_lib "myrack", path: lib_path("myrack") do |s| + s.executables = "myrackup" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :path => "#{lib_path("rack")}" + source "https://gem.repo1" + gem "myrack", :path => "#{lib_path("myrack")}" G - bundle "binstubs rack" + bundle "binstubs myrack" - build_gem "rack", "2.0", to_system: true do |s| - s.executables = "rackup" + build_gem "myrack", "2.0", to_system: true do |s| + s.executables = "myrackup" end - gembin "rackup" + gembin "myrackup" expect(out).to eq("1.0") end it "creates a bundle binstub" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bundler" G @@ -91,17 +91,17 @@ RSpec.describe "Running bin/* commands" do it "does not generate bin stubs if the option was not specified" do bundle "install" - expect(bundled_app("bin/rackup")).not_to exist + expect(bundled_app("bin/myrackup")).not_to exist end it "allows you to stop installing binstubs", bundler: "< 3" do skip "delete permission error" if Gem.win_platform? bundle "install --binstubs bin/" - bundled_app("bin/rackup").rmtree + bundled_app("bin/myrackup").rmtree bundle "install --binstubs \"\"" - expect(bundled_app("bin/rackup")).not_to exist + expect(bundled_app("bin/myrackup")).not_to exist bundle "config bin" expect(out).to include("You have not configured a value for `bin`") @@ -109,34 +109,34 @@ RSpec.describe "Running bin/* commands" do it "remembers that the option was specified", bundler: "< 3" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" G bundle :install, binstubs: "bin" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" - gem "rack" + gem "myrack" G bundle "install" - expect(bundled_app("bin/rackup")).to exist + expect(bundled_app("bin/myrackup")).to exist end it "rewrites bins on binstubs (to maintain backwards compatibility)" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G - create_file("bin/rackup", "OMG") + create_file("bin/myrackup", "OMG") - bundle "binstubs rack" + bundle "binstubs myrack" - expect(bundled_app("bin/rackup").read).to_not eq("OMG") + expect(bundled_app("bin/myrackup").read).to_not eq("OMG") end it "use BUNDLE_GEMFILE gemfile for binstub" do @@ -148,8 +148,8 @@ RSpec.describe "Running bin/* commands" do build_gem("bindir") {|s| s.executables = "foo" } end - create_file("OtherGemfile", <<-G) - source "#{file_uri_for(gem_repo2)}" + gemfile("OtherGemfile", <<-G) + source "https://gem.repo2" gem 'bindir' G diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb index d086a72c9c..1dffbd5c92 100644 --- a/spec/bundler/runtime/gem_tasks_spec.rb +++ b/spec/bundler/runtime/gem_tasks_spec.rb @@ -20,7 +20,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" G @@ -86,7 +86,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "works", :ruby_repo do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake" G diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb index 50a5258dc7..f85eaf132d 100644 --- a/spec/bundler/runtime/inline_spec.rb +++ b/spec/bundler/runtime/inline_spec.rb @@ -2,10 +2,9 @@ RSpec.describe "bundler/inline#gemfile" do def script(code, options = {}) - requires = ["bundler/inline"] - requires.unshift "#{spec_dir}/support/artifice/" + options.delete(:artifice) if options.key?(:artifice) - requires = requires.map {|r| "require '#{r}'" }.join("\n") - ruby("#{requires}\n\n" + code, options) + options[:artifice] ||= "compact_index" + options[:env] ||= { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } + ruby("require 'bundler/inline'\n\n" + code, options) end before :each do @@ -48,7 +47,7 @@ RSpec.describe "bundler/inline#gemfile" do it "requires the gems" do script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "two" end @@ -59,7 +58,7 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY, raise_on_error: false gemfile do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "eleven" end @@ -73,12 +72,12 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile(true) do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end RUBY - expect(out).to include("Rack's post install message") + expect(out).to include("Myrack's post install message") script <<-RUBY, artifice: "endpoint" gemfile(true) do @@ -143,7 +142,7 @@ RSpec.describe "bundler/inline#gemfile" do require 'bundler' options = { :ui => Bundler::UI::Shell.new } gemfile(false, options) do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "two" end @@ -157,11 +156,11 @@ RSpec.describe "bundler/inline#gemfile" do it "installs quietly if necessary when the install option is not set" do script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end - puts RACK + puts MYRACK RUBY expect(out).to eq("1.0.0") @@ -170,21 +169,21 @@ RSpec.describe "bundler/inline#gemfile" do it "installs subdependencies quietly if necessary when the install option is not set" do build_repo4 do - build_gem "rack" do |s| - s.add_dependency "rackdep" + build_gem "myrack" do |s| + s.add_dependency "myrackdep" end - build_gem "rackdep", "1.0.0" + build_gem "myrackdep", "1.0.0" end - script <<-RUBY + script <<-RUBY, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } gemfile do - source "#{file_uri_for(gem_repo4)}" - gem "rack" + source "https://gem.repo4" + gem "myrack" end - require "rackdep" - puts RACKDEP + require "myrackdep" + puts MYRACKDEP RUBY expect(out).to eq("1.0.0") @@ -193,23 +192,23 @@ RSpec.describe "bundler/inline#gemfile" do it "installs subdependencies quietly if necessary when the install option is not set, and multiple sources used" do build_repo4 do - build_gem "rack" do |s| - s.add_dependency "rackdep" + build_gem "myrack" do |s| + s.add_dependency "myrackdep" end - build_gem "rackdep", "1.0.0" + build_gem "myrackdep", "1.0.0" end - script <<-RUBY + script <<-RUBY, artifice: "compact_index_extra_api" gemfile do - source "#{file_uri_for(gem_repo1)}" - source "#{file_uri_for(gem_repo4)}" do - gem "rack" + source "https://test.repo" + source "https://test.repo/extra" do + gem "myrack" end end - require "rackdep" - puts RACKDEP + require "myrackdep" + puts MYRACKDEP RUBY expect(out).to eq("1.0.0") @@ -221,7 +220,7 @@ RSpec.describe "bundler/inline#gemfile" do baz_ref = build_git("baz", "2.0.0").ref_for("HEAD") script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => #{lib_path("foo-1.0.0").to_s.dump} gem "baz", :git => #{lib_path("baz-2.0.0").to_s.dump}, :ref => #{baz_ref.dump} end @@ -238,14 +237,14 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile do path "#{lib_path}" do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "two" end end gemfile do path "#{lib_path}" do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "four" end end @@ -256,7 +255,7 @@ RSpec.describe "bundler/inline#gemfile" do end it "doesn't reinstall already installed gems" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" script <<-RUBY require 'bundler' @@ -264,65 +263,65 @@ RSpec.describe "bundler/inline#gemfile" do ui.level = "confirm" gemfile(true, ui: ui) do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" - gem "rack" + gem "myrack" end RUBY expect(out).to include("Installing activesupport") - expect(out).not_to include("Installing rack") + expect(out).not_to include("Installing myrack") expect(err).to be_empty end it "installs gems in later gemfile calls" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" script <<-RUBY require 'bundler' ui = Bundler::UI::Shell.new ui.level = "confirm" gemfile(true, ui: ui) do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end gemfile(true, ui: ui) do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" end RUBY expect(out).to include("Installing activesupport") - expect(out).not_to include("Installing rack") + expect(out).not_to include("Installing myrack") expect(err).to be_empty end it "doesn't reinstall already installed gems in later gemfile calls" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" script <<-RUBY require 'bundler' ui = Bundler::UI::Shell.new ui.level = "confirm" gemfile(true, ui: ui) do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" end gemfile(true, ui: ui) do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end RUBY expect(out).to include("Installing activesupport") - expect(out).not_to include("Installing rack") + expect(out).not_to include("Installing myrack") expect(err).to be_empty end it "installs gems with native extensions in later gemfile calls" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" build_git "foo" do |s| s.add_dependency "rake" @@ -343,12 +342,12 @@ RSpec.describe "bundler/inline#gemfile" do ui = Bundler::UI::Shell.new ui.level = "confirm" gemfile(true, ui: ui) do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end gemfile(true, ui: ui) do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" end @@ -386,11 +385,11 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end - puts RACK + puts MYRACK RUBY expect(err).to be_empty @@ -420,7 +419,7 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile(true) do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rake", "#{rake_version}" end RUBY @@ -431,26 +430,26 @@ RSpec.describe "bundler/inline#gemfile" do end it "installs inline gems when frozen is set" do - script <<-RUBY, env: { "BUNDLE_FROZEN" => "true" } + script <<-RUBY, env: { "BUNDLE_FROZEN" => "true", "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end - puts RACK + puts MYRACK RUBY expect(last_command.stderr).to be_empty end it "installs inline gems when deployment is set" do - script <<-RUBY, env: { "BUNDLE_DEPLOYMENT" => "true" } + script <<-RUBY, env: { "BUNDLE_DEPLOYMENT" => "true", "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end - puts RACK + puts MYRACK RUBY expect(last_command.stderr).to be_empty @@ -461,11 +460,11 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end - puts RACK + puts MYRACK RUBY expect(err).to be_empty @@ -476,11 +475,11 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" # has the rackup executable + source "https://gem.repo1" + gem "myrack" # has the myrackup executable end - puts RACK + puts MYRACK RUBY expect(last_command).to be_success expect(out).to eq "1.0.0" @@ -488,14 +487,14 @@ RSpec.describe "bundler/inline#gemfile" do context "when BUNDLE_PATH is set" do it "installs inline gems to the system path regardless" do - script <<-RUBY, env: { "BUNDLE_PATH" => "./vendor/inline" } + script <<-RUBY, env: { "BUNDLE_PATH" => "./vendor/inline", "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } gemfile(true) do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end RUBY expect(last_command).to be_success - expect(system_gem_path("gems/rack-1.0.0")).to exist + expect(system_gem_path("gems/myrack-1.0.0")).to exist end end @@ -504,8 +503,8 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile(true) do - source "#{file_uri_for(gem_repo1)}" - gem "rack", platform: :jruby + source "https://gem.repo1" + gem "myrack", platform: :jruby end RUBY @@ -517,21 +516,21 @@ RSpec.describe "bundler/inline#gemfile" do script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end RUBY expect(last_command).to be_success - expect(system_gem_path("gems/rack-1.0.0")).to exist + expect(system_gem_path("gems/myrack-1.0.0")).to exist end it "preserves previous BUNDLE_GEMFILE value" do ENV["BUNDLE_GEMFILE"] = "" script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end puts "BUNDLE_GEMFILE is empty" if ENV["BUNDLE_GEMFILE"].empty? @@ -547,8 +546,8 @@ RSpec.describe "bundler/inline#gemfile" do ENV["BUNDLE_GEMFILE"] = nil script <<-RUBY gemfile do - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" end puts "BUNDLE_GEMFILE is empty" if ENV["BUNDLE_GEMFILE"].empty? @@ -576,9 +575,9 @@ RSpec.describe "bundler/inline#gemfile" do s.write "lib/foo.rb", foo_code end - script <<-RUBY, dir: tmp("path_without_gemfile") + script <<-RUBY, dir: tmp("path_without_gemfile"), env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } gemfile do - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" path "#{lib_path}" do gem "foo", require: false end @@ -591,7 +590,7 @@ RSpec.describe "bundler/inline#gemfile" do expect(err).to be_empty end - it "when requiring fileutils after does not show redefinition warnings", :realworld do + it "when requiring fileutils after does not show redefinition warnings" do Dir.mkdir tmp("path_without_gemfile") default_fileutils_version = ruby "gem 'fileutils', '< 999999'; require 'fileutils'; puts FileUtils::VERSION", raise_on_error: false @@ -601,11 +600,11 @@ RSpec.describe "bundler/inline#gemfile" do realworld_system_gems "pathname --version 0.2.0" - script <<-RUBY, dir: tmp("path_without_gemfile"), env: { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } + script <<-RUBY, dir: tmp("path_without_gemfile"), env: { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s, "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } require "bundler/inline" gemfile(true) do - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" end require "fileutils" @@ -626,11 +625,11 @@ RSpec.describe "bundler/inline#gemfile" do build_gem "timeout", "999" end - script <<-RUBY + script <<-RUBY, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } require "bundler/inline" gemfile(true) do - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "timeout" end @@ -647,7 +646,7 @@ RSpec.describe "bundler/inline#gemfile" do puts("before: \#{ENV.each_key.select { |key| key.match?(/test_variable/i) }}") gemfile do - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" end puts("after: \#{ENV.each_key.select { |key| key.match?(/test_variable/i) }}") diff --git a/spec/bundler/runtime/load_spec.rb b/spec/bundler/runtime/load_spec.rb index f28ffd9460..15f3d0eb5b 100644 --- a/spec/bundler/runtime/load_spec.rb +++ b/spec/bundler/runtime/load_spec.rb @@ -4,18 +4,18 @@ RSpec.describe "Bundler.load" do describe "with a gemfile" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app) end it "provides a list of the env dependencies" do - expect(Bundler.load.dependencies).to have_dep("rack", ">= 0") + expect(Bundler.load.dependencies).to have_dep("myrack", ">= 0") end it "provides a list of the resolved gems" do - expect(Bundler.load.gems).to have_gem("rack-1.0.0", "bundler-#{Bundler::VERSION}") + expect(Bundler.load.gems).to have_gem("myrack-1.0.0", "bundler-#{Bundler::VERSION}") end it "ignores blank BUNDLE_GEMFILEs" do @@ -28,20 +28,20 @@ RSpec.describe "Bundler.load" do describe "with a gems.rb file" do before(:each) do - create_file "gems.rb", <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + gemfile "gems.rb", <<-G + source "https://gem.repo1" + gem "myrack" G bundle :install allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app) end it "provides a list of the env dependencies" do - expect(Bundler.load.dependencies).to have_dep("rack", ">= 0") + expect(Bundler.load.dependencies).to have_dep("myrack", ">= 0") end it "provides a list of the resolved gems" do - expect(Bundler.load.gems).to have_gem("rack-1.0.0", "bundler-#{Bundler::VERSION}") + expect(Bundler.load.gems).to have_gem("myrack-1.0.0", "bundler-#{Bundler::VERSION}") end end @@ -76,8 +76,8 @@ RSpec.describe "Bundler.load" do describe "when called twice" do it "doesn't try to load the runtime twice" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "activesupport", :group => :test G @@ -85,7 +85,7 @@ RSpec.describe "Bundler.load" do require "bundler" Bundler.setup :default Bundler.require :default - puts RACK + puts MYRACK begin require "activesupport" rescue LoadError @@ -100,7 +100,7 @@ RSpec.describe "Bundler.load" do describe "not hurting brittle rubygems" do it "does not inject #source into the generated YAML of the gem specs" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activerecord" G allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb index 1925e9bf2e..b9e568b3b5 100644 --- a/spec/bundler/runtime/platform_spec.rb +++ b/spec/bundler/runtime/platform_spec.rb @@ -3,21 +3,21 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "raises a friendly error when gems are missing locally" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0) + myrack (1.0) PLATFORMS #{local_tag} DEPENDENCIES - rack + myrack G ruby <<-R @@ -35,7 +35,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "will resolve correctly on the current platform when the lockfile was targeted for a different one" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: nokogiri (1.4.2-java) weakling (= 0.0.3) @@ -50,7 +50,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do simulate_platform "x86-darwin-10" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri" G @@ -82,7 +82,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do good_lockfile = <<~L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: mini_portile2 (2.5.0) nokogiri (1.11.1) @@ -103,7 +103,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do L gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "nokogiri", "~> 1.11" G @@ -125,13 +125,13 @@ RSpec.describe "Bundler.setup with multi platform stuff" do end gemfile <<-G - source "https://gems.repo4" + source "https://gem.repo4" gem "nokogiri" G lockfile <<~L GEM - remote: https://gems.repo4/ + remote: https://gem.repo4/ specs: nokogiri (1.11.1) @@ -145,7 +145,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do #{Bundler::VERSION} L - bundle "install", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "install" expect(out).to include("Fetching nokogiri 1.11.1") expect(the_bundle).to include_gems "nokogiri 1.11.1" @@ -154,13 +154,13 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "will use the java platform if both generic java and generic ruby platforms are locked", :jruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri" G lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: nokogiri (1.4.2) nokogiri (1.4.2-java) @@ -187,7 +187,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "will add the resolve for the current platform" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: nokogiri (1.4.2-java) weakling (= 0.0.3) @@ -203,7 +203,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do simulate_platform "x86-darwin-100" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri" gem "platform_specific" G @@ -213,7 +213,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "allows specifying only-ruby-platform on jruby", :jruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri" gem "platform_specific" G @@ -227,7 +227,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "allows specifying only-ruby-platform" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri" gem "platform_specific" G @@ -241,7 +241,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "allows specifying only-ruby-platform even if the lockfile is locked to a specific compatible platform" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri" gem "platform_specific" G @@ -255,7 +255,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "doesn't pull platform specific gems on truffleruby", :truffleruby_only do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G @@ -264,13 +264,13 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "doesn't pull platform specific gems on truffleruby (except when whitelisted) even if lockfile was generated with an older version that declared RUBY as platform", :truffleruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: platform_specific (1.0) @@ -298,13 +298,13 @@ RSpec.describe "Bundler.setup with multi platform stuff" do end gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "libv8" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo4)}/ + remote: https://gem.repo4/ specs: libv8 (1.0) @@ -326,13 +326,13 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "doesn't pull platform specific gems on truffleruby, even if lockfile only includes those", :truffleruby_only do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific" G lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: platform_specific (1.0-x86-darwin-100) @@ -359,8 +359,8 @@ RSpec.describe "Bundler.setup with multi platform stuff" do end simulate_platform "aarch64-linux-musl" do - install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, verbose: true - source "https://gems.repo4" + install_gemfile <<-G, verbose: true + source "https://gem.repo4" gem "nokogiri" G end @@ -371,7 +371,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "allows specifying only-ruby-platform on windows with dependency platforms" do simulate_windows do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "nokogiri", :platforms => [:windows, :mswin, :mswin64, :mingw, :x64_mingw, :jruby] gem "platform_specific" G @@ -387,11 +387,11 @@ RSpec.describe "Bundler.setup with multi platform stuff" do it "allows specifying only-ruby-platform on windows with gemspec dependency" do build_lib("foo", "1.0", path: bundled_app) do |s| - s.add_dependency "rack" + s.add_dependency "myrack" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gemspec G bundle :lock @@ -400,7 +400,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do bundle "config set force_ruby_platform true" bundle "install" - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end @@ -413,7 +413,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do simulate_windows x64_mingw32 do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: platform_specific (1.0-x86-mingw32) requires_platform_specific (1.0) @@ -428,7 +428,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do L install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "requires_platform_specific" G @@ -444,7 +444,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do simulate_windows platform do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: platform_specific (1.0-#{platform}) requires_platform_specific (1.0) @@ -458,7 +458,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do L install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "platform_specific", :platforms => [:windows] G diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb index e630e902c9..ff45a3c5e2 100644 --- a/spec/bundler/runtime/require_spec.rb +++ b/spec/bundler/runtime/require_spec.rb @@ -46,7 +46,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "one", :group => :bar, :require => %w[baz qux] gem "two" @@ -113,7 +113,7 @@ RSpec.describe "Bundler.require" do it "raises an exception if a require is specified but the file does not exist" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "two", :require => 'fail' end @@ -132,7 +132,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "faulty" end @@ -149,7 +149,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "loadfuuu" end @@ -176,7 +176,7 @@ RSpec.describe "Bundler.require" do it "requires gem names that are namespaced" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path '#{lib_path}' do gem 'jquery-rails' end @@ -191,7 +191,7 @@ RSpec.describe "Bundler.require" do s.write "lib/brcrypt.rb", "BCrypt = '1.0.0'" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "bcrypt-ruby" @@ -209,7 +209,7 @@ RSpec.describe "Bundler.require" do it "does not mangle explicitly given requires" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem 'jquery-rails', :require => 'jquery-rails' end @@ -227,7 +227,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "load-fuuu" end @@ -251,7 +251,7 @@ RSpec.describe "Bundler.require" do end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "load-fuuu" end @@ -310,7 +310,7 @@ RSpec.describe "Bundler.require" do it "works when the gems are in the Gemfile in the correct order" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "two" gem "one" @@ -329,7 +329,7 @@ RSpec.describe "Bundler.require" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "multi_gem", :require => "one", :group => :one gem "multi_gem", :require => "two", :group => :two G @@ -353,7 +353,7 @@ RSpec.describe "Bundler.require" do it "fails when the gems are in the Gemfile in the wrong order" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" path "#{lib_path}" do gem "one" gem "two" @@ -371,7 +371,7 @@ RSpec.describe "Bundler.require" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "busted_require" G @@ -385,12 +385,12 @@ RSpec.describe "Bundler.require" do it "does not load rubygems gemspecs that are used" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G run <<-R - path = File.join(Gem.dir, "specifications", "rack-1.0.0.gemspec") + path = File.join(Gem.dir, "specifications", "myrack-1.0.0.gemspec") contents = File.read(path) contents = contents.lines.to_a.insert(-2, "\n raise 'broken gemspec'\n").join File.open(path, "w") do |f| @@ -410,7 +410,7 @@ RSpec.describe "Bundler.require" do build_git "foo" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -433,13 +433,13 @@ RSpec.describe "Bundler.require" do it "does not extract gemspecs from application cache packages" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle :cache - path = cached_gem("rack-1.0.0") + path = cached_gem("myrack-1.0.0") run <<-R File.open("#{path}", "w") do |f| @@ -459,13 +459,13 @@ end RSpec.describe "Bundler.require with platform specific dependencies" do it "does not require the gems that are pinned to other platforms" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" platforms :#{not_local_tag} do gem "platform_specific", :require => "omgomg" end - gem "rack", "1.0.0" + gem "myrack", "1.0.0" G run "Bundler.require" @@ -474,14 +474,14 @@ RSpec.describe "Bundler.require with platform specific dependencies" do it "requires gems pinned to multiple platforms, including the current one" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" platforms :#{not_local_tag}, :#{local_tag} do - gem "rack", :require => "rack" + gem "myrack", :require => "myrack" end G - run "Bundler.require; puts RACK" + run "Bundler.require; puts MYRACK" expect(out).to eq("1.0.0") expect(err).to be_empty diff --git a/spec/bundler/runtime/self_management_spec.rb b/spec/bundler/runtime/self_management_spec.rb index d489d949bb..d2472dece2 100644 --- a/spec/bundler/runtime/self_management_spec.rb +++ b/spec/bundler/runtime/self_management_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do +RSpec.describe "Self management", rubygems: ">= 3.3.0.dev" do describe "auto switching" do let(:previous_minor) do "2.3.0" @@ -11,12 +11,18 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do end before do - build_repo2 + build_repo4 do + build_bundler previous_minor + + build_bundler current_version + + build_gem "myrack", "1.0.0" + end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo4" - gem "rack" + gem "myrack" G end @@ -24,7 +30,7 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do lockfile_bundled_with(previous_minor) bundle "config set --local path.system true" - bundle "install", artifice: "vcr" + bundle "install", preserve_ruby_flags: true expect(out).to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.") # It uninstalls the older system bundler @@ -35,16 +41,20 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do bundle "-v", artifice: nil expect(out).to end_with(previous_minor[0] == "2" ? "Bundler version #{previous_minor}" : previous_minor) - # App now uses locked version, even when not using the CLI directly - file = bundled_app("bin/bundle_version.rb") - create_file file, <<-RUBY - #!#{Gem.ruby} - require 'bundler/setup' - puts Bundler::VERSION - RUBY - file.chmod(0o777) - sys_exec "bin/bundle_version.rb", artifice: nil - expect(out).to eq(previous_minor) + # ruby-core test setup has always "lib" in $LOAD_PATH so `require "bundler/setup"` always activate the local version rather than using RubyGems gem activation stuff + unless ruby_core? + # App now uses locked version, even when not using the CLI directly + file = bundled_app("bin/bundle_version.rb") + create_file file, <<-RUBY + #!#{Gem.ruby} + require 'bundler/setup' + puts Bundler::VERSION + RUBY + file.chmod(0o777) + cmd = Gem.win_platform? ? "#{Gem.ruby} bin/bundle_version.rb" : "bin/bundle_version.rb" + sys_exec cmd, artifice: nil + expect(out).to eq(previous_minor) + end # Subsequent installs use the locked version without reinstalling bundle "install --verbose", artifice: nil @@ -56,7 +66,7 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do lockfile_bundled_with(previous_minor) bundle "config set --local path vendor/bundle" - bundle "install", artifice: "vcr" + bundle "install", preserve_ruby_flags: true expect(out).to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.") expect(vendored_gems("gems/bundler-#{previous_minor}")).to exist @@ -68,16 +78,20 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do bundle "-v" expect(out).to end_with(previous_minor[0] == "2" ? "Bundler version #{previous_minor}" : previous_minor) - # App now uses locked version, even when not using the CLI directly - file = bundled_app("bin/bundle_version.rb") - create_file file, <<-RUBY - #!#{Gem.ruby} - require 'bundler/setup' - puts Bundler::VERSION - RUBY - file.chmod(0o777) - sys_exec "bin/bundle_version.rb", artifice: nil - expect(out).to eq(previous_minor) + # ruby-core test setup has always "lib" in $LOAD_PATH so `require "bundler/setup"` always activate the local version rather than using RubyGems gem activation stuff + unless ruby_core? + # App now uses locked version, even when not using the CLI directly + file = bundled_app("bin/bundle_version.rb") + create_file file, <<-RUBY + #!#{Gem.ruby} + require 'bundler/setup' + puts Bundler::VERSION + RUBY + file.chmod(0o777) + cmd = Gem.win_platform? ? "#{Gem.ruby} bin/bundle_version.rb" : "bin/bundle_version.rb" + sys_exec cmd, artifice: nil + expect(out).to eq(previous_minor) + end # Subsequent installs use the locked version without reinstalling bundle "install --verbose" @@ -89,7 +103,7 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do lockfile_bundled_with(previous_minor) bundle "config set --local deployment true" - bundle "install", artifice: "vcr" + bundle "install", preserve_ruby_flags: true expect(out).to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.") expect(vendored_gems("gems/bundler-#{previous_minor}")).to exist @@ -122,7 +136,7 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do lockfile_bundled_with(missing_minor) - bundle "install", artifice: "vcr" + bundle "install" expect(err).to eq("Your lockfile is locked to a version of bundler (#{missing_minor}) that doesn't exist at https://rubygems.org/. Going on using #{Bundler::VERSION}") bundle "-v" @@ -133,7 +147,7 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do lockfile_bundled_with(current_version) bundle "config set --local version #{previous_minor}" - bundle "install", artifice: "vcr" + bundle "install", preserve_ruby_flags: true expect(out).to include("Bundler #{Bundler::VERSION} is running, but your configuration was #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.") bundle "-v" @@ -144,7 +158,7 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do lockfile_bundled_with(previous_minor) bundle "config set version system" - bundle "install", artifice: "vcr" + bundle "install" expect(out).not_to match(/restarting using that version/) bundle "-v" @@ -163,15 +177,15 @@ RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do def lockfile_bundled_with(version) lockfile <<~L GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo4/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack BUNDLED WITH #{version} diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index 7f4c0759d1..de09b0cdbb 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -6,16 +6,16 @@ RSpec.describe "Bundler.setup" do describe "with no arguments" do it "makes all groups available" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :group => :test + source "https://gem.repo1" + gem "myrack", :group => :test G ruby <<-RUBY require 'bundler' Bundler.setup - require 'rack' - puts RACK + require 'myrack' + puts MYRACK RUBY expect(err).to be_empty expect(out).to eq("1.0.0") @@ -25,9 +25,9 @@ RSpec.describe "Bundler.setup" do describe "when called with groups" do before(:each) do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack", :group => :test + gem "myrack", :group => :test G end @@ -37,7 +37,7 @@ RSpec.describe "Bundler.setup" do Bundler.setup(:default) begin - require 'rack' + require 'myrack' rescue LoadError puts "WIN" end @@ -51,8 +51,8 @@ RSpec.describe "Bundler.setup" do require 'bundler' Bundler.setup(:default, 'test') - require 'rack' - puts RACK + require 'myrack' + puts MYRACK RUBY expect(err).to be_empty expect(out).to eq("1.0.0") @@ -64,8 +64,8 @@ RSpec.describe "Bundler.setup" do Bundler.setup Bundler.setup(:default) - require 'rack' - puts RACK + require 'myrack' + puts MYRACK RUBY expect(err).to be_empty expect(out).to eq("1.0.0") @@ -93,12 +93,12 @@ RSpec.describe "Bundler.setup" do require 'bundler' Bundler.setup(:default, :test) Bundler.setup(:default) - require 'rack' + require 'myrack' puts "FAIL" RUBY - expect(err).to match("rack") + expect(err).to match("myrack") expect(err).to match("LoadError") expect(out).not_to match("FAIL") end @@ -113,8 +113,8 @@ RSpec.describe "Bundler.setup" do it "puts loaded gems after -I and RUBYLIB", :ruby_repo do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -Idash_i_dir" @@ -127,18 +127,18 @@ RSpec.describe "Bundler.setup" do RUBY load_path = out.split("\n") - rack_load_order = load_path.index {|path| path.include?("rack") } + myrack_load_order = load_path.index {|path| path.include?("myrack") } expect(err).to be_empty expect(load_path).to include(a_string_ending_with("dash_i_dir"), "rubylib_dir") - expect(rack_load_order).to be > 0 + expect(myrack_load_order).to be > 0 end it "orders the load path correctly when there are dependencies" do bundle "config set path.system true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "rails" G @@ -166,7 +166,7 @@ RSpec.describe "Bundler.setup" do bundle "config set path.system true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "weakling" gem "duradura" gem "terranova" @@ -189,8 +189,8 @@ RSpec.describe "Bundler.setup" do it "raises if the Gemfile was not yet installed" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G ruby <<-R @@ -209,8 +209,8 @@ RSpec.describe "Bundler.setup" do it "doesn't create a Gemfile.lock if the setup fails" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G ruby <<-R, raise_on_error: false @@ -224,15 +224,15 @@ RSpec.describe "Bundler.setup" do it "doesn't change the Gemfile.lock if the setup fails" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G lockfile = File.read(bundled_app_lock) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "nosuchgem", "10.0" G @@ -247,8 +247,8 @@ RSpec.describe "Bundler.setup" do it "makes a Gemfile.lock if setup succeeds" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G File.read(bundled_app_lock) @@ -263,12 +263,12 @@ RSpec.describe "Bundler.setup" do context "user provides an absolute path" do it "uses BUNDLE_GEMFILE to locate the gemfile if present" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G gemfile bundled_app("4realz"), <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport", "2.3.5" G @@ -282,7 +282,7 @@ RSpec.describe "Bundler.setup" do context "an absolute path is not provided" do it "uses BUNDLE_GEMFILE to locate the gemfile if present and doesn't fail in deployment mode" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G bundle "install" @@ -308,23 +308,23 @@ RSpec.describe "Bundler.setup" do it "prioritizes gems in BUNDLE_PATH over gems in GEM_HOME" do ENV["BUNDLE_PATH"] = bundled_app(".bundle").to_s install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" G - build_gem "rack", "1.0", to_system: true do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + build_gem "myrack", "1.0", to_system: true do |s| + s.write "lib/myrack.rb", "MYRACK = 'FAIL'" end - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end describe "integrate with rubygems" do describe "by replacing #gem" do before :each do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "0.9.1" + source "https://gem.repo1" + gem "myrack", "0.9.1" G end @@ -344,7 +344,7 @@ RSpec.describe "Bundler.setup" do it "replaces #gem but raises when the version is wrong" do run <<-R begin - gem "rack", "1.0.0" + gem "myrack", "1.0.0" puts "FAIL" rescue LoadError puts "WIN" @@ -359,7 +359,7 @@ RSpec.describe "Bundler.setup" do before :each do system_gems "activesupport-2.3.5" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" G end @@ -381,37 +381,37 @@ RSpec.describe "Bundler.setup" do describe "with paths" do it "activates the gems in the path source" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" - build_lib "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "puts 'WIN'" + build_lib "myrack", "1.0.0" do |s| + s.write "lib/myrack.rb", "puts 'WIN'" end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - path "#{lib_path("rack-1.0.0")}" do - gem "rack" + source "https://gem.repo1" + path "#{lib_path("myrack-1.0.0")}" do + gem "myrack" end G - run "require 'rack'" + run "require 'myrack'" expect(out).to eq("WIN") end end describe "with git" do before do - build_git "rack", "1.0.0" + build_git "myrack", "1.0.0" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-1.0.0")}" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-1.0.0")}" G end it "provides a useful exception when the git repo is not checked out yet" do run "1", raise_on_error: false - expect(err).to match(/the git source #{lib_path("rack-1.0.0")} is not yet checked out. Please run `bundle install`/i) + expect(err).to match(/the git source #{lib_path("myrack-1.0.0")} is not yet checked out. Please run `bundle install`/i) end it "does not hit the git binary if the lockfile is available and up to date" do @@ -460,7 +460,7 @@ RSpec.describe "Bundler.setup" do bundle "config set --local path vendor/bundle" bundle :install FileUtils.rm_rf vendored_gems("cache") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do @@ -468,7 +468,7 @@ RSpec.describe "Bundler.setup" do bundle :install with_read_only("#{bundled_app}/**/*") do - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end @@ -477,91 +477,91 @@ RSpec.describe "Bundler.setup" do bundle "install" with_read_only("#{bundled_app(".bundle")}/**/*") do - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end end describe "when specifying local override" do it "explodes if given path does not exist on runtime" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install - FileUtils.rm_rf(lib_path("local-rack")) - run "require 'rack'", raise_on_error: false - expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path("local-rack").to_s)} does not exist/) + FileUtils.rm_rf(lib_path("local-myrack")) + run "require 'myrack'", raise_on_error: false + expect(err).to match(/Cannot use local override for myrack-0.8 because #{Regexp.escape(lib_path("local-myrack").to_s)} does not exist/) end it "explodes if branch is not given on runtime" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}" G - run "require 'rack'", raise_on_error: false + run "require 'myrack'", raise_on_error: false expect(err).to match(/because :branch is not specified in Gemfile/) end it "explodes on different branches on runtime" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) + bundle %(config set local.myrack #{lib_path("local-myrack")}) bundle :install gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "changed" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "changed" G - run "require 'rack'", raise_on_error: false + run "require 'myrack'", raise_on_error: false expect(err).to match(/is using branch main but Gemfile specifies changed/) end it "explodes on refs with different branches on runtime" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) + FileUtils.cp_r("#{lib_path("myrack-0.8")}/.", lib_path("local-myrack")) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :ref => "main", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :ref => "main", :branch => "main" G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{lib_path("rack-0.8")}", :ref => "main", :branch => "nonexistent" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :ref => "main", :branch => "nonexistent" G - bundle %(config set local.rack #{lib_path("local-rack")}) - run "require 'rack'", raise_on_error: false + bundle %(config set local.myrack #{lib_path("local-myrack")}) + run "require 'myrack'", raise_on_error: false expect(err).to match(/is using branch main but Gemfile specifies nonexistent/) end end @@ -570,7 +570,7 @@ RSpec.describe "Bundler.setup" do it "doesn't change the resolve if --without is used" do bundle "config set --local without rails" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" group :rails do @@ -586,7 +586,7 @@ RSpec.describe "Bundler.setup" do it "remembers --without and does not bail on bare Bundler.setup" do bundle "config set --local without rails" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" group :rails do @@ -606,7 +606,7 @@ RSpec.describe "Bundler.setup" do build_lib "foo", path: path install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport", "2.3.2" gem 'foo', :path => 'vendor/foo', :group => :development G @@ -629,7 +629,7 @@ RSpec.describe "Bundler.setup" do end install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "depends_on_bundler" G @@ -641,7 +641,7 @@ RSpec.describe "Bundler.setup" do it "doesn't fail in frozen mode when bundler is a Gemfile dependency" do install_gemfile <<~G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "bundler" G @@ -651,14 +651,14 @@ RSpec.describe "Bundler.setup" do it "doesn't re-resolve when deleting dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "actionpack" G install_gemfile <<-G, verbose: true - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G expect(out).to include("Some dependencies were deleted, using a subset of the resolution from the lockfile") @@ -668,11 +668,11 @@ RSpec.describe "Bundler.setup" do it "remembers --without and does not include groups passed to Bundler.setup" do bundle "config set --local without rails" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" - group :rack do - gem "rack" + group :myrack do + gem "myrack" end group :rails do @@ -680,8 +680,8 @@ RSpec.describe "Bundler.setup" do end G - expect(the_bundle).not_to include_gems "activesupport 2.3.2", groups: :rack - expect(the_bundle).to include_gems "rack 1.0.0", groups: :rack + expect(the_bundle).not_to include_gems "activesupport 2.3.2", groups: :myrack + expect(the_bundle).to include_gems "myrack 1.0.0", groups: :myrack end end @@ -691,8 +691,8 @@ RSpec.describe "Bundler.setup" do build_git "no-gemspec", gemspec: false install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" gem "foo", :git => "#{lib_path("foo-1.0")}" gem "no-gemspec", "1.0", :git => "#{lib_path("no-gemspec-1.0")}" G @@ -708,8 +708,8 @@ RSpec.describe "Bundler.setup" do it "does not load all gemspecs" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G run <<-R @@ -757,8 +757,8 @@ end it "ignores empty gem paths" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G ENV["GEM_HOME"] = "" @@ -769,8 +769,8 @@ end it "can require rubygems without warnings, when using a local cache", :truffleruby do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G bundle "package" @@ -790,7 +790,7 @@ end end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "with_man" G @@ -814,7 +814,7 @@ end end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "with_man" G @@ -827,7 +827,7 @@ end expect(out).to eq("#{default_bundle_path("gems/with_man-1.0/man")}#{File::PATH_SEPARATOR}\ntrue") install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "with_man_overriding_system_man" G @@ -854,7 +854,7 @@ end end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem "requirepaths", :require => nil G @@ -870,7 +870,7 @@ end system_gems full_gem_name install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" G ruby <<-R @@ -917,7 +917,7 @@ end end it "should not remove itself from the LOAD_PATH and require a different copy of 'bundler/setup'" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" ruby <<-R, env: { "GEM_PATH" => symlinked_gem_home } TracePoint.trace(:class) do |tp| @@ -934,10 +934,10 @@ end end it "does not reveal system gems even when Gem.refresh is called" do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport" G @@ -966,7 +966,7 @@ end FileUtils.rm(File.join(path, "foo.gemspec")) install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', '1.2.3', :path => 'vendor/foo' G @@ -987,7 +987,7 @@ end FileUtils.rm(File.join(absolute_path, "foo.gemspec")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', '1.2.3', :path => '#{relative_path}' G @@ -1006,7 +1006,7 @@ end build_git "no_gemspec", gemspec: false install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "no_gemspec", "1.0", :git => "#{lib_path("no_gemspec-1.0")}" G end @@ -1023,10 +1023,10 @@ end describe "with bundled and system gems" do before :each do - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport", "2.3.5" G @@ -1035,7 +1035,7 @@ end it "does not pull in system gems" do run <<-R begin; - require 'rack' + require 'myrack' rescue LoadError puts 'WIN' end @@ -1057,13 +1057,13 @@ end it "raises an exception if gem is used to invoke a system gem not in the bundle" do run <<-R begin - gem 'rack' + gem 'myrack' rescue LoadError => e puts e.message end R - expect(out).to eq("rack is not part of the bundle. Add it to your Gemfile.") + expect(out).to eq("myrack is not part of the bundle. Add it to your Gemfile.") end it "sets GEM_HOME appropriately" do @@ -1075,11 +1075,11 @@ end describe "with system gems in the bundle" do before :each do bundle "config set path.system true" - system_gems "rack-1.0.0" + system_gems "myrack-1.0.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", "1.0.0" + source "https://gem.repo1" + gem "myrack", "1.0.0" gem "activesupport", "2.3.5" G end @@ -1109,7 +1109,7 @@ end end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :git => "#{lib_path("bar-1.0")}" G end @@ -1156,7 +1156,7 @@ end describe "when Bundler is bundled" do it "doesn't blow up" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bundler", :path => "#{root}" G @@ -1169,15 +1169,15 @@ end def lock_with(bundler_version = nil) lock = <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack L if bundler_version @@ -1191,8 +1191,8 @@ end bundle "config set --local path.system true" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end @@ -1229,20 +1229,20 @@ end def lock_with(ruby_version = nil) checksums = checksums_section do |c| - c.checksum gem_repo1, "rack", "1.0.0" + c.checksum gem_repo1, "myrack", "1.0.0" end lock = <<~L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: https://gem.repo1/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES - rack + myrack #{checksums} L @@ -1262,8 +1262,8 @@ end before do install_gemfile <<-G ruby ">= 0" - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G lockfile lock_with(ruby_version) end @@ -1311,13 +1311,13 @@ end end gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "bar", :git => "#{lib_path("bar-1.0")}" G bundle :install - ruby <<-RUBY + ruby <<-RUBY, artifice: nil require 'bundler/setup' puts defined?(::Digest) ? "Digest defined" : "Digest undefined" require 'digest' @@ -1326,7 +1326,7 @@ end end it "does not load Psych" do - gemfile "source \"#{file_uri_for(gem_repo1)}\"" + gemfile "source 'https://gem.repo1'" ruby <<-RUBY require 'bundler/setup' puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined" @@ -1339,8 +1339,8 @@ end end it "does not load openssl" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" - ruby <<-RUBY + install_gemfile "source 'https://gem.repo1'" + ruby <<-RUBY, artifice: nil require "bundler/setup" puts defined?(OpenSSL) || "undefined" require "openssl" @@ -1363,11 +1363,11 @@ end G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "test", path: "#{bundled_app("test")}" G - ruby <<-RUBY + ruby <<-RUBY, artifice: nil require "bundler/setup" puts defined?(URI) || "undefined" require "uri" @@ -1383,7 +1383,7 @@ end build_gem "json", default_json_version end - gemfile "source \"#{file_uri_for(gem_repo2)}\"; gem 'json'" + gemfile "source \"https://gem.repo2\"; gem 'json'" ruby <<-RUBY require "bundler/setup" @@ -1440,13 +1440,13 @@ end RUBY it "activates no gems with -rbundler/setup" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" - ruby code, env: { "RUBYOPT" => activation_warning_hack_rubyopt + " -rbundler/setup" } + install_gemfile "source 'https://gem.repo1'" + ruby code, env: { "RUBYOPT" => activation_warning_hack_rubyopt + " -rbundler/setup" }, artifice: nil expect(out).to eq("{}") end it "activates no gems with bundle exec" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" create_file("script.rb", code) bundle "exec ruby ./script.rb", env: { "RUBYOPT" => activation_warning_hack_rubyopt } expect(out).to eq("{}") @@ -1455,7 +1455,7 @@ end it "activates no gems with bundle exec that is loaded" do skip "not executable" if Gem.win_platform? - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}") FileUtils.chmod(0o777, bundled_app("script.rb")) bundle "exec ./script.rb", artifice: nil, env: { "RUBYOPT" => activation_warning_hack_rubyopt } @@ -1470,7 +1470,7 @@ end system_gems "net-http-pipeline-1.0.1", gem_repo: gem_repo4 gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "net-http-pipeline", "1.0.1" G @@ -1492,11 +1492,11 @@ end end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "#{g}", "999999" G - expect(the_bundle).to include_gem("#{g} 999999", env: { "RUBYOPT" => activation_warning_hack_rubyopt }) + expect(the_bundle).to include_gem("#{g} 999999", env: { "RUBYOPT" => activation_warning_hack_rubyopt }, artifice: nil) end it "activates older versions of #{g}", :ruby_repo do @@ -1507,11 +1507,11 @@ end end install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" gem "#{g}", "0.0.0.a" G - expect(the_bundle).to include_gem("#{g} 0.0.0.a", env: { "RUBYOPT" => activation_warning_hack_rubyopt }) + expect(the_bundle).to include_gem("#{g} 0.0.0.a", env: { "RUBYOPT" => activation_warning_hack_rubyopt }, artifice: nil) end end end @@ -1520,28 +1520,28 @@ end describe "after setup" do it "allows calling #gem on random objects", bundler: "< 3" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G ruby <<-RUBY require "bundler/setup" - Object.new.gem "rack" - puts Gem.loaded_specs["rack"].full_name + Object.new.gem "myrack" + puts Gem.loaded_specs["myrack"].full_name RUBY - expect(out).to eq("rack-1.0.0") + expect(out).to eq("myrack-1.0.0") end it "keeps Kernel#gem private", bundler: "3" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G ruby <<-RUBY, raise_on_error: false require "bundler/setup" - Object.new.gem "rack" + Object.new.gem "myrack" puts "FAIL" RUBY @@ -1551,13 +1551,13 @@ end it "keeps Kernel#require private" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G ruby <<-RUBY, raise_on_error: false require "bundler/setup" - Object.new.require "rack" + Object.new.require "myrack" puts "FAIL" RUBY @@ -1567,9 +1567,9 @@ end it "memoizes initial set of specs when requiring bundler/setup, so that even if further code mutates dependencies, Bundler.definition.specs is not affected" do install_gemfile <<~G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "yard" - gem "rack", :group => :test + gem "myrack", :group => :test G ruby <<-RUBY, raise_on_error: false @@ -1578,7 +1578,7 @@ end puts Bundler.definition.specs.map(&:name).join(", ") RUBY - expect(out).to include("rack, yard") + expect(out).to include("myrack, yard") end it "does not cause double loads when higher versions of default gems are activated before bundler" do @@ -1594,7 +1594,7 @@ end system_gems "json-999.999.999", gem_repo: gem_repo2 - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" ruby <<-RUBY require "json" require "bundler/setup" @@ -1606,7 +1606,7 @@ end end it "does not undo the Kernel.require decorations", rubygems: ">= 3.4.6" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" + install_gemfile "source 'https://gem.repo1'" script = bundled_app("bin/script") create_file(script, <<~RUBY) module Kernel @@ -1631,17 +1631,21 @@ end end it "performs an automatic bundle install" do + build_repo4 do + build_gem "myrack", "1.0.0" + end + gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :group => :test + source "https://gem.repo1" + gem "myrack", :group => :test G bundle "config set auto_install 1" - ruby <<-RUBY + ruby <<-RUBY, artifice: "compact_index" require 'bundler/setup' RUBY expect(err).to be_empty - expect(out).to include("Installing rack 1.0.0") + expect(out).to include("Installing myrack 1.0.0") end end diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb index 135c71b0af..8c3582f7ac 100644 --- a/spec/bundler/runtime/with_unbundled_env_spec.rb +++ b/spec/bundler/runtime/with_unbundled_env_spec.rb @@ -2,13 +2,13 @@ RSpec.describe "Bundler.with_env helpers" do def bundle_exec_ruby(args, options = {}) - build_bundler_context options + build_bundler_context options.dup bundle "exec '#{Gem.ruby}' #{args}", options end def build_bundler_context(options = {}) - bundle "config set path vendor/bundle" - gemfile "source \"#{file_uri_for(gem_repo1)}\"" + bundle "config set path vendor/bundle", options.dup + gemfile "source 'https://gem.repo1'" bundle "install", options end @@ -65,11 +65,11 @@ RSpec.describe "Bundler.with_env helpers" do # Simulate bundler has not yet been loaded ENV.replace(ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) }) - original = ruby('puts ENV.to_a.map {|e| e.join("=") }.sort.join("\n")') + original = ruby('puts ENV.to_a.map {|e| e.join("=") }.sort.join("\n")', artifice: "fail") create_file("source.rb", <<-RUBY) puts Bundler.original_env.to_a.map {|e| e.join("=") }.sort.join("\n") RUBY - bundle_exec_ruby bundled_app("source.rb") + bundle_exec_ruby bundled_app("source.rb"), artifice: "fail" expect(out).to eq original end end diff --git a/spec/bundler/support/artifice/fail.rb b/spec/bundler/support/artifice/fail.rb index 8822e5b8e2..5ddbc4e590 100644 --- a/spec/bundler/support/artifice/fail.rb +++ b/spec/bundler/support/artifice/fail.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "bundler/vendored_net_http" +require_relative "../vendored_net_http" class Fail < Gem::Net::HTTP # Gem::Net::HTTP uses a @newimpl instance variable to decide whether diff --git a/spec/bundler/support/artifice/helpers/compact_index.rb b/spec/bundler/support/artifice/helpers/compact_index.rb index 3fc1ce7fef..f045b71bcf 100644 --- a/spec/bundler/support/artifice/helpers/compact_index.rb +++ b/spec/bundler/support/artifice/helpers/compact_index.rb @@ -68,7 +68,10 @@ class CompactIndexAPI < Endpoint @gems[gem_repo] ||= begin specs = Bundler::Deprecate.skip_during do %w[specs.4.8 prerelease_specs.4.8].map do |filename| - Marshal.load(File.open(gem_repo.join(filename)).read).map do |name, version, platform| + spec_index = gem_repo.join(filename) + next [] unless File.exist?(spec_index) + + Marshal.load(File.binread(spec_index)).map do |name, version, platform| load_spec(name, version, platform, gem_repo) end end.flatten diff --git a/spec/bundler/support/artifice/helpers/endpoint.rb b/spec/bundler/support/artifice/helpers/endpoint.rb index 83ba1be0fc..329d2d807a 100644 --- a/spec/bundler/support/artifice/helpers/endpoint.rb +++ b/spec/bundler/support/artifice/helpers/endpoint.rb @@ -62,7 +62,7 @@ class Endpoint < Sinatra::Base return [] if gem_names.nil? || gem_names.empty? all_specs = %w[specs.4.8 prerelease_specs.4.8].map do |filename| - Marshal.load(File.open(gem_repo.join(filename)).read) + Marshal.load(File.binread(gem_repo.join(filename))) end.inject(:+) all_specs.map do |name, version, platform| diff --git a/spec/bundler/support/artifice/helpers/rack_request.rb b/spec/bundler/support/artifice/helpers/rack_request.rb index f419bacb8c..05ff034463 100644 --- a/spec/bundler/support/artifice/helpers/rack_request.rb +++ b/spec/bundler/support/artifice/helpers/rack_request.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "rack/test" -require "bundler/vendored_net_http" +require_relative "../../vendored_net_http" module Artifice module Net diff --git a/spec/bundler/support/artifice/vcr.rb b/spec/bundler/support/artifice/vcr.rb index 7b9a8bdeaf..2386a4c6b7 100644 --- a/spec/bundler/support/artifice/vcr.rb +++ b/spec/bundler/support/artifice/vcr.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "bundler/vendored_net_http" +require_relative "../vendored_net_http" require_relative "../path" CASSETTE_PATH = "#{Spec::Path.spec_dir}/support/artifice/vcr_cassettes".freeze diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb index 9294182ae9..ec37b562e4 100644 --- a/spec/bundler/support/builders.rb +++ b/spec/bundler/support/builders.rb @@ -37,23 +37,23 @@ module Spec build_gem "puma" build_gem "minitest" - build_gem "rack", %w[0.9.1 1.0.0] do |s| - s.executables = "rackup" - s.post_install_message = "Rack's post install message" + build_gem "myrack", %w[0.9.1 1.0.0] do |s| + s.executables = "myrackup" + s.post_install_message = "Myrack's post install message" end build_gem "thin" do |s| - s.add_dependency "rack" + s.add_dependency "myrack" s.post_install_message = "Thin's post install message" end - build_gem "rack-obama" do |s| - s.add_dependency "rack" - s.post_install_message = "Rack-obama's post install message" + build_gem "myrack-obama" do |s| + s.add_dependency "myrack" + s.post_install_message = "Myrack-obama's post install message" end - build_gem "rack_middleware", "1.0" do |s| - s.add_dependency "rack", "0.9.1" + build_gem "myrack_middleware", "1.0" do |s| + s.add_dependency "myrack", "0.9.1" end build_gem "rails", "2.3.2" do |s| @@ -86,8 +86,8 @@ module Spec s.write "lib/spec.rb", "SPEC = '1.2.7'" end - build_gem "rack-test", no_default: true do |s| - s.write "lib/rack/test.rb", "RACK_TEST = '1.0'" + build_gem "myrack-test", no_default: true do |s| + s.write "lib/myrack/test.rb", "MYRACK_TEST = '1.0'" end build_gem "platform_specific" do |s| @@ -223,7 +223,7 @@ module Spec def build_security_repo build_repo security_repo do - build_gem "rack" + build_gem "myrack" build_gem "signed_gem" do |s| cert = "signing-cert.pem" diff --git a/spec/bundler/support/checksums.rb b/spec/bundler/support/checksums.rb index f758559b3b..19a3fd6a4d 100644 --- a/spec/bundler/support/checksums.rb +++ b/spec/bundler/support/checksums.rb @@ -110,5 +110,17 @@ module Spec _checksums, tail = remaining.split("\n\n", 2) head.concat(tail) end + + def checksum_from_package(gem_file, name, version) + name_tuple = Gem::NameTuple.new(name, version) + + checksum = nil + + File.open(gem_file, "rb") do |f| + checksum = Bundler::Checksum.from_gem(f, gemfile) + end + + "#{name_tuple.lock_name} #{checksum.to_lock}" + end end end diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index e345c56dc6..13f77ec56a 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -71,31 +71,26 @@ module Spec bundle_bin ||= installed_bindir.join("bundle") env = options.delete(:env) || {} + preserve_ruby_flags = options.delete(:preserve_ruby_flags) requires = options.delete(:requires) || [] - realworld = RSpec.current_example.metadata[:realworld] - artifice = options.delete(:artifice) do - if realworld - "vcr" - else - "fail" - end - end - if artifice - requires << "#{Path.spec_dir}/support/artifice/#{artifice}.rb" - end + dir = options.delete(:dir) || bundled_app load_path = [] load_path << spec_dir - dir = options.delete(:dir) || bundled_app + build_ruby_options = { load_path: load_path, requires: requires, env: env } + build_ruby_options.merge!(artifice: options.delete(:artifice)) if options.key?(:artifice) + + match_source(cmd) + + env, ruby_cmd = build_ruby_cmd(build_ruby_options) + raise_on_error = options.delete(:raise_on_error) args = options.map do |k, v| case v - when nil - next when true " --#{k}" when false @@ -105,19 +100,30 @@ module Spec end end.join - ruby_cmd = build_ruby_cmd({ load_path: load_path, requires: requires, env: env }) cmd = "#{ruby_cmd} #{bundle_bin} #{cmd}#{args}" + env["BUNDLER_SPEC_ORIGINAL_CMD"] = "#{ruby_cmd} #{bundle_bin}" if preserve_ruby_flags sys_exec(cmd, { env: env, dir: dir, raise_on_error: raise_on_error }, &block) end + def main_source(dir) + gemfile = File.expand_path("Gemfile", dir) + return unless File.exist?(gemfile) + + match = File.readlines(gemfile).first.match(/source ["'](?<source>[^"']+)["']/) + return unless match + + match[:source] + end + def bundler(cmd, options = {}) options[:bundle_bin] = system_gem_path("bin/bundler") bundle(cmd, options) end def ruby(ruby, options = {}) - ruby_cmd = build_ruby_cmd + env, ruby_cmd = build_ruby_cmd({ artifice: nil }.merge(options)) escaped_ruby = ruby.shellescape + options[:env] = env if env sys_exec(%(#{ruby_cmd} -w -e #{escaped_ruby}), options) end @@ -135,17 +141,44 @@ module Spec libs = options.delete(:load_path) lib_option = libs ? "-I#{libs.join(File::PATH_SEPARATOR)}" : [] + env = options.delete(:env) || {} + current_example = RSpec.current_example + + main_source = @gemfile_source if defined?(@gemfile_source) + compact_index_main_source = main_source&.start_with?("https://gem.repo", "https://gems.security") + requires = options.delete(:requires) || [] + artifice = options.delete(:artifice) do + if current_example && current_example.metadata[:realworld] + "vcr" + elsif compact_index_main_source + env["BUNDLER_SPEC_GEM_REPO"] ||= + case main_source + when "https://gem.repo1" then gem_repo1.to_s + when "https://gem.repo2" then gem_repo2.to_s + when "https://gem.repo3" then gem_repo3.to_s + when "https://gem.repo4" then gem_repo4.to_s + when "https://gems.security" then security_repo.to_s + end + + "compact_index" + else + "fail" + end + end + if artifice + requires << "#{Path.spec_dir}/support/artifice/#{artifice}.rb" + end hax_path = "#{Path.spec_dir}/support/hax.rb" # For specs that need to ignore the default Bundler gem, load hax before # anything else since other stuff may actually load bundler and not skip # the default version - options[:env]&.include?("BUNDLER_IGNORE_DEFAULT_GEM") ? requires.prepend(hax_path) : requires.append(hax_path) + env.include?("BUNDLER_IGNORE_DEFAULT_GEM") ? requires.prepend(hax_path) : requires.append(hax_path) require_option = requires.map {|r| "-r#{r}" } - [Gem.ruby, *lib_option, *require_option].compact.join(" ") + [env, [Gem.ruby, *lib_option, *require_option].compact.join(" ")] end def gembin(cmd, options = {}) @@ -208,6 +241,7 @@ module Spec if contents.nil? read_gemfile else + match_source(contents) create_file(args.pop || "Gemfile", contents) end end @@ -512,6 +546,13 @@ module Spec private + def match_source(contents) + match = /source ["']?(?<source>http[^"']+)["']?/.match(contents) + return unless match + + @gemfile_source = match[:source] + end + def git_root_dir? root.to_s == `git rev-parse --show-toplevel`.chomp end diff --git a/spec/bundler/support/indexes.rb b/spec/bundler/support/indexes.rb index 086a311551..7960bae59f 100644 --- a/spec/bundler/support/indexes.rb +++ b/spec/bundler/support/indexes.rb @@ -77,8 +77,8 @@ module Spec def an_awesome_index build_index do - gem "rack", %w[0.8 0.9 0.9.1 0.9.2 1.0 1.1] - gem "rack-mount", %w[0.4 0.5 0.5.1 0.5.2 0.6] + gem "myrack", %w[0.8 0.9 0.9.1 0.9.2 1.0 1.1] + gem "myrack-mount", %w[0.4 0.5 0.5.1 0.5.2 0.6] # --- Pre-release support gem "RubyGems\0", ["1.3.2"] @@ -89,10 +89,10 @@ module Spec gem "actionpack", version do dep "activesupport", version if version >= v("3.0.0.beta") - dep "rack", "~> 1.1" - dep "rack-mount", ">= 0.5" - elsif version > v("2.3") then dep "rack", "~> 1.0.0" - elsif version > v("2.0.0") then dep "rack", "~> 0.9.0" + dep "myrack", "~> 1.1" + dep "myrack-mount", ">= 0.5" + elsif version > v("2.3") then dep "myrack", "~> 1.0.0" + elsif version > v("2.0.0") then dep "myrack", "~> 0.9.0" end end gem "activerecord", version do @@ -367,7 +367,7 @@ module Spec def a_circular_index build_index do - gem "rack", "1.0.1" + gem "myrack", "1.0.1" gem("foo", "0.2.6") do dep "bar", ">= 0" end diff --git a/spec/bundler/support/vendored_net_http.rb b/spec/bundler/support/vendored_net_http.rb new file mode 100644 index 0000000000..8ff2ccd1fe --- /dev/null +++ b/spec/bundler/support/vendored_net_http.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This defined? guard can be removed once RubyGems 3.4 support is dropped. +# +# Bundler specs load this code from `spec/support/vendored_net_http.rb` to avoid +# activating the Bundler gem too early. Without this guard, we get redefinition +# warnings once Bundler is actually activated and +# `lib/bundler/vendored_net_http.rb` is required. This is not an issue in +# RubyGems versions including `rubygems/vendored_net_http` since `require` takes +# care of avoiding the double load. +# +unless defined?(Gem::Net) + begin + require "rubygems/vendored_net_http" + rescue LoadError + begin + require "rubygems/net/http" + rescue LoadError + require "net/http" + Gem::Net = Net + end + end +end diff --git a/spec/bundler/update/gemfile_spec.rb b/spec/bundler/update/gemfile_spec.rb index d32a7945b0..cb94799061 100644 --- a/spec/bundler/update/gemfile_spec.rb +++ b/spec/bundler/update/gemfile_spec.rb @@ -4,8 +4,8 @@ RSpec.describe "bundle update" do context "with --gemfile" do it "finds the gemfile" do gemfile bundled_app("NotGemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle :install, gemfile: bundled_app("NotGemfile") @@ -14,15 +14,15 @@ RSpec.describe "bundle update" do # Specify BUNDLE_GEMFILE for `the_bundle` # to retrieve the proper Gemfile ENV["BUNDLE_GEMFILE"] = "NotGemfile" - expect(the_bundle).to include_gems "rack 1.0.0" + expect(the_bundle).to include_gems "myrack 1.0.0" end end context "with gemfile set via config" do before do gemfile bundled_app("NotGemfile"), <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' G bundle "config set --local gemfile #{bundled_app("NotGemfile")}" @@ -33,7 +33,7 @@ RSpec.describe "bundle update" do bundle "update", all: true bundle "list" - expect(out).to include("rack (1.0.0)") + expect(out).to include("myrack (1.0.0)") end it "uses the gemfile while in a subdirectory" do @@ -41,7 +41,7 @@ RSpec.describe "bundle update" do bundle "update", all: true, dir: bundled_app("subdir") bundle "list", dir: bundled_app("subdir") - expect(out).to include("rack (1.0.0)") + expect(out).to include("myrack (1.0.0)") end end end diff --git a/spec/bundler/update/gems/fund_spec.rb b/spec/bundler/update/gems/fund_spec.rb index 4a87c16bf7..a5624d3e0a 100644 --- a/spec/bundler/update/gems/fund_spec.rb +++ b/spec/bundler/update/gems/fund_spec.rb @@ -24,7 +24,7 @@ RSpec.describe "bundle update" do end gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'has_funding_and_other_metadata' gem 'has_funding', '< 2.0' G @@ -35,7 +35,7 @@ RSpec.describe "bundle update" do context "when listed gems are updated" do before do gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" gem 'has_funding_and_other_metadata' gem 'has_funding' G diff --git a/spec/bundler/update/gems/post_install_spec.rb b/spec/bundler/update/gems/post_install_spec.rb index e3593387d4..9c71f6e0e3 100644 --- a/spec/bundler/update/gems/post_install_spec.rb +++ b/spec/bundler/update/gems/post_install_spec.rb @@ -5,8 +5,8 @@ RSpec.describe "bundle update" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack', "< 1.0" + source "https://gem.repo1" + gem 'myrack', "< 1.0" gem 'thin' G @@ -17,10 +17,10 @@ RSpec.describe "bundle update" do shared_examples "a config observer" do context "when ignore post-install messages for gem is set" do - let(:config) { "ignore_messages.rack true" } + let(:config) { "ignore_messages.myrack true" } it "doesn't display gem's post-install message" do - expect(out).not_to include("Rack's post install message") + expect(out).not_to include("Myrack's post install message") end end @@ -35,8 +35,8 @@ RSpec.describe "bundle update" do shared_examples "a post-install message outputter" do it "should display post-install messages for updated gems" do - expect(out).to include("Post-install message from rack:") - expect(out).to include("Rack's post install message") + expect(out).to include("Post-install message from myrack:") + expect(out).to include("Myrack's post install message") end it "should not display the post-install message for non-updated gems" do @@ -47,8 +47,8 @@ RSpec.describe "bundle update" do context "when listed gem is updated" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + source "https://gem.repo1" + gem 'myrack' gem 'thin' G @@ -62,8 +62,8 @@ RSpec.describe "bundle update" do context "when dependency triggers update" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack-obama' + source "https://gem.repo1" + gem 'myrack-obama' gem 'thin' G diff --git a/spec/bundler/update/git_spec.rb b/spec/bundler/update/git_spec.rb index f80281e8ce..d6e95d27dd 100644 --- a/spec/bundler/update/git_spec.rb +++ b/spec/bundler/update/git_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "bundle update" do update_git "foo", branch: "omg" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo-1.0")}", :branch => "omg" do gem 'foo' end @@ -29,8 +29,8 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rails", :git => "#{file_uri_for(lib_path("rails"))}" + source "https://gem.repo1" + gem "rails", :git => "#{lib_path("rails")}" G bundle "update rails" @@ -42,7 +42,7 @@ RSpec.describe "bundle update" do update_git "foo", branch: "omg", path: lib_path("foo") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" git "#{lib_path("foo")}", :branch => "omg" do gem 'foo' end @@ -64,8 +64,8 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo"))}" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo")}" gem "bar" G @@ -83,30 +83,30 @@ RSpec.describe "bundle update" do build_git "foo", path: lib_path("foo_two") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "foo", "1.0", :git => "#{file_uri_for(lib_path("foo_one"))}" + source "https://gem.repo1" + gem "foo", "1.0", :git => "#{lib_path("foo_one")}" G FileUtils.rm_rf lib_path("foo_one") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "foo", "1.0", :git => "#{file_uri_for(lib_path("foo_two"))}" + source "https://gem.repo1" + gem "foo", "1.0", :git => "#{lib_path("foo_two")}" G expect(err).to be_empty - expect(out).to include("Fetching #{file_uri_for(lib_path)}/foo_two") + expect(out).to include("Fetching #{lib_path}/foo_two") expect(out).to include("Bundle complete!") end it "fetches tags from the remote" do build_git "foo" @remote = build_git("bar", bare: true) - update_git "foo", remote: file_uri_for(@remote.path) + update_git "foo", remote: @remote.path update_git "foo", push: "main" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{@remote.path}" G @@ -115,7 +115,7 @@ RSpec.describe "bundle update" do update_git "foo", push: "fubar" gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem 'foo', :git => "#{@remote.path}", :tag => "fubar" G @@ -148,7 +148,7 @@ RSpec.describe "bundle update" do it "it unlocks the source when submodules are added to a git source" do install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" git "#{lib_path("has_submodule-1.0")}" do gem "has_submodule" end @@ -158,7 +158,7 @@ RSpec.describe "bundle update" do expect(out).to eq("GEM") install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" git "#{lib_path("has_submodule-1.0")}", :submodules => true do gem "has_submodule" end @@ -170,7 +170,7 @@ RSpec.describe "bundle update" do it "unlocks the source when submodules are removed from git source", git: ">= 2.9.0" do install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" git "#{lib_path("has_submodule-1.0")}", :submodules => true do gem "has_submodule" end @@ -180,7 +180,7 @@ RSpec.describe "bundle update" do expect(out).to eq("GIT") install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" + source "https://gem.repo4" git "#{lib_path("has_submodule-1.0")}" do gem "has_submodule" end @@ -195,8 +195,8 @@ RSpec.describe "bundle update" do build_git "foo", "1.0" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}" + source "https://gem.repo1" + gem "foo", :git => "#{lib_path("foo-1.0")}" G lib_path("foo-1.0").join(".git").rmtree @@ -207,19 +207,19 @@ RSpec.describe "bundle update" do end it "should not explode on invalid revision on update of gem by name" do - build_git "rack", "0.8" + build_git "myrack", "0.8" - build_git "rack", "0.8", path: lib_path("local-rack") do |s| - s.write "lib/rack.rb", "puts :LOCAL" + build_git "myrack", "0.8", path: lib_path("local-myrack") do |s| + s.write "lib/myrack.rb", "puts :LOCAL" end install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack", :git => "#{file_uri_for(lib_path("rack-0.8"))}", :branch => "main" + source "https://gem.repo1" + gem "myrack", :git => "#{lib_path("myrack-0.8")}", :branch => "main" G - bundle %(config set local.rack #{lib_path("local-rack")}) - bundle "update rack" + bundle %(config set local.myrack #{lib_path("local-myrack")}) + bundle "update myrack" expect(out).to include("Bundle updated!") end @@ -227,14 +227,14 @@ RSpec.describe "bundle update" do build_git "rails", "2.3.2", path: lib_path("rails") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rails", :git => "#{file_uri_for(lib_path("rails"))}" + source "https://gem.repo1" + gem "rails", :git => "#{lib_path("rails")}" G update_git "rails", "3.0", path: lib_path("rails"), gemspec: true bundle "update", all: true - expect(out).to include("Using rails 3.0 (was 2.3.2) from #{file_uri_for(lib_path("rails"))} (at main@#{revision_for(lib_path("rails"))[0..6]})") + expect(out).to include("Using rails 3.0 (was 2.3.2) from #{lib_path("rails")} (at main@#{revision_for(lib_path("rails"))[0..6]})") end end @@ -246,11 +246,11 @@ RSpec.describe "bundle update" do end install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" git "#{lib_path("foo")}" do gem 'foo' end - gem 'rack' + gem 'myrack' G end @@ -279,7 +279,7 @@ RSpec.describe "bundle update" do update_git "foo", path: @git.path bundle "update --source foo" - expect(the_bundle).to include_gems "rack 1.0" + expect(the_bundle).to include_gems "myrack 1.0" end end @@ -289,11 +289,11 @@ RSpec.describe "bundle update" do @git = build_git "foo", path: lib_path("bar") install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + source "https://gem.repo2" git "#{lib_path("bar")}" do gem 'foo' end - gem 'rack' + gem 'myrack' G end @@ -311,7 +311,7 @@ RSpec.describe "bundle update" do checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "2.0" - c.checksum gem_repo2, "rack", "1.0.0" + c.checksum gem_repo2, "myrack", "1.0.0" end expect(lockfile).to eq <<~G @@ -322,16 +322,16 @@ RSpec.describe "bundle update" do foo (2.0) GEM - remote: #{file_uri_for(gem_repo2)}/ + remote: https://gem.repo2/ specs: - rack (1.0.0) + myrack (1.0.0) PLATFORMS #{lockfile_platforms} DEPENDENCIES foo! - rack + myrack #{checksums} BUNDLED WITH #{Bundler::VERSION} diff --git a/spec/bundler/update/path_spec.rb b/spec/bundler/update/path_spec.rb index 1f8992b33f..8c76c94e1a 100644 --- a/spec/bundler/update/path_spec.rb +++ b/spec/bundler/update/path_spec.rb @@ -6,7 +6,7 @@ RSpec.describe "path sources" do build_lib "activesupport", "2.3.5", path: lib_path("rails/activesupport") install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "https://gem.repo1" gem "activesupport", :path => "#{lib_path("rails/activesupport")}" G diff --git a/spec/bundler/update/redownload_spec.rb b/spec/bundler/update/redownload_spec.rb index 4a8c711bfa..66437fb938 100644 --- a/spec/bundler/update/redownload_spec.rb +++ b/spec/bundler/update/redownload_spec.rb @@ -3,42 +3,42 @@ RSpec.describe "bundle update" do before :each do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + source "https://gem.repo1" + gem "myrack" G end describe "with --force" do it "shows a deprecation when single flag passed", bundler: 2 do - bundle "update rack --force" + bundle "update myrack --force" expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end it "shows a deprecation when multiple flags passed", bundler: 2 do - bundle "update rack --no-color --force" + bundle "update myrack --no-color --force" expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end end describe "with --redownload" do it "does not show a deprecation when single flag passed" do - bundle "update rack --redownload" + bundle "update myrack --redownload" expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end it "does not show a deprecation when single multiple flags passed" do - bundle "update rack --no-color --redownload" + bundle "update myrack --no-color --redownload" expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end it "re-installs installed gems" do - rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb") - rack_lib.open("w") {|f| f.write("blah blah blah") } + myrack_lib = default_bundle_path("gems/myrack-1.0.0/lib/myrack.rb") + myrack_lib.open("w") {|f| f.write("blah blah blah") } bundle :update, redownload: true - expect(out).to include "Installing rack 1.0.0" - expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n") - expect(the_bundle).to include_gems "rack 1.0.0" + expect(out).to include "Installing myrack 1.0.0" + expect(myrack_lib.open(&:read)).to eq("MYRACK = '1.0.0'\n") + expect(the_bundle).to include_gems "myrack 1.0.0" end end end |