ayaports/user/ruby3.2-bundler/manpages.patch

37 lines
1.6 KiB
Diff

From: Jakub Jirutka <jakub@jirutka.cz>
Date: Fri, 26 Mar 2021 23:17:29 +0100
Subject: [PATCH] Fix --help when man pages are moved out
* Allow to move man pages from the gem's directory to the standard
system location (/usr/share/man) without breaking `bundler --help`.
* Fallback to the bundled ronn pages when the man command is available,
but the bundler man pages are not (i.e. ruby-bundler-doc is not
installed).
* Execute man with '-c' option to print the man page to the terminal
instead of using pager.
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -118,16 +118,17 @@
end
man_path = File.expand_path("man", __dir__)
- man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
- [File.basename(f, ".*"), f]
+ man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\.ronn\Z/).collect do |f|
+ man_name = File.basename(f, ".ronn")
+ [File.basename(man_name, ".*"), man_name]
end]
if man_pages.include?(command)
man_page = man_pages[command]
- if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
- Kernel.exec "man #{man_page}"
+ if Bundler.which("man") && Kernel.system("man -w #{command} >/dev/null 2>&1") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
+ Kernel.exec "man -c #{command}"
else
- puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
+ puts File.read("#{man_path}/#{man_page}.ronn")
end
elsif command_path = Bundler.which("bundler-#{cli}")
Kernel.exec(command_path, "--help")