From c1114883764f59046311e227f3b16744e2bd2eb3 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Thu, 25 Feb 2016 19:56:25 +0100 Subject: [PATCH] Look in /etc/manpaths for writable paths --- Rakefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 3d33796..4a8e9a8 100644 --- a/Rakefile +++ b/Rakefile @@ -10,8 +10,14 @@ RuboCop::RakeTask.new RSpec::Core::RakeTask.new(:rspec) task :create_man do |_t| - os_prefix = "/usr/local" - man_prefix = Pathname("#{os_prefix}/share/man/man1") + writable_man_path = Pathname('/etc/manpaths').each_line.find do |line| + path = Pathname(line.chomp) + path.directory? && path.writable? + end rescue nil + + return unless writable_man_path + + man_prefix = Pathname("#{writable_man_path.chomp}/man1") man_pages = "man/git-*.1" Pathname.glob(man_pages) do |path|