main/ruby-bundler: fix --help when man is avail but -doc isn't installed

This commit is contained in:
Jakub Jirutka 2022-08-09 15:23:29 +02:00
parent f8694ded81
commit 8ffafa0894
2 changed files with 15 additions and 8 deletions

View File

@ -2,7 +2,7 @@
pkgname=ruby-bundler
_gemname=bundler
pkgver=2.3.14
pkgrel=0
pkgrel=1
pkgdesc="Manage an application's gem dependencies"
url="https://bundler.io/"
arch="noarch"
@ -47,5 +47,5 @@ package() {
sha512sums="
f78818a8d36df758451c1fd7d421852992b0a7ff66227fa9489069b84edee1efa24ffab29291240fb5b8fb0a3f5f5f136ce04193b8fe068152402a5316b8c0c0 bundler-v2.3.14.tar.gz
5c9cc8046120360f9daa3d94da092c8db452672b8fb46b1a8188fae690e4362a090c0fcce35487399aedfec2f7f6b212c0d873a065475871b76d09313964596a manpages.patch
77a36e61ed205aeea6114b1039dfbe29fcaf916eeae3f91785aa53b3ac534e004aa257e218534d927f39e3673eebbfb3ef9ee17f04ed81f74117799b88e53cf4 manpages.patch
"

View File

@ -2,12 +2,17 @@ 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`.
* 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
@@ -123,8 +123,9 @@
@@ -118,16 +118,17 @@
end
man_path = File.expand_path("man", __dir__)
@ -19,9 +24,11 @@ location (/usr/share/man) without breaking `bundler --help`.
end]
if man_pages.include?(command)
@@ -132,7 +133,7 @@
if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
Kernel.exec "man #{man_page}"
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")