Merge pull request #857 from MikeMcQuaid/update-report-link-more
update-report: also link docs, completions.
This commit is contained in:
commit
4d123e6227
@ -88,7 +88,7 @@ module Homebrew
|
|||||||
puts if ARGV.include?("--preinstall")
|
puts if ARGV.include?("--preinstall")
|
||||||
end
|
end
|
||||||
|
|
||||||
link_manpages
|
link_completions_and_docs
|
||||||
Tap.each(&:link_manpages)
|
Tap.each(&:link_manpages)
|
||||||
|
|
||||||
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
|
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
|
||||||
@ -163,9 +163,16 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_manpages
|
def link_completions_and_docs
|
||||||
return if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s
|
return if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s
|
||||||
link_path_manpages(HOMEBREW_REPOSITORY/"share", "brew update")
|
command = "brew update"
|
||||||
|
link_src_dst_dirs(HOMEBREW_REPOSITORY/"etc/bash_completion.d",
|
||||||
|
HOMEBREW_PREFIX/"etc/bash_completion.d", command)
|
||||||
|
link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/doc/homebrew",
|
||||||
|
HOMEBREW_PREFIX/"share/doc/homebrew", command, link_dir: true)
|
||||||
|
link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/zsh/site-functions",
|
||||||
|
HOMEBREW_PREFIX/"share/zsh/site-functions", command)
|
||||||
|
link_path_manpages(HOMEBREW_REPOSITORY/"share", command)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -589,25 +589,31 @@ def truncate_text_to_approximate_size(s, max_bytes, options = {})
|
|||||||
out
|
out
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_path_manpages(path, command)
|
def link_src_dst_dirs(src_dir, dst_dir, command, link_dir: false)
|
||||||
return unless (path/"man").exist?
|
return unless src_dir.exist?
|
||||||
conflicts = []
|
conflicts = []
|
||||||
(path/"man").find do |src|
|
src_paths = link_dir ? [src_dir] : src_dir.find
|
||||||
next if src.directory?
|
src_paths.each do |src|
|
||||||
dst = HOMEBREW_PREFIX/"share"/src.relative_path_from(path)
|
next if src.directory? && !link_dir
|
||||||
|
dst = dst_dir.parent/src.relative_path_from(src_dir.parent)
|
||||||
next if dst.symlink? && src == dst.resolved_path
|
next if dst.symlink? && src == dst.resolved_path
|
||||||
if dst.exist?
|
if dst.exist?
|
||||||
conflicts << dst
|
conflicts << dst
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
dst_dir.parent.mkpath
|
||||||
dst.make_relative_symlink(src)
|
dst.make_relative_symlink(src)
|
||||||
end
|
end
|
||||||
unless conflicts.empty?
|
unless conflicts.empty?
|
||||||
onoe <<-EOS.undent
|
onoe <<-EOS.undent
|
||||||
Could not link #{name} manpages to:
|
Could not link:
|
||||||
#{conflicts.join("\n")}
|
#{conflicts.join("\n")}
|
||||||
|
|
||||||
Please delete these files and run `#{command}`.
|
Please delete these files and run `#{command}`.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_path_manpages(path, command)
|
||||||
|
link_src_dst_dirs(path/"man", HOMEBREW_PREFIX/"share/man", command)
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user