[rubygems/rubygems] Added warnings targets for old version of Ruby

https://github.com/rubygems/rubygems/commit/d0c1d97105
This commit is contained in:
Hiroshi SHIBATA 2023-07-20 12:58:26 +09:00 коммит произвёл git
Родитель fc5dbea4c3
Коммит 64530b545f
4 изменённых файлов: 43 добавлений и 4 удалений

Просмотреть файл

@ -31,6 +31,14 @@ end
module Gem
BUNDLED_GEMS = {
"rexml" => "3.0.0",
"rss" => "3.0.0",
"webrick" => "3.0.0",
"matrix" => "3.1.0",
"net-ftp" => "3.1.0",
"net-imap" => "3.1.0",
"net-pop" => "3.1.0",
"net-smtp" => "3.1.0",
"abbrev" => "3.4.0",
"observer" => "3.4.0",
"getoptlong" => "3.4.0",

Просмотреть файл

@ -233,6 +233,7 @@ module Bundler
[kernel, ::Kernel].each do |kernel_class|
kernel_class.send(:alias_method, :no_warning_require, :require)
kernel_class.send(:define_method, :require) do |file|
file.tr!("/", "-")
if (::Gem::BUNDLED_GEMS.keys - specs.to_a.map(&:name)).include?(file)
target_file = begin
Bundler.default_gemfile.basename

Просмотреть файл

@ -1557,8 +1557,12 @@ end
end
it "warn with bundled gems when it's loaded" do
build_repo4 do
build_gem "rack"
end
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
source "#{file_uri_for(gem_repo4)}"
gem "rack"
G
@ -1571,9 +1575,12 @@ end
end
it "don't warn with bundled gems when it's declared in Gemfile" do
build_repo4 do
build_gem "csv"
end
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
source "#{file_uri_for(gem_repo4)}"
gem "csv"
G
@ -1584,4 +1591,28 @@ end
expect(err).to be_empty
end
it "warn foo-bar style gems correct name" do
build_repo4 do
build_gem "net-imap" do |s|
s.write "lib/net/imap.rb", "NET_IMAP = '0.0.1'"
end
build_gem "csv"
end
install_gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
gem "csv"
G
ruby <<-R
require 'bundler/setup'
begin
require 'net/imap'
rescue LoadError
end
R
expect(err).to include("net-imap is not part of the default gems")
end
end

Просмотреть файл

@ -27,7 +27,6 @@ module Spec
build_gem "git"
build_gem "puma"
build_gem "minitest"
build_gem "csv"
build_gem "rack", %w[0.9.1 1.0.0] do |s|
s.executables = "rackup"