diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-04-27 14:31:26 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-08 14:13:29 +0900 |
commit | 241950b1c546924c54ad9df3d67ba9c4f566c35b (patch) | |
tree | 2fb00c2c982d474bbe51923fbd34ad125d903178 | |
parent | a453f26b0d47070c661baf7e302469cd8ab486ad (diff) |
[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
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3092
-rw-r--r-- | lib/bundler/cli.rb | 8 |
1 files 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") |