Look in /etc/manpaths for writable paths

This commit is contained in:
Olle Jonsson 2016-02-25 19:56:25 +01:00
parent 5bc90a32ae
commit c111488376

View File

@ -10,8 +10,14 @@ RuboCop::RakeTask.new
RSpec::Core::RakeTask.new(:rspec) RSpec::Core::RakeTask.new(:rspec)
task :create_man do |_t| task :create_man do |_t|
os_prefix = "/usr/local" writable_man_path = Pathname('/etc/manpaths').each_line.find do |line|
man_prefix = Pathname("#{os_prefix}/share/man/man1") 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" man_pages = "man/git-*.1"
Pathname.glob(man_pages) do |path| Pathname.glob(man_pages) do |path|