[前][次][番号順一覧][スレッド一覧]

ruby-changes:61113

From: David <ko1@a...>
Date: Fri, 8 May 2020 14:14:30 +0900 (JST)
Subject: [ruby-changes:61113] 241950b1c5 (master): [rubygems/rubygems] Properly look for man pages

https://git.ruby-lang.org/ruby.git/commit/?id=241950b1c5

From 241950b1c546924c54ad9df3d67ba9c4f566c35b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
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

diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index d0398c7..9ff918a 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -123,9 +123,9 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L123
       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 https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L134
         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 v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]