[rubygems/rubygems] Show a warning in `bundle info` if gem has been deleted

https://github.com/rubygems/rubygems/commit/ff86cd7dd2
This commit is contained in:
David Rodriguez 2021-10-09 11:29:11 +02:00 коммит произвёл git
Родитель 607efe9154
Коммит 0c3ac87345
2 изменённых файлов: 13 добавлений и 2 удалений

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

@ -55,8 +55,10 @@ module Bundler
def print_gem_info(spec)
metadata = spec.metadata
name = spec.name
path = spec.full_gem_path
gem_info = String.new
gem_info << " * #{spec.name} (#{spec.version}#{spec.git_version})\n"
gem_info << " * #{name} (#{spec.version}#{spec.git_version})\n"
gem_info << "\tSummary: #{spec.summary}\n" if spec.summary
gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage
gem_info << "\tDocumentation: #{metadata["documentation_uri"]}\n" if metadata.key?("documentation_uri")
@ -66,8 +68,13 @@ module Bundler
gem_info << "\tChangelog: #{metadata["changelog_uri"]}\n" if metadata.key?("changelog_uri")
gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri")
gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
gem_info << "\tPath: #{spec.full_gem_path}\n"
gem_info << "\tPath: #{path}\n"
gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
unless File.directory?(path)
return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
end
Bundler.ui.info gem_info
end
end

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

@ -66,6 +66,10 @@ RSpec.describe "bundle info" do
bundle "info rail --path"
expect(err).to match(/The gem rails has been deleted/i)
expect(err).to match(default_bundle_path("gems", "rails-2.3.2").to_s)
bundle "info rails"
expect(err).to match(/The gem rails has been deleted/i)
expect(err).to match(default_bundle_path("gems", "rails-2.3.2").to_s)
end
context "given a default gem shippped in ruby", :ruby_repo do