summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodriguez <deivid.rodriguez@riseup.net>2021-10-09 11:29:11 +0200
committergit <svn-admin@ruby-lang.org>2021-10-11 19:13:16 +0900
commit0c3ac8734558232c5287ea737edfbe5a3ab4f290 (patch)
tree3ae1596b632c6030fe420e31e71ffa38cc4a5a43 /lib
parent607efe91540057ef0ca3be4a829869df018ee94a (diff)
[rubygems/rubygems] Show a warning in `bundle info` if gem has been deleted
https://github.com/rubygems/rubygems/commit/ff86cd7dd2
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli/info.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/bundler/cli/info.rb b/lib/bundler/cli/info.rb
index bf0f85d3eb..00140e3bd1 100644
--- a/lib/bundler/cli/info.rb
+++ b/lib/bundler/cli/info.rb
@@ -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