From 241950b1c546924c54ad9df3d67ba9c4f566c35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 27 Apr 2020 14:31:26 +0200 Subject: [rubygems/rubygems] Properly look for man pages When bundler is installed as a default gem (either by ruby's or by rubygems' installer), bundler man pages wouldn't be properly found. https://github.com/rubygems/rubygems/commit/0831b40492 --- lib/bundler/cli.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index d0398c712d..9ff918a43b 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -123,9 +123,9 @@ module Bundler end man_path = File.expand_path("../../../man", __FILE__) - # man files are located under the share directory with the default gems of bundler - man_path = File.expand_path("../../../../../share/man/man1", __FILE__) unless File.directory?(man_path) - man_pages = Hash[Dir.glob(File.join(man_path, "*")).grep(/.*\.\d*\Z/).collect do |f| + # man files are located under ruby's mandir with the default gems of bundler + man_path = RbConfig::CONFIG["mandir"] unless File.directory?(man_path) + man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f| [File.basename(f, ".*"), f] end] @@ -134,7 +134,7 @@ module Bundler if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+} Kernel.exec "man #{man_page}" else - puts File.read("#{man_path}/#{File.basename(man_page)}.txt") + puts File.read("#{File.dirname(man_page)}/#{File.basename(man_page)}.txt") end elsif command_path = Bundler.which("bundler-#{cli}") Kernel.exec(command_path, "--help") -- cgit v1.2.3