summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/bundler/cli_spec.rb16
-rw-r--r--spec/bundler/bundler/compact_index_client/updater_spec.rb22
-rw-r--r--spec/bundler/bundler/env_spec.rb1
-rw-r--r--spec/bundler/bundler/fetcher/index_spec.rb117
-rw-r--r--spec/bundler/bundler/plugin/api/source_spec.rb6
-rw-r--r--spec/bundler/bundler/source/git/git_proxy_spec.rb10
-rw-r--r--spec/bundler/cache/gems_spec.rb7
-rw-r--r--spec/bundler/commands/binstubs_spec.rb34
-rw-r--r--spec/bundler/commands/check_spec.rb10
-rw-r--r--spec/bundler/commands/clean_spec.rb5
-rw-r--r--spec/bundler/commands/console_spec.rb41
-rw-r--r--spec/bundler/commands/exec_spec.rb87
-rw-r--r--spec/bundler/commands/fund_spec.rb43
-rw-r--r--spec/bundler/commands/info_spec.rb17
-rw-r--r--spec/bundler/commands/install_spec.rb27
-rw-r--r--spec/bundler/commands/licenses_spec.rb10
-rw-r--r--spec/bundler/commands/list_spec.rb4
-rw-r--r--spec/bundler/commands/lock_spec.rb6
-rw-r--r--spec/bundler/commands/newgem_spec.rb7
-rw-r--r--spec/bundler/commands/remove_spec.rb84
-rw-r--r--spec/bundler/commands/update_spec.rb31
-rw-r--r--spec/bundler/install/bundler_spec.rb24
-rw-r--r--spec/bundler/install/deploy_spec.rb10
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb14
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb43
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb159
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb69
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb20
-rw-r--r--spec/bundler/install/gems/flex_spec.rb3
-rw-r--r--spec/bundler/install/gems/fund_spec.rb37
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb63
-rw-r--r--spec/bundler/install/prereleases_spec.rb15
-rw-r--r--spec/bundler/lock/lockfile_spec.rb256
-rw-r--r--spec/bundler/other/platform_spec.rb8
-rw-r--r--spec/bundler/plugins/install_spec.rb13
-rw-r--r--spec/bundler/plugins/source/example_spec.rb57
-rw-r--r--spec/bundler/quality_spec.rb4
-rw-r--r--spec/bundler/realworld/mirror_probe_spec.rb28
-rw-r--r--spec/bundler/runtime/inline_spec.rb30
-rw-r--r--spec/bundler/runtime/setup_spec.rb5
-rw-r--r--spec/bundler/support/artifice/endpoint_marshal_fail_basic_authentication.rb (renamed from spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb)0
-rw-r--r--spec/bundler/support/builders.rb136
-rw-r--r--spec/bundler/support/platforms.rb6
-rw-r--r--spec/bundler/update/gems/fund_spec.rb29
47 files changed, 931 insertions, 693 deletions
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index 50e2a698eb..8e4f9e6d36 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -32,49 +32,49 @@ RSpec.describe "bundle executable" do
it "aliases e to exec" do
bundle "e --help"
- expect(out).to include("BUNDLE-EXEC")
+ expect(out).to include("bundle-exec")
end
it "aliases ex to exec" do
bundle "ex --help"
- expect(out).to include("BUNDLE-EXEC")
+ expect(out).to include("bundle-exec")
end
it "aliases exe to exec" do
bundle "exe --help"
- expect(out).to include("BUNDLE-EXEC")
+ expect(out).to include("bundle-exec")
end
it "aliases c to check" do
bundle "c --help"
- expect(out).to include("BUNDLE-CHECK")
+ expect(out).to include("bundle-check")
end
it "aliases i to install" do
bundle "i --help"
- expect(out).to include("BUNDLE-INSTALL")
+ expect(out).to include("bundle-install")
end
it "aliases ls to list" do
bundle "ls --help"
- expect(out).to include("BUNDLE-LIST")
+ expect(out).to include("bundle-list")
end
it "aliases package to cache" do
bundle "package --help"
- expect(out).to include("BUNDLE-CACHE")
+ expect(out).to include("bundle-cache")
end
it "aliases pack to cache" do
bundle "pack --help"
- expect(out).to include("BUNDLE-CACHE")
+ expect(out).to include("bundle-cache")
end
end
diff --git a/spec/bundler/bundler/compact_index_client/updater_spec.rb b/spec/bundler/bundler/compact_index_client/updater_spec.rb
index 26159dccd8..acb312edb3 100644
--- a/spec/bundler/bundler/compact_index_client/updater_spec.rb
+++ b/spec/bundler/bundler/compact_index_client/updater_spec.rb
@@ -3,28 +3,25 @@
require "net/http"
require "bundler/compact_index_client"
require "bundler/compact_index_client/updater"
+require "tmpdir"
RSpec.describe Bundler::CompactIndexClient::Updater do
let(:fetcher) { double(:fetcher) }
- let(:local_path) { Pathname("/tmp/localpath") }
+ let(:local_path) { Pathname.new Dir.mktmpdir("localpath") }
let(:remote_path) { double(:remote_path) }
let!(:updater) { described_class.new(fetcher) }
context "when the ETag header is missing" do
# Regression test for https://github.com/rubygems/bundler/issues/5463
+ let(:response) { double(:response, :body => "abc123") }
- let(:response) { double(:response, :body => "") }
-
- it "MisMatchedChecksumError is raised" do
- # Twice: #update retries on failure
- expect(response).to receive(:[]).with("Content-Encoding").twice { "" }
- expect(response).to receive(:[]).with("ETag").twice { nil }
- expect(fetcher).to receive(:call).twice { response }
+ it "treats the response as an update" do
+ expect(response).to receive(:[]).with("Content-Encoding") { "" }
+ expect(response).to receive(:[]).with("ETag") { nil }
+ expect(fetcher).to receive(:call) { response }
- expect do
- updater.update(local_path, remote_path)
- end.to raise_error(Bundler::CompactIndexClient::Updater::MisMatchedChecksumError)
+ updater.update(local_path, remote_path)
end
end
@@ -43,7 +40,8 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
context "when bundler doesn't have permissions on Dir.tmpdir" do
it "Errno::EACCES is raised" do
- allow(Dir).to receive(:mktmpdir) { raise Errno::EACCES }
+ local_path # create local path before stubbing mktmpdir
+ allow(Bundler::Dir).to receive(:mktmpdir) { raise Errno::EACCES }
expect do
updater.update(local_path, remote_path)
diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb
index e900963350..ac65c34b0d 100644
--- a/spec/bundler/bundler/env_spec.rb
+++ b/spec/bundler/bundler/env_spec.rb
@@ -1,6 +1,5 @@
# frozen_string_literal: true
-require "openssl"
require "bundler/settings"
RSpec.describe Bundler::Env do
diff --git a/spec/bundler/bundler/fetcher/index_spec.rb b/spec/bundler/bundler/fetcher/index_spec.rb
index 5ecd7d9e05..b8ce46321e 100644
--- a/spec/bundler/bundler/fetcher/index_spec.rb
+++ b/spec/bundler/bundler/fetcher/index_spec.rb
@@ -17,100 +17,81 @@ RSpec.describe Bundler::Fetcher::Index do
end
context "error handling" do
- shared_examples_for "the error is properly handled" do
- let(:remote_uri) { Bundler::URI("http://remote-uri.org") }
- before do
- allow(subject).to receive(:remote_uri).and_return(remote_uri)
- end
+ let(:remote_uri) { Bundler::URI("http://remote-uri.org") }
+ before do
+ allow(rubygems).to receive(:fetch_all_remote_specs) { raise Gem::RemoteFetcher::FetchError.new(error_message, display_uri) }
+ allow(subject).to receive(:remote_uri).and_return(remote_uri)
+ end
- context "when certificate verify failed" do
- let(:error_message) { "certificate verify failed" }
+ context "when certificate verify failed" do
+ let(:error_message) { "certificate verify failed" }
- it "should raise a Bundler::Fetcher::CertificateFailureError" do
- expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::CertificateFailureError,
- %r{Could not verify the SSL certificate for http://sample_uri.com})
- end
+ it "should raise a Bundler::Fetcher::CertificateFailureError" do
+ expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::CertificateFailureError,
+ %r{Could not verify the SSL certificate for http://sample_uri.com})
end
+ end
- context "when a 401 response occurs" do
- let(:error_message) { "401" }
-
- before do
- allow(remote_uri).to receive(:userinfo).and_return(userinfo)
- end
-
- context "and there was userinfo" do
- let(:userinfo) { double(:userinfo) }
+ context "when a 401 response occurs" do
+ let(:error_message) { "401" }
- it "should raise a Bundler::Fetcher::BadAuthenticationError" do
- expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::BadAuthenticationError,
- %r{Bad username or password for http://remote-uri.org})
- end
- end
+ before do
+ allow(remote_uri).to receive(:userinfo).and_return(userinfo)
+ end
- context "and there was no userinfo" do
- let(:userinfo) { nil }
+ context "and there was userinfo" do
+ let(:userinfo) { double(:userinfo) }
- it "should raise a Bundler::Fetcher::AuthenticationRequiredError" do
- expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError,
- %r{Authentication is required for http://remote-uri.org})
- end
+ it "should raise a Bundler::Fetcher::BadAuthenticationError" do
+ expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::BadAuthenticationError,
+ %r{Bad username or password for http://remote-uri.org})
end
end
- context "when a 403 response occurs" do
- let(:error_message) { "403" }
+ context "and there was no userinfo" do
+ let(:userinfo) { nil }
- before do
- allow(remote_uri).to receive(:userinfo).and_return(userinfo)
+ it "should raise a Bundler::Fetcher::AuthenticationRequiredError" do
+ expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError,
+ %r{Authentication is required for http://remote-uri.org})
end
+ end
+ end
- context "and there was userinfo" do
- let(:userinfo) { double(:userinfo) }
+ context "when a 403 response occurs" do
+ let(:error_message) { "403" }
- it "should raise a Bundler::Fetcher::BadAuthenticationError" do
- expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::BadAuthenticationError,
- %r{Bad username or password for http://remote-uri.org})
- end
- end
+ before do
+ allow(remote_uri).to receive(:userinfo).and_return(userinfo)
+ end
- context "and there was no userinfo" do
- let(:userinfo) { nil }
+ context "and there was userinfo" do
+ let(:userinfo) { double(:userinfo) }
- it "should raise a Bundler::Fetcher::AuthenticationRequiredError" do
- expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError,
- %r{Authentication is required for http://remote-uri.org})
- end
+ it "should raise a Bundler::Fetcher::BadAuthenticationError" do
+ expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::BadAuthenticationError,
+ %r{Bad username or password for http://remote-uri.org})
end
end
- context "any other message is returned" do
- let(:error_message) { "You get an error, you get an error!" }
-
- before { allow(Bundler).to receive(:ui).and_return(double(:trace => nil)) }
+ context "and there was no userinfo" do
+ let(:userinfo) { nil }
- it "should raise a Bundler::HTTPError" do
- expect { subject.specs(gem_names) }.to raise_error(Bundler::HTTPError, "Could not fetch specs from http://sample_uri.com")
+ it "should raise a Bundler::Fetcher::AuthenticationRequiredError" do
+ expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError,
+ %r{Authentication is required for http://remote-uri.org})
end
end
end
- context "when a Gem::RemoteFetcher::FetchError occurs" do
- before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise Gem::RemoteFetcher::FetchError.new(error_message, nil) } }
+ context "any other message is returned" do
+ let(:error_message) { "You get an error, you get an error!" }
- it_behaves_like "the error is properly handled"
- end
+ before { allow(Bundler).to receive(:ui).and_return(double(:trace => nil)) }
- context "when a OpenSSL::SSL::SSLError occurs" do
- before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise OpenSSL::SSL::SSLError.new(error_message) } }
-
- it_behaves_like "the error is properly handled"
- end
-
- context "when a Net::HTTPFatalError occurs" do
- before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise Net::HTTPFatalError.new(error_message, 404) } }
-
- it_behaves_like "the error is properly handled"
+ it "should raise a Bundler::HTTPError" do
+ expect { subject.specs(gem_names) }.to raise_error(Bundler::HTTPError, "Could not fetch specs from http://sample_uri.com due to underlying error <You get an error, you get an error! (http://sample_uri.com)>")
+ end
end
end
end
diff --git a/spec/bundler/bundler/plugin/api/source_spec.rb b/spec/bundler/bundler/plugin/api/source_spec.rb
index 2c50ff56a4..428ceb220a 100644
--- a/spec/bundler/bundler/plugin/api/source_spec.rb
+++ b/spec/bundler/bundler/plugin/api/source_spec.rb
@@ -79,4 +79,10 @@ RSpec.describe Bundler::Plugin::API::Source do
end
end
end
+
+ describe "to_s" do
+ it "returns the string with type and uri" do
+ expect(source.to_s).to eq("plugin source for spec_type with uri uri://to/test")
+ end
+ end
end
diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb
index 169d7234b4..4744e0cd4c 100644
--- a/spec/bundler/bundler/source/git/git_proxy_spec.rb
+++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe Bundler::Source::Git::GitProxy do
let(:path) { Pathname("path") }
- let(:uri) { "https://github.com/bundler/bundler.git" }
+ let(:uri) { "https://github.com/rubygems/rubygems.git" }
let(:ref) { "HEAD" }
let(:revision) { nil }
let(:git_source) { nil }
@@ -11,20 +11,20 @@ RSpec.describe Bundler::Source::Git::GitProxy do
context "with configured credentials" do
it "adds username and password to URI" do
Bundler.settings.temporary(uri => "u:p") do
- expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/bundler/bundler.git"))
+ expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git"))
subject.checkout
end
end
it "adds username and password to URI for host" do
Bundler.settings.temporary("github.com" => "u:p") do
- expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/bundler/bundler.git"))
+ expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git"))
subject.checkout
end
end
it "does not add username and password to mismatched URI" do
- Bundler.settings.temporary("https://u:p@github.com/bundler/bundler-mismatch.git" => "u:p") do
+ Bundler.settings.temporary("https://u:p@github.com/rubygems/rubygems-mismatch.git" => "u:p") do
expect(subject).to receive(:git_retry).with(match(uri))
subject.checkout
end
@@ -32,7 +32,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do
it "keeps original userinfo" do
Bundler.settings.temporary("github.com" => "u:p") do
- original = "https://orig:info@github.com/bundler/bundler.git"
+ original = "https://orig:info@github.com/rubygems/rubygems.git"
subject = described_class.new(Pathname("path"), original, "HEAD")
expect(subject).to receive(:git_retry).with(match(original))
subject.checkout
diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb
index 2b5ba733f0..161ec64218 100644
--- a/spec/bundler/cache/gems_spec.rb
+++ b/spec/bundler/cache/gems_spec.rb
@@ -197,7 +197,12 @@ RSpec.describe "bundle cache" do
end
it "adds and removes when gems are updated" do
- update_repo2
+ update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+ end
+
bundle "update", :all => true
expect(cached_gem("rack-1.2")).to exist
expect(cached_gem("rack-1.0.0")).not_to exist
diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb
index 632c521caa..3b177b32ea 100644
--- a/spec/bundler/commands/binstubs_spec.rb
+++ b/spec/bundler/commands/binstubs_spec.rb
@@ -51,6 +51,18 @@ RSpec.describe "bundle binstubs <gem>" do
expect(bundled_app("bin/rake")).to exist
end
+ it "allows installing binstubs for all platforms" do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ G
+
+ bundle "binstubs rack --all-platforms"
+
+ expect(bundled_app("bin/rackup")).to exist
+ expect(bundled_app("bin/rackup.cmd")).to exist
+ end
+
it "displays an error when used without any gem" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -96,6 +108,10 @@ 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"
+ end
+
build_gem "prints_loaded_gems", "1.0" do |s|
s.executables = "print_loaded_gems"
s.bindir = "exe"
@@ -262,7 +278,7 @@ RSpec.describe "bundle binstubs <gem>" do
end
it "sets correct permissions for binstubs" do
- skip "https://github.com/rubygems/bundler/issues/6895" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3352" if Gem.win_platform?
with_umask(0o002) do
install_gemfile <<-G
@@ -352,6 +368,14 @@ RSpec.describe "bundle binstubs <gem>" do
expect(bundled_app("foo/rackup")).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
+ end
+ end
end
context "when the bin already exists" do
@@ -417,8 +441,14 @@ RSpec.describe "bundle binstubs <gem>" do
end
it "works if the gem has development dependencies" do
+ build_repo2 do
+ build_gem "with_development_dependency" do |s|
+ s.add_development_dependency "activesupport", "= 2.3.5"
+ end
+ end
+
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "with_development_dependency"
G
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index dd69172677..5a746591b3 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -71,13 +71,19 @@ RSpec.describe "bundle check" do
end
it "prints a generic message if you changed your lockfile" do
+ build_repo2 do
+ build_gem "rails_pinned_to_old_activesupport" do |s|
+ s.add_dependency "activesupport", "= 1.2.3"
+ end
+ end
+
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem 'rails'
G
gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rails"
gem "rails_pinned_to_old_activesupport"
G
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index bd8e7f16c7..7c43aaabc4 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/commands/clean_spec.rb
@@ -603,8 +603,7 @@ RSpec.describe "bundle clean" do
it "when using --force on system gems, it doesn't remove binaries" do
bundle "config set path.system true"
- build_repo2
- update_repo2 do
+ build_repo2 do
build_gem "bindir" do |s|
s.bindir = "exe"
s.executables = "foo"
@@ -640,7 +639,7 @@ RSpec.describe "bundle clean" do
end
end
- realworld_system_gems "fiddle"
+ realworld_system_gems "fiddle --version 1.0.0"
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
diff --git a/spec/bundler/commands/console_spec.rb b/spec/bundler/commands/console_spec.rb
index 3092184f45..6f1e96261e 100644
--- a/spec/bundler/commands/console_spec.rb
+++ b/spec/bundler/commands/console_spec.rb
@@ -2,8 +2,43 @@
RSpec.describe "bundle console", :bundler => "< 3", :readline => true do
before :each do
+ build_repo2 do
+ # A minimal fake pry console
+ build_gem "pry" do |s|
+ s.write "lib/pry.rb", <<-RUBY
+ class Pry
+ class << self
+ def toplevel_binding
+ unless defined?(@toplevel_binding) && @toplevel_binding
+ TOPLEVEL_BINDING.eval %{
+ def self.__pry__; binding; end
+ Pry.instance_variable_set(:@toplevel_binding, __pry__)
+ class << self; undef __pry__; end
+ }
+ end
+ @toplevel_binding.eval('private')
+ @toplevel_binding
+ end
+
+ def __pry__
+ while line = gets
+ begin
+ puts eval(line, toplevel_binding).inspect.sub(/^"(.*)"$/, '=> \\1')
+ rescue Exception => e
+ puts "\#{e.class}: \#{e.message}"
+ puts e.backtrace.first
+ end
+ end
+ end
+ alias start __pry__
+ end
+ end
+ RUBY
+ end
+ end
+
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rack"
gem "activesupport", :group => :test
gem "rack_middleware", :group => :development
@@ -28,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_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "pry"
G
bundle "config set console pry"
@@ -87,7 +122,7 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do
it "performs an automatic bundle install" do
gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rack"
gem "activesupport", :group => :test
gem "rack_middleware", :group => :development
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index fbce4b7bc1..4c34964053 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -68,7 +68,7 @@ RSpec.describe "bundle exec" do
end
it "respects custom process title when loading through ruby" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
script_that_changes_its_own_title_and_checks_if_picked_up_by_ps_unix_utility = <<~'RUBY'
Process.setproctitle("1-2-3-4-5-6-7")
@@ -93,7 +93,7 @@ RSpec.describe "bundle exec" do
end
it "handles --keep-file-descriptors" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
require "tempfile"
@@ -126,7 +126,7 @@ RSpec.describe "bundle exec" do
end
it "can run a command named --verbose" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
install_gemfile 'gem "rack"'
File.open(bundled_app("--verbose"), "w") do |f|
@@ -286,7 +286,7 @@ RSpec.describe "bundle exec" do
end
it "does not duplicate already exec'ed RUBYOPT" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
install_gemfile <<-G
gem "rack"
@@ -304,7 +304,7 @@ RSpec.describe "bundle exec" do
end
it "does not duplicate already exec'ed RUBYLIB" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
install_gemfile <<-G
gem "rack"
@@ -357,7 +357,7 @@ RSpec.describe "bundle exec" do
bundle "config set clean false" # want to keep the rackup binstub
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "with_license"
+ gem "foo"
G
[true, false].each do |l|
bundle "config set disable_exec_load #{l}"
@@ -373,7 +373,7 @@ RSpec.describe "bundle exec" do
each_prefix.call("exec") do |exec|
describe "when #{exec} is used" do
before(:each) do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
install_gemfile <<-G
gem "rack"
@@ -588,7 +588,7 @@ RSpec.describe "bundle exec" do
describe "with gems bundled for deployment" do
it "works when calling bundler from another script" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
gemfile <<-G
module Monkey
@@ -644,7 +644,7 @@ RSpec.describe "bundle exec" do
shared_examples_for "it runs" do
it "like a normally executed executable" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
subject
expect(exitstatus).to eq(exit_code)
@@ -698,15 +698,23 @@ RSpec.describe "bundle exec" do
let(:exit_code) { 1 }
let(:expected_err) do
"bundler: failed to load command: #{path} (#{path})" \
- "\nRuntimeError: ERROR\n #{path}:10:in `<top (required)>'"
+ "\n#{path}:10:in `<top (required)>': ERROR (RuntimeError)"
+ end
+
+ it "runs like a normally executed executable" do
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
+
+ subject
+ expect(exitstatus).to eq(exit_code)
+ expect(err).to start_with(expected_err)
+ expect(out).to eq(expected)
end
- it_behaves_like "it runs"
end
context "the executable raises an error without a backtrace" do
let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" }
let(:exit_code) { 1 }
- let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" }
+ let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\n#{system_gem_path("bin/bundle")}: Err (Err)" }
let(:expected) { super() }
it_behaves_like "it runs"
@@ -747,7 +755,7 @@ RSpec.describe "bundle exec" do
let(:expected) { "" }
let(:expected_err) { <<-EOS.strip }
\e[31mCould not find gem 'rack (= 2)' in locally installed gems.
-The source contains 'rack' at: 1.0.0\e[0m
+The source contains the following versions of 'rack': 1.0.0\e[0m
\e[33mRun `bundle install` to install missing gems.\e[0m
EOS
@@ -825,7 +833,7 @@ __FILE__: #{path.to_s.inspect}
RUBY
it "receives the signal" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
bundle("exec #{path}") do |_, o, thr|
o.gets # Consumes 'Started' and ensures that thread has started
@@ -848,7 +856,7 @@ __FILE__: #{path.to_s.inspect}
RUBY
it "makes sure no unexpected signals are restored to DEFAULT" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
test_signals.each do |n|
Signal.trap(n, "IGNORE")
@@ -865,6 +873,8 @@ __FILE__: #{path.to_s.inspect}
context "nested bundle exec" do
context "when bundle in a local path" do
before do
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
+
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
@@ -874,8 +884,6 @@ __FILE__: #{path.to_s.inspect}
end
it "correctly shells out" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
-
file = bundled_app("file_that_bundle_execs.rb")
create_file(file, <<-RUBY)
#!#{Gem.ruby}
@@ -887,12 +895,55 @@ __FILE__: #{path.to_s.inspect}
end
end
+ context "when Kernel.require uses extra monkeypatches" do
+ before do
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
+
+ install_gemfile ""
+ end
+
+ it "does not undo the monkeypatches" do
+ karafka = bundled_app("bin/karafka")
+ create_file(karafka, <<~RUBY)
+ #!#{Gem.ruby}
+
+ module Kernel
+ module_function
+
+ alias_method :require_before_extra_monkeypatches, :require
+
+ def require(path)
+ puts "requiring \#{path} used the monkeypatch"
+
+ require_before_extra_monkeypatches(path)
+ end
+ end
+
+ Bundler.setup(:default)
+
+ require "foo"
+ RUBY
+ karafka.chmod(0o777)
+
+ foreman = bundled_app("bin/foreman")
+ create_file(foreman, <<~RUBY)
+ #!#{Gem.ruby}
+
+ puts `bundle exec bin/karafka`
+ RUBY
+ foreman.chmod(0o777)
+
+ bundle "exec #{foreman}"
+ expect(out).to eq("requiring foo used the monkeypatch")
+ end
+ end
+
context "with a system gem that shadows a default gem" do
let(:openssl_version) { "99.9.9" }
let(:expected) { ruby "gem 'openssl', '< 999999'; require 'openssl'; puts OpenSSL::VERSION", :artifice => nil, :raise_on_error => false }
it "only leaves the default gem in the stdlib available" do
- skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+ skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform?
skip "openssl isn't a default gem" if expected.empty?
install_gemfile "" # must happen before installing the broken system gem
diff --git a/spec/bundler/commands/fund_spec.rb b/spec/bundler/commands/fund_spec.rb
index ee3aff3a29..5a0c5411da 100644
--- a/spec/bundler/commands/fund_spec.rb
+++ b/spec/bundler/commands/fund_spec.rb
@@ -1,24 +1,51 @@
# frozen_string_literal: true
RSpec.describe "bundle fund" do
+ before do
+ build_repo2 do
+ build_gem "has_funding_and_other_metadata" do |s|
+ s.metadata = {
+ "bug_tracker_uri" => "https://example.com/user/bestgemever/issues",
+ "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md",
+ "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
+ "homepage_uri" => "https://bestgemever.example.io",
+ "mailing_list_uri" => "https://groups.example.com/bestgemever",
+ "funding_uri" => "https://example.com/has_funding_and_other_metadata/funding",
+ "source_code_uri" => "https://example.com/user/bestgemever",
+ "wiki_uri" => "https://example.com/user/bestgemever/wiki",
+ }
+ end
+
+ build_gem "has_funding", "1.2.3" do |s|
+ s.metadata = {
+ "funding_uri" => "https://example.com/has_funding/funding",
+ }
+ end
+
+ build_gem "gem_with_dependent_funding", "1.0" do |s|
+ s.add_dependency "has_funding"
+ end
+ end
+ end
+
it "prints fund information for all gems in the bundle" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'has_metadata'
+ source "#{file_uri_for(gem_repo2)}"
+ gem 'has_funding_and_other_metadata'
gem 'has_funding'
gem 'rack-obama'
G
bundle "fund"
- expect(out).to include("* has_metadata (1.0)\n Funding: https://example.com/has_metadata/funding")
+ 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")
end
it "does not consider fund information for gem dependencies" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem 'gem_with_dependent_funding'
G
@@ -30,7 +57,7 @@ RSpec.describe "bundle fund" do
it "prints message if none of the gems have fund information" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem 'rack-obama'
G
@@ -42,13 +69,13 @@ 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_repo1)}"
- gem 'has_metadata', :group => :development
+ source "#{file_uri_for(gem_repo2)}"
+ gem 'has_funding_and_other_metadata', :group => :development
gem 'has_funding'
G
bundle "fund --group development"
- expect(out).to include("* has_metadata (1.0)\n Funding: https://example.com/has_metadata/funding")
+ 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_not include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding")
end
end
diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb
index eec9c773bc..6bc07ea399 100644
--- a/spec/bundler/commands/info_spec.rb
+++ b/spec/bundler/commands/info_spec.rb
@@ -3,8 +3,22 @@
RSpec.describe "bundle info" do
context "with a standard Gemfile" do
before do
+ build_repo2 do
+ build_gem "has_metadata" do |s|
+ s.metadata = {
+ "bug_tracker_uri" => "https://example.com/user/bestgemever/issues",
+ "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md",
+ "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
+ "homepage_uri" => "https://bestgemever.example.io",
+ "mailing_list_uri" => "https://groups.example.com/bestgemever",
+ "source_code_uri" => "https://example.com/user/bestgemever",
+ "wiki_uri" => "https://example.com/user/bestgemever/wiki",
+ }
+ end
+ end
+
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rails"
gem "has_metadata"
G
@@ -66,7 +80,6 @@ RSpec.describe "bundle info" do
\tHomepage: http://example.com
\tDocumentation: https://www.example.info/gems/bestgemever/0.0.1
\tSource Code: https://example.com/user/bestgemever
-\tFunding: https://example.com/has_metadata/funding
\tWiki: https://example.com/user/bestgemever/wiki
\tChangelog: https://example.com/user/bestgemever/CHANGELOG.md
\tBug Tracker: https://example.com/user/bestgemever/issues
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index d1b8585114..a8b174a547 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -141,8 +141,14 @@ RSpec.describe "bundle install with gem sources" do
end
it "does not install the development dependency" do
+ build_repo2 do
+ build_gem "with_development_dependency" do |s|
+ s.add_development_dependency "activesupport", "= 2.3.5"
+ end
+ end
+
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "with_development_dependency"
G
@@ -216,6 +222,18 @@ RSpec.describe "bundle install with gem sources" do
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end
+ it "loads env plugins" do
+ plugin_msg = "hello from an env plugin!"
+ 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"
+ G
+
+ expect(last_command.stdboth).to include(plugin_msg)
+ end
+
describe "with a gem that installs multiple platforms" do
it "installs gems for the local platform as first choice" do
skip "version is 1.0, not 1.0.0" if Gem.win_platform?
@@ -294,8 +312,11 @@ RSpec.describe "bundle install with gem sources" do
end
it "finds gems in multiple sources", :bundler => "< 3" do
- build_repo2
- update_repo2
+ build_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+ end
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
diff --git a/spec/bundler/commands/licenses_spec.rb b/spec/bundler/commands/licenses_spec.rb
index d4fa02d0a7..a203984890 100644
--- a/spec/bundler/commands/licenses_spec.rb
+++ b/spec/bundler/commands/licenses_spec.rb
@@ -2,8 +2,14 @@
RSpec.describe "bundle licenses" do
before :each do
+ build_repo2 do
+ build_gem "with_license" do |s|
+ s.license = "MIT"
+ end
+ end
+
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rails"
gem "with_license"
G
@@ -18,7 +24,7 @@ RSpec.describe "bundle licenses" do
it "performs an automatic bundle install" do
gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(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 ed3edad163..66930ded75 100644
--- a/spec/bundler/commands/list_spec.rb
+++ b/spec/bundler/commands/list_spec.rb
@@ -117,6 +117,10 @@ 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"
+ end
+
build_gem "bar"
end
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb
index c97358c62d..cc56c34952 100644
--- a/spec/bundler/commands/lock_spec.rb
+++ b/spec/bundler/commands/lock_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe "bundle lock" do
gemfile <<-G
source "#{file_uri_for(repo)}"
gem "rails"
- gem "with_license"
+ gem "weakling"
gem "foo"
G
@@ -40,7 +40,7 @@ RSpec.describe "bundle lock" do
activeresource (= 2.3.2)
rake (= 13.0.1)
rake (13.0.1)
- with_license (1.0)
+ weakling (0.0.3)
PLATFORMS
#{lockfile_platforms}
@@ -48,7 +48,7 @@ RSpec.describe "bundle lock" do
DEPENDENCIES
foo
rails
- with_license
+ weakling
BUNDLED WITH
#{Bundler::VERSION}
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index beee2b0fdc..421ffa80c6 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -14,6 +14,7 @@ RSpec.describe "bundle gem" do
prepare_gemspec(bundled_app(gem_name, "#{gem_name}.gemspec"))
rubocop_version = RUBY_VERSION > "2.4" ? "0.90.0" : "0.80.1"
gems = ["minitest", "rake", "rake-compiler", "rspec", "rubocop -v #{rubocop_version}", "test-unit"]
+ gems.unshift "parallel -v 1.19.2" if RUBY_VERSION < "2.5"
gems += ["rubocop-ast -v 0.4.0"] if rubocop_version == "0.90.0"
path = Bundler.feature_flag.default_install_uses_path? ? local_gem_path(:base => bundled_app(gem_name)) : system_gem_path
realworld_system_gems gems, :path => path
@@ -423,7 +424,7 @@ RSpec.describe "bundle gem" do
it "requires the version file" do
bundle "gem #{gem_name}"
- expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(%r{require "#{require_path}/version"})
+ expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(%r{require_relative "#{require_relative_path}/version"})
end
it "creates a base error class" do
@@ -910,6 +911,8 @@ RSpec.describe "bundle gem" do
let(:require_path) { "test_gem" }
+ let(:require_relative_path) { "test_gem" }
+
let(:flags) { nil }
it "does not nest constants" do
@@ -963,6 +966,8 @@ RSpec.describe "bundle gem" do
let(:require_path) { "test/gem" }
+ let(:require_relative_path) { "gem" }
+
it "nests constants so they work" do
bundle "gem #{gem_name}"
expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb").read).to match(/module Test\n module Gem/)
diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb
index bee4490a8d..46c42fea10 100644
--- a/spec/bundler/commands/remove_spec.rb
+++ b/spec/bundler/commands/remove_spec.rb
@@ -83,7 +83,7 @@ RSpec.describe "bundle remove" do
end
end
- describe "remove mutiple gems from gemfile" do
+ describe "remove multiple gems from gemfile" do
context "when all gems are present in gemfile" do
it "shows success fir all removed gems" do
gemfile <<-G
@@ -210,7 +210,7 @@ RSpec.describe "bundle remove" do
end
end
- context "when the gem belongs to mutiple groups" do
+ context "when the gem belongs to multiple groups" do
it "removes the groups" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -616,4 +616,84 @@ RSpec.describe "bundle remove" do
expect(out).to include("foo could not be removed.")
end
end
+
+ describe "with comments that mention gems" 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)}"
+
+ # gem "rack" might be used in the future
+ gem "rack"
+ G
+
+ bundle "remove rack"
+
+ expect(out).to include("rack was removed.")
+ gemfile_should_be <<-G
+ source "#{file_uri_for(gem_repo1)}"
+
+ # gem "rack" might be used in the future
+ G
+ end
+ end
+
+ 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)}"
+
+ gem "rack" # this can be removed
+ G
+
+ bundle "remove rack"
+
+ expect(out).to include("rack was removed.")
+ gemfile_should_be <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ G
+ end
+ end
+
+ 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"
+
+ gem "rack"
+ G
+
+ bundle "remove rack"
+
+ expect(out).to_not include("puma was removed.")
+ expect(out).to include("rack was removed.")
+ gemfile_should_be <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "puma" # implements interface provided by gem "rack"
+ G
+ end
+ end
+
+ 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"
+
+ gem "rack"
+ G
+
+ bundle "remove puma"
+
+ expect(out).to include("puma was removed.")
+ expect(out).to_not include("rack was removed.")
+ gemfile_should_be <<-G
+ source "#{file_uri_for(gem_repo1)}"
+
+ gem "rack"
+ G
+ end
+ end
+ end
end
diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb
index 5ab932e5d7..b8de6507f6 100644
--- a/spec/bundler/commands/update_spec.rb
+++ b/spec/bundler/commands/update_spec.rb
@@ -15,6 +15,10 @@ RSpec.describe "bundle update" do
describe "with no arguments", :bundler => "< 3" do
it "updates the entire bundle" do
update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "activesupport", "3.0"
end
@@ -38,6 +42,10 @@ RSpec.describe "bundle update" do
describe "with --all", :bundler => "3" do
it "updates the entire bundle" do
update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "activesupport", "3.0"
end
@@ -103,6 +111,10 @@ RSpec.describe "bundle update" do
describe "with a top level dependency" do
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"
+ end
+
build_gem "activesupport", "3.0"
end
@@ -124,7 +136,12 @@ RSpec.describe "bundle update" do
describe "with a child dependency" do
it "should update the child dependency" do
- update_repo2
+ update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+ end
+
bundle "update rack"
expect(the_bundle).to include_gems "rack 1.2"
end
@@ -217,6 +234,10 @@ RSpec.describe "bundle update" do
gem "rack"
G
update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "activesupport", "3.0"
end
bundle "update --group development"
@@ -269,6 +290,10 @@ RSpec.describe "bundle update" do
gem "rack"
G
update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "activesupport", "3.0"
end
bundle "update --group development"
@@ -446,6 +471,10 @@ RSpec.describe "bundle update in more complicated situations" do
G
update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "thin", "2.0" do |s|
s.add_dependency "rack"
end
diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb
index e5352ab6a2..af1ff7225a 100644
--- a/spec/bundler/install/bundler_spec.rb
+++ b/spec/bundler/install/bundler_spec.rb
@@ -54,6 +54,12 @@ RSpec.describe "bundle install" do
end
it "works for gems with multiple versions in its dependencies" do
+ build_repo2 do
+ build_gem "multiple_versioned_deps" do |s|
+ s.add_dependency "weakling", ">= 0.0.1", "< 0.1"
+ end
+ end
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
@@ -93,6 +99,12 @@ RSpec.describe "bundle install" do
it "causes a conflict if child dependencies conflict" do
bundle "config set force_ruby_platform true"
+ update_repo2 do
+ build_gem "rails_pinned_to_old_activesupport" do |s|
+ s.add_dependency "activesupport", "= 1.2.3"
+ end
+ end
+
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "activemerchant"
@@ -114,6 +126,12 @@ RSpec.describe "bundle install" do
it "causes a conflict if a child dependency conflicts with the Gemfile" do
bundle "config set force_ruby_platform true"
+ update_repo2 do
+ build_gem "rails_pinned_to_old_activesupport" do |s|
+ s.add_dependency "activesupport", "= 1.2.3"
+ end
+ end
+
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "rails_pinned_to_old_activesupport"
@@ -132,6 +150,12 @@ RSpec.describe "bundle install" do
end
it "does not cause a conflict if new dependencies in the Gemfile require older dependencies than the lockfile" do
+ update_repo2 do
+ build_gem "rails_pinned_to_old_activesupport" do |s|
+ s.add_dependency "activesupport", "= 1.2.3"
+ end
+ end
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem 'rails', "2.3.2"
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 441daabe72..357f4512f1 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -361,10 +361,7 @@ RSpec.describe "install in deployment or frozen mode" do
bundle "config --local deployment true"
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
- # The drive letter of the Windows environment is fragile value in GitHub Actions
- unless Gem.win_platform?
- expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}")
- end
+ expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}")
expect(err).not_to include("You have added to the Gemfile")
expect(err).not_to include("You have changed in the Gemfile")
end
@@ -388,10 +385,7 @@ RSpec.describe "install in deployment or frozen mode" do
bundle "config --local deployment true"
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
- # The drive letter of the Windows environment is fragile value in GitHub Actions
- unless Gem.win_platform?
- expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`")
- end
+ expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`")
expect(err).not_to include("You have added to the Gemfile")
expect(err).not_to include("You have deleted from the Gemfile")
end
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index 8e13ac05a9..7a95a8abde 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -422,8 +422,6 @@ RSpec.describe "bundle install from an existing gemspec" do
end
end
- bundle "config specific_platform false"
-
%w[ruby jruby].each do |platform|
simulate_platform(platform) do
install_gemfile <<-G
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index a70fb18c45..7850fad8d0 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -30,11 +30,15 @@ RSpec.describe "bundle install with git sources" do
expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes :size => 1
end
- it "caches the git repo globally" do
+ it "caches the git repo globally and properly uses the cached repo on the next invocation" do
simulate_new_machine
bundle "config set global_gem_cache true"
bundle :install
expect(Dir["#{home}/.bundle/cache/git/foo-1.0-*"]).to have_attributes :size => 1
+
+ bundle "install --verbose"
+ expect(err).to be_empty
+ expect(out).to include("Using foo 1.0 from #{lib_path("foo")}")
end
it "caches the evaluated gemspec" do
@@ -83,7 +87,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}"
G
- expect(err).to include("The source contains 'foo' at: 1.0")
+ expect(err).to include("The source contains the following versions of 'foo': 1.0")
end
it "complains with version and platform if pinned specs don't exist in the git repo" do
@@ -99,7 +103,7 @@ RSpec.describe "bundle install with git sources" do
end
G
- expect(err).to include("The source contains 'only_java' at: 1.0 java")
+ expect(err).to include("The source contains the following versions of 'only_java': 1.0 java")
end
it "complains with multiple versions and platforms if pinned specs don't exist in the git repo" do
@@ -120,7 +124,7 @@ RSpec.describe "bundle install with git sources" do
end
G
- expect(err).to include("The source contains 'only_java' at: 1.0 java, 1.1 java")
+ expect(err).to include("The source contains the following versions of 'only_java': 1.0 java, 1.1 java")
end
it "still works after moving the application directory" do
@@ -933,8 +937,6 @@ RSpec.describe "bundle install with git sources" do
end
it "prints a friendly error if a file blocks the git repo" do
- skip "drive letter is not detected correctly in error message" if Gem.win_platform?
-
build_git "foo"
FileUtils.mkdir_p(default_bundle_path)
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index 07722d09dd..f19fe39721 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -718,11 +718,11 @@ RSpec.describe "bundle install with explicit source paths" do
expect(bar_file).not_to be_file
build_lib "foo" do |s|
- s.write("lib/rubygems_plugin.rb", "FileUtils.touch('#{foo_file}')")
+ s.write("lib/rubygems_plugin.rb", "require 'fileutils'; FileUtils.touch('#{foo_file}')")
end
build_git "bar" do |s|
- s.write("lib/rubygems_plugin.rb", "FileUtils.touch('#{bar_file}')")
+ s.write("lib/rubygems_plugin.rb", "require 'fileutils'; FileUtils.touch('#{bar_file}')")
end
install_gemfile <<-G
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index 41b95481cb..46fc393fe9 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -255,32 +255,6 @@ RSpec.describe "bundle install across platforms" do
expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3"
end
- it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 3" do
- simulate_platform x64_mac
-
- update_repo2 do
- build_gem "facter", "2.4.6"
- build_gem "facter", "2.4.6" do |s|
- s.platform = "universal-darwin"
- s.add_runtime_dependency "CFPropertyList"
- end
- build_gem "CFPropertyList"
- end
-
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
-
- gem "facter"
- G
-
- expect(err).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \
- "because it has different dependencies from the ruby version. " \
- "To use the platform-specific version of the gem, run `bundle config set --local specific_platform true` and install again."
-
- expect(the_bundle).to include_gem "facter 2.4.6"
- expect(the_bundle).not_to include_gem "CFPropertyList"
- end
-
it "works with gems with platform-specific dependency having different requirements order" do
simulate_platform x64_mac
@@ -430,7 +404,7 @@ RSpec.describe "bundle install with platform conditionals" do
expect(out).not_to match(/Could not find gem 'some_gem/)
end
- it "resolves all platforms by default and without warning messages" do
+ it "does not print a warning when a dependency is unused on a platform different from the current one" do
simulate_platform "ruby"
gemfile <<-G
@@ -447,14 +421,9 @@ RSpec.describe "bundle install with platform conditionals" do
GEM
remote: #{file_uri_for(gem_repo1)}/
specs:
- rack (1.0.0)
PLATFORMS
- java
ruby
- x64-mingw32
- x86-mingw32
- x86-mswin32
DEPENDENCIES
rack
@@ -469,13 +438,21 @@ RSpec.describe "when a gem has no architecture" do
it "still installs correctly" do
simulate_platform mswin
+ build_repo2 do
+ # The rcov gem is platform mswin32, but has no arch
+ build_gem "rcov" do |s|
+ s.platform = Gem::Platform.new([nil, "mswin32", nil])
+ s.write "lib/rcov.rb", "RCOV = '1.0.0'"
+ end
+ end
+
gemfile <<-G
# Try to install gem with nil arch
source "http://localgemserver.test/"
gem "rcov"
G
- bundle :install, :artifice => "windows"
+ bundle :install, :artifice => "windows", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
expect(the_bundle).to include_gems "rcov 1.0.0"
end
end
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index be41857043..655f91dd69 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -597,6 +597,10 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
build_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "bar"
end
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb
index 959ffbf615..82492e78cb 100644
--- a/spec/bundler/install/gemfile/specific_platform_spec.rb
+++ b/spec/bundler/install/gemfile/specific_platform_spec.rb
@@ -1,53 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle install with specific_platform enabled" do
- before do
- bundle "config set specific_platform true"
-
- build_repo2 do
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1")
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86_64-linux" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-mingw32" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-linux" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x64-mingw32" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "universal-darwin" }
-
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86_64-linux" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-linux" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x64-mingw32" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-mingw32" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.5")
-
- build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "universal-darwin" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86_64-linux" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-mingw32" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-linux" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x64-mingw32" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.4")
-
- build_gem("google-protobuf", "3.0.0.alpha.5.0.3")
- build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86_64-linux" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-mingw32" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-linux" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x64-mingw32" }
- build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "universal-darwin" }
-
- build_gem("google-protobuf", "3.0.0.alpha.4.0")
- build_gem("google-protobuf", "3.0.0.alpha.3.1.pre")
- build_gem("google-protobuf", "3.0.0.alpha.3")
- build_gem("google-protobuf", "3.0.0.alpha.2.0")
- build_gem("google-protobuf", "3.0.0.alpha.1.1")
- build_gem("google-protobuf", "3.0.0.alpha.1.0")
-
- build_gem("facter", "2.4.6")
- build_gem("facter", "2.4.6") do |s|
- s.platform = "universal-darwin"
- s.add_runtime_dependency "CFPropertyList"
- end
- build_gem("CFPropertyList")
- end
- end
-
+RSpec.describe "bundle install with specific platforms" do
let(:google_protobuf) { <<-G }
source "#{file_uri_for(gem_repo2)}"
gem "google-protobuf"
@@ -57,6 +10,7 @@ RSpec.describe "bundle install with specific_platform enabled" do
before { simulate_platform "x86_64-darwin-15" }
it "locks to both the specific darwin platform and ruby" do
+ setup_multiplatform_gem
install_gemfile(google_protobuf)
allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(the_bundle.locked_gems.platforms).to eq([pl("ruby"), pl("x86_64-darwin-15")])
@@ -67,14 +21,66 @@ RSpec.describe "bundle install with specific_platform enabled" do
])
end
- it "caches both the universal-darwin and ruby gems when --all-platforms is passed" do
+ it "caches both the universal-darwin and ruby gems when --all-platforms is passed and properly picks them up on further bundler invocations" do
+ setup_multiplatform_gem
+ gemfile(google_protobuf)
+ bundle "cache --all-platforms"
+ expect([cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1"), cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin")]).
+ to all(exist)
+
+ bundle "install --verbose"
+ expect(err).to be_empty
+ end
+
+ it "caches both the universal-darwin and ruby gems when cache_all_platforms is configured and properly picks them up on further bundler invocations" do
+ setup_multiplatform_gem
gemfile(google_protobuf)
- bundle "package --all-platforms"
+ bundle "config set --local cache_all_platforms true"
+ bundle "cache"
expect([cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1"), cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin")]).
to all(exist)
+
+ bundle "install --verbose"
+ expect(err).to be_empty
+ end
+
+ it "caches multiplatform git gems with a single gemspec when --all-platforms is passed" do
+ git = build_git "pg_array_parser", "1.0"
+
+ gemfile <<-G
+ gem "pg_array_parser", :git => "#{lib_path("pg_array_parser-1.0")}"
+ G
+
+ lockfile <<-L
+ GIT
+ remote: #{lib_path("pg_array_parser-1.0")}
+ revision: #{git.ref_for("master")}
+ specs:
+ pg_array_parser (1.0-java)
+ pg_array_parser (1.0)
+
+ GEM
+ specs:
+
+ PLATFORMS
+ java
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ pg_array_parser!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+
+ bundle "config set --local cache_all true"
+ bundle "cache --all-platforms"
+
+ expect(err).to be_empty
end
it "uses the platform-specific gem with extra dependencies" do
+ setup_multiplatform_gem_with_different_dependencies_per_platform
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "facter"
@@ -94,6 +100,7 @@ RSpec.describe "bundle install with specific_platform enabled" do
end
it "adds the foreign platform" do
+ setup_multiplatform_gem
install_gemfile(google_protobuf)
bundle "lock --add-platform=#{x64_mingw}"
@@ -106,6 +113,7 @@ RSpec.describe "bundle install with specific_platform enabled" do
end
it "falls back on plain ruby when that version doesnt have a platform-specific gem" do
+ setup_multiplatform_gem
install_gemfile(google_protobuf)
bundle "lock --add-platform=#{java}"
@@ -117,4 +125,55 @@ RSpec.describe "bundle install with specific_platform enabled" do
end
end
end
+
+ private
+
+ def setup_multiplatform_gem
+ build_repo2 do
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1")
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86_64-linux" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-mingw32" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-linux" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x64-mingw32" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "universal-darwin" }
+
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86_64-linux" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-linux" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x64-mingw32" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-mingw32" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.5")
+
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "universal-darwin" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86_64-linux" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-mingw32" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-linux" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x64-mingw32" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.4")
+
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.3")
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86_64-linux" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-mingw32" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-linux" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x64-mingw32" }
+ build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "universal-darwin" }
+
+ build_gem("google-protobuf", "3.0.0.alpha.4.0")
+ build_gem("google-protobuf", "3.0.0.alpha.3.1.pre")
+ build_gem("google-protobuf", "3.0.0.alpha.3")
+ build_gem("google-protobuf", "3.0.0.alpha.2.0")
+ build_gem("google-protobuf", "3.0.0.alpha.1.1")
+ build_gem("google-protobuf", "3.0.0.alpha.1.0")
+ end
+ end
+
+ def setup_multiplatform_gem_with_different_dependencies_per_platform
+ build_repo2 do
+ build_gem("facter", "2.4.6")
+ build_gem("facter", "2.4.6") do |s|
+ s.platform = "universal-darwin"
+ s.add_runtime_dependency "CFPropertyList"
+ end
+ build_gem("CFPropertyList")
+ end
+ end
end
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index 5ef3f38fe7..b5fca9c6ad 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -138,19 +138,6 @@ RSpec.describe "compact index api" do
expect(the_bundle).to include_gems("foo 1.0")
end
- it "falls back when the API errors out" do
- simulate_platform mswin
-
- gemfile <<-G
- source "#{source_uri}"
- gem "rcov"
- G
-
- bundle :install, :artifice => "windows"
- expect(out).to include("Fetching source index from #{source_uri}")
- expect(the_bundle).to include_gems "rcov 1.0.0"
- end
-
it "falls back when the API URL returns 403 Forbidden" do
gemfile <<-G
source "#{source_uri}"
@@ -258,14 +245,37 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "does not double check for gems that are only installed locally" do
- system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0]
+ build_repo2 do
+ build_gem "net_a" do |s|
+ s.add_dependency "net_b"
+ s.add_dependency "net_build_extensions"
+ end
+
+ build_gem "net_b"
+
+ build_gem "net_build_extensions" do |s|
+ s.add_dependency "rake"
+ s.extensions << "Rakefile"
+ s.write "Rakefile", <<-RUBY
+ task :default do
+ path = File.expand_path("../lib", __FILE__)
+ FileUtils.mkdir_p(path)
+ File.open("\#{path}/net_build_extensions.rb", "w") do |f|
+ f.puts "NET_BUILD_EXTENSIONS = 'YES'"
+ end
+ end
+ RUBY
+ end
+ end
+
+ system_gems %w[rack-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"] = strip_whitespace(<<-EOS).strip
#{source_uri}/versions
#{source_uri}/info/rack
EOS
- install_gemfile <<-G, :artifice => "compact_index", :verbose => true
+ install_gemfile <<-G, :artifice => "compact_index", :verbose => true, :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
source "#{source_uri}"
gem "rack"
G
@@ -499,13 +509,19 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "does not refetch if the only unmet dependency is bundler" do
+ build_repo2 do
+ build_gem "bundler_dep" do |s|
+ s.add_dependency "bundler"
+ end
+ end
+
gemfile <<-G
source "#{source_uri}"
gem "bundler_dep"
G
- bundle :install, :artifice => "compact_index"
+ bundle :install, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
expect(out).to include("Fetching gem metadata from #{source_uri}")
end
@@ -598,27 +614,6 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(the_bundle).to include_gems "rack 1.0.0"
end
- it "strips http basic authentication creds for modern index" do
- gemfile <<-G
- source "#{basic_auth_source_uri}"
- gem "rack"
- G
-
- bundle :install, :artifice => "endopint_marshal_fail_basic_authentication"
- expect(out).not_to include("#{user}:#{password}")
- expect(the_bundle).to include_gems "rack 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"
- G
-
- bundle :install, :artifice => "endpoint_500", :raise_on_error => false
- expect(out).not_to include("#{user}:#{password}")
- end
-
it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do
gemfile <<-G
source "#{basic_auth_source_uri}"
diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb
index e92669e97c..5e0be89995 100644
--- a/spec/bundler/install/gems/dependency_api_spec.rb
+++ b/spec/bundler/install/gems/dependency_api_spec.rb
@@ -121,12 +121,20 @@ RSpec.describe "gemcutter's dependency API" do
it "falls back when the API errors out" do
simulate_platform mswin
+ build_repo2 do
+ # The rcov gem is platform mswin32, but has no arch
+ build_gem "rcov" do |s|
+ s.platform = Gem::Platform.new([nil, "mswin32", nil])
+ s.write "lib/rcov.rb", "RCOV = '1.0.0'"
+ end
+ end
+
gemfile <<-G
source "#{source_uri}"
gem "rcov"
G
- bundle :install, :artifice => "windows"
+ bundle :install, :artifice => "windows", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rcov 1.0.0"
end
@@ -473,13 +481,19 @@ RSpec.describe "gemcutter's dependency API" do
end
it "does not refetch if the only unmet dependency is bundler" do
+ build_repo2 do
+ build_gem "bundler_dep" do |s|
+ s.add_dependency "bundler"
+ end
+ end
+
gemfile <<-G
source "#{source_uri}"
gem "bundler_dep"
G
- bundle :install, :artifice => "endpoint"
+ bundle :install, :artifice => "endpoint", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
expect(out).to include("Fetching gem metadata from #{source_uri}")
end
@@ -578,7 +592,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
- bundle :install, :artifice => "endopint_marshal_fail_basic_authentication"
+ 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"
end
diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb
index 858c40c07c..7ab0ded26d 100644
--- a/spec/bundler/install/gems/flex_spec.rb
+++ b/spec/bundler/install/gems/flex_spec.rb
@@ -166,8 +166,7 @@ RSpec.describe "bundle flex_install" do
expect(the_bundle).to include_gems "rack_middleware 1.0", "rack 0.9.1"
- build_repo2
- update_repo2 do
+ build_repo2 do
build_gem "rack-obama", "2.0" do |s|
s.add_dependency "rack", "=1.2"
end
diff --git a/spec/bundler/install/gems/fund_spec.rb b/spec/bundler/install/gems/fund_spec.rb
index 57e7c3aed3..f521b0296f 100644
--- a/spec/bundler/install/gems/fund_spec.rb
+++ b/spec/bundler/install/gems/fund_spec.rb
@@ -2,11 +2,38 @@
RSpec.describe "bundle install" do
context "with gem sources" do
+ before do
+ build_repo2 do
+ build_gem "has_funding_and_other_metadata" do |s|
+ s.metadata = {
+ "bug_tracker_uri" => "https://example.com/user/bestgemever/issues",
+ "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md",
+ "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
+ "homepage_uri" => "https://bestgemever.example.io",
+ "mailing_list_uri" => "https://groups.example.com/bestgemever",
+ "funding_uri" => "https://example.com/has_funding_and_other_metadata/funding",
+ "source_code_uri" => "https://example.com/user/bestgemever",
+ "wiki_uri" => "https://example.com/user/bestgemever/wiki",
+ }
+ end
+
+ build_gem "has_funding", "1.2.3" do |s|
+ s.metadata = {
+ "funding_uri" => "https://example.com/has_funding/funding",
+ }
+ end
+
+ build_gem "gem_with_dependent_funding", "1.0" do |s|
+ s.add_dependency "has_funding"
+ end
+ end
+ end
+
context "when gems include a fund URI" do
it "displays the plural fund message after installing" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'has_metadata'
+ source "#{file_uri_for(gem_repo2)}"
+ gem 'has_funding_and_other_metadata'
gem 'has_funding'
gem 'rack-obama'
G
@@ -16,7 +43,7 @@ RSpec.describe "bundle install" do
it "displays the singular fund message after installing" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem 'has_funding'
gem 'rack-obama'
G
@@ -28,7 +55,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
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "activesupport"
G
@@ -39,7 +66,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
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem 'gem_with_dependent_funding'
G
diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb
index f621b01366..1c01ce588b 100644
--- a/spec/bundler/install/gems/resolving_spec.rb
+++ b/spec/bundler/install/gems/resolving_spec.rb
@@ -1,9 +1,46 @@
# frozen_string_literal: true
RSpec.describe "bundle install with install-time dependencies" do
+ before do
+ build_repo2 do
+ # Test complicated gem dependencies for install
+ build_gem "net_a" do |s|
+ s.add_dependency "net_b"
+ s.add_dependency "net_build_extensions"
+ end
+
+ build_gem "net_b"
+
+ build_gem "net_build_extensions" do |s|
+ s.add_dependency "rake"
+ s.extensions << "Rakefile"
+ s.write "Rakefile", <<-RUBY
+ task :default do
+ path = File.expand_path("../lib", __FILE__)
+ FileUtils.mkdir_p(path)
+ File.open("\#{path}/net_build_extensions.rb", "w") do |f|
+ f.puts "NET_BUILD_EXTENSIONS = 'YES'"
+ end
+ end
+ RUBY
+ end
+
+ build_gem "net_c" do |s|
+ s.add_dependency "net_a"
+ s.add_dependency "net_d"
+ end
+
+ build_gem "net_d"
+
+ build_gem "net_e" do |s|
+ s.add_dependency "net_d"
+ end
+ end
+ end
+
it "installs gems with implicit rake dependencies" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "with_implicit_rake_dep"
gem "another_implicit_rake_dep"
gem "rake"
@@ -43,7 +80,7 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with crazy rubygem plugin stuff" do
it "installs plugins" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "net_b"
G
@@ -52,7 +89,7 @@ RSpec.describe "bundle install with install-time dependencies" do
it "installs plugins depended on by other plugins" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "net_a"
G
@@ -61,7 +98,7 @@ RSpec.describe "bundle install with install-time dependencies" do
it "installs multiple levels of dependencies" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "net_c"
gem "net_e"
G
@@ -72,7 +109,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_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "net_c"
gem "net_e"
G
@@ -86,7 +123,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_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "net_c"
gem "net_e"
G
@@ -100,7 +137,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_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "net_c"
gem "net_e"
G
@@ -126,6 +163,10 @@ RSpec.describe "bundle install with install-time dependencies" do
it "installs the older version" do
build_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "rack", "9001.0.0" do |s|
s.required_ruby_version = "> 9000"
end
@@ -198,13 +239,7 @@ RSpec.describe "bundle install with install-time dependencies" do
let(:ruby_requirement) { %("#{RUBY_VERSION}") }
let(:error_message_requirement) { "~> #{RUBY_VERSION}.0" }
- let(:error_message_platform) do
- if Bundler.feature_flag.specific_platform?
- " #{Bundler.local_platform}"
- else
- ""
- end
- end
+ let(:error_message_platform) { " #{Bundler.local_platform}" }
shared_examples_for "ruby version conflicts" do
it "raises an error during resolution" do
diff --git a/spec/bundler/install/prereleases_spec.rb b/spec/bundler/install/prereleases_spec.rb
index fb01220ed7..c3f968ad70 100644
--- a/spec/bundler/install/prereleases_spec.rb
+++ b/spec/bundler/install/prereleases_spec.rb
@@ -1,10 +1,19 @@
# frozen_string_literal: true
RSpec.describe "bundle install" do
+ before do
+ build_repo2 do
+ build_gem "not_released", "1.0.pre"
+
+ build_gem "has_prerelease", "1.0"
+ build_gem "has_prerelease", "1.1.pre"
+ end
+ end
+
describe "when prerelease gems are available" do
it "finds prereleases" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "not_released"
G
expect(the_bundle).to include_gems "not_released 1.0.pre"
@@ -12,7 +21,7 @@ RSpec.describe "bundle install" do
it "uses regular releases if available" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "has_prerelease"
G
expect(the_bundle).to include_gems "has_prerelease 1.0"
@@ -20,7 +29,7 @@ RSpec.describe "bundle install" do
it "uses prereleases if requested" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "has_prerelease", "1.1.pre"
G
expect(the_bundle).to include_gems "has_prerelease 1.1.pre"
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index d26dc789cc..941cbd13e0 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -3,16 +3,28 @@
RSpec.describe "the lockfile format" do
include Bundler::GemHelpers
+ before do
+ build_repo2 do
+ # Capistrano did this (at least until version 2.5.10)
+ # RubyGems 2.2 doesn't allow the specifying of a dependency twice
+ # See https://github.com/rubygems/rubygems/commit/03dbac93a3396a80db258d9bc63500333c25bd2f
+ build_gem "double_deps", "1.0", :skip_validation => true do |s|
+ s.add_dependency "net-ssh", ">= 1.0.0"
+ s.add_dependency "net-ssh"
+ end
+ end
+ end
+
it "generates a simple lockfile for a single source, gem" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rack"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -37,7 +49,7 @@ RSpec.describe "the lockfile format" do
specs:
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -53,14 +65,14 @@ RSpec.describe "the lockfile format" do
L
install_gemfile <<-G, :env => { "BUNDLER_VERSION" => Bundler::VERSION }
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rack"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -80,7 +92,7 @@ RSpec.describe "the lockfile format" do
lockfile <<-L
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -95,14 +107,14 @@ RSpec.describe "the lockfile format" do
L
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rack"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -120,7 +132,7 @@ RSpec.describe "the lockfile format" do
it "updates the lockfile's bundler version if not present" do
lockfile <<-L
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -132,14 +144,14 @@ RSpec.describe "the lockfile format" do
L
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rack", "> 0"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -160,7 +172,7 @@ RSpec.describe "the lockfile format" do
lockfile <<-L
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -175,7 +187,7 @@ RSpec.describe "the lockfile format" do
L
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rack"
G
@@ -189,7 +201,7 @@ RSpec.describe "the lockfile format" do
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -212,7 +224,7 @@ RSpec.describe "the lockfile format" do
lockfile <<-L
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -227,7 +239,7 @@ RSpec.describe "the lockfile format" do
L
install_gemfile <<-G, :env => { "BUNDLER_VERSION" => Bundler::VERSION }
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack"
G
@@ -239,7 +251,7 @@ RSpec.describe "the lockfile format" do
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -256,14 +268,14 @@ 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_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack-obama"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
rack-obama (1.0)
@@ -282,14 +294,14 @@ 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_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack-obama", ">= 1.0"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
rack-obama (1.0)
@@ -380,13 +392,13 @@ RSpec.describe "the lockfile format" do
it "generates lockfiles with multiple requirements" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "net-sftp"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
net-sftp (1.1.1)
net-ssh (>= 1.0.0, < 1.99.0)
@@ -405,34 +417,6 @@ RSpec.describe "the lockfile format" do
expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0"
end
- it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 3" do
- git = build_git "foo"
-
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo-1.0")}"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("master")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{lockfile_platforms}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
it "generates a simple lockfile for a single pinned source, gem with a version requirement" do
git = build_git "foo"
@@ -465,7 +449,7 @@ RSpec.describe "the lockfile format" do
build_lib "omg", :path => lib_path("omg")
gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
platforms :#{not_local_tag} do
gem "omg", :path => "#{lib_path("omg")}"
@@ -481,7 +465,7 @@ RSpec.describe "the lockfile format" do
specs:
GEM
- remote: #{file_uri_for(gem_repo1)}//
+ remote: #{file_uri_for(gem_repo2)}//
specs:
rack (1.0.0)
@@ -653,7 +637,7 @@ RSpec.describe "the lockfile format" do
bar = build_git "bar"
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack"
gem "foo", :path => "#{lib_path("foo-1.0")}"
@@ -673,7 +657,7 @@ RSpec.describe "the lockfile format" do
foo (1.0)
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -692,7 +676,7 @@ RSpec.describe "the lockfile format" do
it "lists gems alphabetically" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "thin"
gem "actionpack"
@@ -701,7 +685,7 @@ RSpec.describe "the lockfile format" do
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
actionpack (2.3.2)
activesupport (= 2.3.2)
@@ -727,14 +711,14 @@ RSpec.describe "the lockfile format" do
it "orders dependencies' dependencies in alphabetical order" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rails"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
actionmailer (2.3.2)
activesupport (= 2.3.2)
@@ -766,13 +750,13 @@ RSpec.describe "the lockfile format" do
it "orders dependencies by version" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem 'double_deps'
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
double_deps (1.0)
net-ssh
@@ -792,14 +776,14 @@ 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_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack-obama", ">= 1.0", :require => "rack/obama"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
rack-obama (1.0)
@@ -818,14 +802,14 @@ 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_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack-obama", ">= 1.0", :group => :test
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
rack-obama (1.0)
@@ -956,51 +940,10 @@ RSpec.describe "the lockfile format" do
G
end
- it "keeps existing platforms in the lockfile", :bundler => "< 3" do
+ it "keeps existing platforms in the lockfile" do
lockfile <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- java
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
-
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
-
- gem "rack"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: #{file_uri_for(gem_repo1)}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- java
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "keeps existing platforms in the lockfile", :bundler => "3" do
- lockfile <<-G
- GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -1015,21 +958,20 @@ RSpec.describe "the lockfile format" do
G
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
PLATFORMS
java
- #{generic_local_platform}
- #{specific_local_platform}
+ #{lockfile_platforms}
DEPENDENCIES
rack
@@ -1039,38 +981,7 @@ RSpec.describe "the lockfile format" do
G
end
- it "persists the spec's platform to the lockfile", :bundler => "< 3" do
- build_repo2 do
- build_gem "platform_specific", "1.0" do |s|
- s.platform = Gem::Platform.new("universal-java-16")
- end
- end
-
- simulate_platform "universal-java-16"
-
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "platform_specific"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: #{file_uri_for(gem_repo2)}/
- specs:
- platform_specific (1.0-java)
-
- PLATFORMS
- java
-
- DEPENDENCIES
- platform_specific
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "persists the spec's platform and specific platform to the lockfile", :bundler => "3" do
+ it "persists the spec's platform and specific platform to the lockfile" do
build_repo2 do
build_gem "platform_specific", "1.0" do |s|
s.platform = Gem::Platform.new("universal-java-16")
@@ -1105,19 +1016,19 @@ RSpec.describe "the lockfile format" do
it "does not add duplicate gems" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack"
G
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack"
gem "activesupport"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
activesupport (2.3.5)
rack (1.0.0)
@@ -1136,14 +1047,14 @@ RSpec.describe "the lockfile format" do
it "does not add duplicate dependencies" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack"
gem "rack"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -1160,14 +1071,14 @@ RSpec.describe "the lockfile format" do
it "does not add duplicate dependencies with versions" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack", "1.0"
gem "rack", "1.0"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -1184,14 +1095,14 @@ RSpec.describe "the lockfile format" do
it "does not add duplicate dependencies in different groups" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack", "1.0", :group => :one
gem "rack", "1.0", :group => :two
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (1.0.0)
@@ -1208,7 +1119,7 @@ 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_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack", "1.0"
gem "rack", "1.1"
G
@@ -1219,7 +1130,7 @@ RSpec.describe "the lockfile format" do
it "raises if two different sources are used" do
install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack"
gem "rack", :git => "git://hubz.com"
G
@@ -1230,13 +1141,13 @@ RSpec.describe "the lockfile format" do
it "works correctly with multiple version dependencies" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack", "> 0.9", "< 1.0"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (0.9.1)
@@ -1253,14 +1164,14 @@ RSpec.describe "the lockfile format" do
it "captures the Ruby version in the lockfile" do
install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
ruby '#{RUBY_VERSION}'
gem "rack", "> 0.9", "< 1.0"
G
lockfile_should_be <<-G
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack (0.9.1)
@@ -1289,7 +1200,7 @@ RSpec.describe "the lockfile format" do
revision = revision_for(lib_path("omg"))
gemfile <<-G
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "omg", :git => "#{lib_path("omg")}", :branch => 'master'
G
@@ -1314,7 +1225,7 @@ RSpec.describe "the lockfile format" do
omg (1.0)
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
PLATFORMS
@@ -1341,7 +1252,7 @@ RSpec.describe "the lockfile format" do
omg (1.0)
GEM
- remote: #{file_uri_for(gem_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
PLATFORMS
@@ -1358,7 +1269,7 @@ 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_repo1)}/
+ remote: #{file_uri_for(gem_repo2)}/
specs:
rack_middleware (1.0)
@@ -1370,7 +1281,7 @@ RSpec.describe "the lockfile format" do
L
install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}"
+ source "#{file_uri_for(gem_repo2)}"
gem "rack_middleware"
G
@@ -1400,7 +1311,11 @@ RSpec.describe "the lockfile format" do
context "during updates" do
it "preserves Gemfile.lock \\n line endings" do
- update_repo2
+ update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ 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")
@@ -1410,7 +1325,12 @@ RSpec.describe "the lockfile format" do
it "preserves Gemfile.lock \\n\\r line endings" do
skip "needs to be adapted" if Gem.win_platform?
- update_repo2
+ update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+ end
+
win_lock = File.read(bundled_app_lock).gsub(/\n/, "\r\n")
File.open(bundled_app_lock, "wb") {|f| f.puts(win_lock) }
set_lockfile_mtime_to_known_value
@@ -1449,7 +1369,7 @@ 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_repo1)}//
+ remote: #{file_uri_for(gem_repo2)}//
specs:
<<<<<<<
rack (1.0.0)
@@ -1468,7 +1388,7 @@ RSpec.describe "the lockfile format" do
L
install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo1)}/"
+ source "#{file_uri_for(gem_repo2)}/"
gem "rack"
G
diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb
index a8fd4d51fb..eb3539b412 100644
--- a/spec/bundler/other/platform_spec.rb
+++ b/spec/bundler/other/platform_spec.rb
@@ -496,6 +496,10 @@ G
#{ruby_version_correct}
G
update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "activesupport", "3.0"
end
@@ -512,6 +516,10 @@ G
#{ruby_version_correct_engineless}
G
update_repo2 do
+ build_gem "rack", "1.2" do |s|
+ s.executables = "rackup"
+ end
+
build_gem "activesupport", "3.0"
end
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb
index a91175c616..370973ad1a 100644
--- a/spec/bundler/plugins/install_spec.rb
+++ b/spec/bundler/plugins/install_spec.rb
@@ -208,6 +208,19 @@ RSpec.describe "bundler plugin install" do
plugin_should_be_installed("ga-plugin")
end
+ it "accepts path sources" do
+ build_lib "ga-plugin" do |s|
+ s.write "plugins.rb"
+ end
+
+ install_gemfile <<-G
+ plugin 'ga-plugin', :path => "#{lib_path("ga-plugin-1.0")}"
+ G
+
+ expect(out).to include("Installed plugin ga-plugin")
+ plugin_should_be_installed("ga-plugin")
+ end
+
context "in deployment mode" do
it "installs plugins" do
install_gemfile <<-G
diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb
index 60ed051ec3..03a377ac93 100644
--- a/spec/bundler/plugins/source/example_spec.rb
+++ b/spec/bundler/plugins/source/example_spec.rb
@@ -33,6 +33,7 @@ RSpec.describe "real source plugins" do
def install(spec, opts)
mkdir_p(install_path.parent)
+ require 'fileutils'
FileUtils.cp_r(path, install_path)
spec_path = install_path.join("\#{spec.full_name}.gemspec")
@@ -66,32 +67,7 @@ RSpec.describe "real source plugins" do
expect(the_bundle).to include_gems("a-path-gem 1.0")
end
- it "writes to lock file", :bundler => "< 3" do
- bundle "install"
-
- lockfile_should_be <<-G
- PLUGIN SOURCE
- remote: #{lib_path("a-path-gem-1.0")}
- type: mpath
- specs:
- a-path-gem (1.0)
-
- GEM
- remote: #{file_uri_for(gem_repo2)}/
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- a-path-gem!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "writes to lock file", :bundler => "3" do
+ it "writes to lock file" do
bundle "install"
lockfile_should_be <<-G
@@ -362,34 +338,7 @@ RSpec.describe "real source plugins" do
expect(the_bundle).to include_gems("ma-gitp-gem 1.0")
end
- it "writes to lock file", :bundler => "< 3" do
- revision = revision_for(lib_path("ma-gitp-gem-1.0"))
- bundle "install"
-
- lockfile_should_be <<-G
- PLUGIN SOURCE
- remote: #{file_uri_for(lib_path("ma-gitp-gem-1.0"))}
- type: gitp
- revision: #{revision}
- specs:
- ma-gitp-gem (1.0)
-
- GEM
- remote: #{file_uri_for(gem_repo2)}/
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- ma-gitp-gem!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "writes to lock file", :bundler => "3" do
+ it "writes to lock file" do
revision = revision_for(lib_path("ma-gitp-gem-1.0"))
bundle "install"
diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb
index b0647b7663..808f0502a4 100644
--- a/spec/bundler/quality_spec.rb
+++ b/spec/bundler/quality_spec.rb
@@ -190,7 +190,7 @@ RSpec.describe "The library itself" do
line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" }
end
end
- documented_settings = File.read("man/bundle-config.1.ronn")[/LIST OF AVAILABLE KEYS.*/m].scan(/^\* `#{key_pattern}`/).flatten
+ documented_settings = File.read("lib/bundler/man/bundle-config.1.ronn")[/LIST OF AVAILABLE KEYS.*/m].scan(/^\* `#{key_pattern}`/).flatten
documented_settings.each do |s|
all_settings.delete(s)
@@ -249,7 +249,7 @@ RSpec.describe "The library itself" do
end
it "does not use require internally, but require_relative" do
- exempt = %r{templates/|vendor/}
+ exempt = %r{templates/|man/|vendor/}
all_bad_requires = []
lib_tracked_files.each do |filename|
next if filename =~ exempt
diff --git a/spec/bundler/realworld/mirror_probe_spec.rb b/spec/bundler/realworld/mirror_probe_spec.rb
index 626092c7eb..a2b5c89150 100644
--- a/spec/bundler/realworld/mirror_probe_spec.rb
+++ b/spec/bundler/realworld/mirror_probe_spec.rb
@@ -74,10 +74,10 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld =
bundle :install, :artifice => nil, :raise_on_error => false
expect(out).to include("Fetching source index from #{mirror}")
- expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(err).to include("Could not fetch specs from #{mirror}")
+ expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>")
+ expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>")
+ expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>")
+ expect(err).to include("Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>")
end
it "prints each error and warning on a new line" do
@@ -90,10 +90,10 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld =
expect(out).to include "Fetching source index from #{mirror}/"
expect(err).to include <<-EOS.strip
-Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/
-Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/
-Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/
-Could not fetch specs from #{mirror}/
+Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>
+Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>
+Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>
+Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>
EOS
end
end
@@ -112,10 +112,10 @@ Could not fetch specs from #{mirror}/
bundle :install, :artifice => nil, :raise_on_error => false
expect(out).to include("Fetching source index from #{mirror}")
- expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(err).to include("Could not fetch specs from #{mirror}")
+ expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>")
+ expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>")
+ expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>")
+ expect(err).to include("Could not fetch specs from #{mirror}/ due to underlying error <Errno::ECONNREFUSED: Failed to open TCP connection to #{host}:#{@mirror_port} (Connection refused - connect(2) for \"#{host}\" port #{@mirror_port}) (#{mirror}/specs.4.8.gz)>")
end
end
@@ -138,7 +138,7 @@ Could not fetch specs from #{mirror}/
end
def setup_mirror
- mirror_port = find_unused_port
- @mirror_uri = "http://#{host}:#{mirror_port}"
+ @mirror_port = find_unused_port
+ @mirror_uri = "http://#{host}:#{@mirror_port}"
end
end
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 1ba50c0e97..fadf3eb989 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -369,4 +369,34 @@ RSpec.describe "bundler/inline#gemfile" do
expect(out).to eq("WIN")
expect(err).to be_empty
end
+
+ it "when requiring fileutils after does not show redefinition warnings" do
+ dependency_installer_loads_fileutils = ruby "require 'rubygems/dependency_installer'; puts $LOADED_FEATURES.grep(/fileutils/)", :raise_on_error => false
+ skip "does not work if rubygems/dependency_installer loads fileutils, which happens until rubygems 3.2.0" unless dependency_installer_loads_fileutils.empty?
+
+ skip "does not work on ruby 3.0 because it changes the path to look for default gems, tsort is a default gem there, and we can't install it either like we do with fiddle because it doesn't yet exist" unless RUBY_VERSION < "3.0.0"
+
+ Dir.mkdir tmp("path_without_gemfile")
+
+ default_fileutils_version = ruby "gem 'fileutils', '< 999999'; require 'fileutils'; puts FileUtils::VERSION", :raise_on_error => false
+ skip "fileutils isn't a default gem" if default_fileutils_version.empty?
+
+ realworld_system_gems "fileutils --version 1.4.1"
+
+ realworld_system_gems "fiddle" # not sure why, but this is needed on Windows to boot rubygems succesfully
+
+ realworld_system_gems "timeout uri" # this spec uses net/http which requires these default gems
+
+ script <<-RUBY, :dir => tmp("path_without_gemfile"), :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s }
+ require "bundler/inline"
+
+ gemfile(true) do
+ source "#{file_uri_for(gem_repo2)}"
+ end
+
+ require "fileutils"
+ RUBY
+
+ expect(err).to eq("The Gemfile specifies no dependencies")
+ end
end
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index 8424e02de1..6b47878944 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -1233,6 +1233,9 @@ end
end << "bundler"
exempts << "fiddle" if Gem.win_platform? && Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7")
exempts << "uri" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7")
+ exempts << "pathname" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0")
+ exempts << "set" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0")
+ exempts << "tsort" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0")
exempts
end
@@ -1313,7 +1316,7 @@ end
expect(out).to eq("The Gemfile's dependencies are satisfied")
end
- # bundler respects paths specified directly in RUBYLIB or RUBYOPT, and
+ # bundler respects paths specified direclty in RUBYLIB or RUBYOPT, and
# that happens when running ruby from the ruby-core setup. To
# workaround, we manually remove those for these tests when they would
# override the default gem.
diff --git a/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb b/spec/bundler/support/artifice/endpoint_marshal_fail_basic_authentication.rb
index c341c3993f..c341c3993f 100644
--- a/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb
+++ b/spec/bundler/support/artifice/endpoint_marshal_fail_basic_authentication.rb
diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index a1770759a9..02a2c0f659 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -76,14 +76,6 @@ module Spec
s.add_dependency "activesupport", ">= 2.0.0"
end
- build_gem "rails_pinned_to_old_activesupport" do |s|
- s.add_dependency "activesupport", "= 1.2.3"
- end
-
- build_gem "missing_dep" do |s|
- s.add_dependency "not_here"
- end
-
build_gem "rspec", "1.2.7", :no_default => true do |s|
s.write "lib/spec.rb", "SPEC = '1.2.7'"
end
@@ -158,23 +150,6 @@ module Spec
build_gem "duradura", "7.0"
- build_gem "multiple_versioned_deps" do |s|
- s.add_dependency "weakling", ">= 0.0.1", "< 0.1"
- end
-
- build_gem "not_released", "1.0.pre"
-
- build_gem "has_prerelease", "1.0"
- build_gem "has_prerelease", "1.1.pre"
-
- build_gem "with_development_dependency" do |s|
- s.add_development_dependency "activesupport", "= 2.3.5"
- end
-
- build_gem "with_license" do |s|
- s.license = "MIT"
- end
-
build_gem "with_implicit_rake_dep" do |s|
s.extensions << "Rakefile"
s.write "Rakefile", <<-RUBY
@@ -215,10 +190,6 @@ module Spec
s.write "lib/rubygems_plugin.rb", "require 'bundler/omg' ; puts 'FAIL'"
end
- build_gem "bundler_dep" do |s|
- s.add_dependency "bundler"
- end
-
# The yard gem iterates over Gem.source_index looking for plugins
build_gem "yard" do |s|
s.write "lib/yard.rb", <<-Y
@@ -228,115 +199,12 @@ module Spec
Y
end
- # The rcov gem is platform mswin32, but has no arch
- build_gem "rcov" do |s|
- s.platform = Gem::Platform.new([nil, "mswin32", nil])
- s.write "lib/rcov.rb", "RCOV = '1.0.0'"
- end
-
build_gem "net-ssh"
build_gem "net-sftp", "1.1.1" do |s|
s.add_dependency "net-ssh", ">= 1.0.0", "< 1.99.0"
end
- # Test complicated gem dependencies for install
- build_gem "net_a" do |s|
- s.add_dependency "net_b"
- s.add_dependency "net_build_extensions"
- end
-
- build_gem "net_b"
-
- build_gem "net_build_extensions" do |s|
- s.add_dependency "rake"
- s.extensions << "Rakefile"
- s.write "Rakefile", <<-RUBY
- task :default do
- path = File.expand_path("../lib", __FILE__)
- FileUtils.mkdir_p(path)
- File.open("\#{path}/net_build_extensions.rb", "w") do |f|
- f.puts "NET_BUILD_EXTENSIONS = 'YES'"
- end
- end
- RUBY
- end
-
- build_gem "net_c" do |s|
- s.add_dependency "net_a"
- s.add_dependency "net_d"
- end
-
- build_gem "net_d"
-
- build_gem "net_e" do |s|
- s.add_dependency "net_d"
- end
-
- # Capistrano did this (at least until version 2.5.10)
- # RubyGems 2.2 doesn't allow the specifying of a dependency twice
- # See https://github.com/rubygems/rubygems/commit/03dbac93a3396a80db258d9bc63500333c25bd2f
- build_gem "double_deps", "1.0", :skip_validation => true do |s|
- s.add_dependency "net-ssh", ">= 1.0.0"
- s.add_dependency "net-ssh"
- end
-
build_gem "foo"
-
- # A minimal fake pry console
- build_gem "pry" do |s|
- s.write "lib/pry.rb", <<-RUBY
- class Pry
- class << self
- def toplevel_binding
- unless defined?(@toplevel_binding) && @toplevel_binding
- TOPLEVEL_BINDING.eval %{
- def self.__pry__; binding; end
- Pry.instance_variable_set(:@toplevel_binding, __pry__)
- class << self; undef __pry__; end
- }
- end
- @toplevel_binding.eval('private')
- @toplevel_binding
- end
-
- def __pry__
- while line = gets
- begin
- puts eval(line, toplevel_binding).inspect.sub(/^"(.*)"$/, '=> \\1')
- rescue Exception => e
- puts "\#{e.class}: \#{e.message}"
- puts e.backtrace.first
- end
- end
- end
- alias start __pry__
- end
- end
- RUBY
- end
-
- build_gem "has_metadata" do |s|
- s.metadata = {
- "bug_tracker_uri" => "https://example.com/user/bestgemever/issues",
- "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md",
- "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
- "homepage_uri" => "https://bestgemever.example.io",
- "mailing_list_uri" => "https://groups.example.com/bestgemever",
- "funding_uri" => "https://example.com/has_metadata/funding",
- "source_code_uri" => "https://example.com/user/bestgemever",
- "wiki_uri" => "https://example.com/user/bestgemever/wiki",
- }
- end
-
- build_gem "has_funding", "1.2.3" do |s|
- s.metadata = {
- "funding_uri" => "https://example.com/has_funding/funding",
- }
- end
-
- build_gem "gem_with_dependent_funding", "1.0" do |s|
- s.add_dependency "has_funding"
- end
end
end
@@ -366,9 +234,6 @@ module Spec
def update_repo2
update_repo gem_repo2 do
- build_gem "rack", "1.2" do |s|
- s.executables = "rackup"
- end
yield if block_given?
end
end
@@ -658,6 +523,7 @@ module Spec
file = Pathname.new(path).join(file)
FileUtils.mkdir_p(file.dirname)
File.open(file, "w") {|f| f.puts source }
+ File.chmod("+x", file) if @spec.executables.map {|exe| "#{@spec.bindir}/#{exe}" }.include?(file)
end
path
end
diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb
index a6ebd7510f..ab203919e7 100644
--- a/spec/bundler/support/platforms.rb
+++ b/spec/bundler/support/platforms.rb
@@ -94,11 +94,7 @@ module Spec
end
def local_platforms
- if Bundler.feature_flag.specific_platform?
- [local, specific_local_platform]
- else
- [local]
- end
+ [local, specific_local_platform].uniq
end
end
end
diff --git a/spec/bundler/update/gems/fund_spec.rb b/spec/bundler/update/gems/fund_spec.rb
index 6d7075b424..0dfe63d36d 100644
--- a/spec/bundler/update/gems/fund_spec.rb
+++ b/spec/bundler/update/gems/fund_spec.rb
@@ -2,9 +2,30 @@
RSpec.describe "bundle update" do
before do
+ build_repo2 do
+ build_gem "has_funding_and_other_metadata" do |s|
+ s.metadata = {
+ "bug_tracker_uri" => "https://example.com/user/bestgemever/issues",
+ "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md",
+ "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
+ "homepage_uri" => "https://bestgemever.example.io",
+ "mailing_list_uri" => "https://groups.example.com/bestgemever",
+ "funding_uri" => "https://example.com/has_funding_and_other_metadata/funding",
+ "source_code_uri" => "https://example.com/user/bestgemever",
+ "wiki_uri" => "https://example.com/user/bestgemever/wiki",
+ }
+ end
+
+ build_gem "has_funding", "1.2.3" do |s|
+ s.metadata = {
+ "funding_uri" => "https://example.com/has_funding/funding",
+ }
+ end
+ end
+
gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'has_metadata'
+ source "#{file_uri_for(gem_repo2)}"
+ gem 'has_funding_and_other_metadata'
gem 'has_funding', '< 2.0'
G
@@ -14,8 +35,8 @@ RSpec.describe "bundle update" do
context "when listed gems are updated" do
before do
gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'has_metadata'
+ source "#{file_uri_for(gem_repo2)}"
+ gem 'has_funding_and_other_metadata'
gem 'has_funding'
G