Merge pull request #783 from MikeMcQuaid/update-link-manpages
update-report: also link `brew*.1` manpages.
This commit is contained in:
commit
acfb1b1979
@ -11,7 +11,7 @@ module Homebrew
|
|||||||
raise UsageError unless ARGV.named.empty?
|
raise UsageError unless ARGV.named.empty?
|
||||||
|
|
||||||
if ARGV.flag? "--link"
|
if ARGV.flag? "--link"
|
||||||
link_man_pages
|
odie "`brew man --link` is now done automatically by `brew update`."
|
||||||
else
|
else
|
||||||
regenerate_man_pages
|
regenerate_man_pages
|
||||||
end
|
end
|
||||||
@ -19,18 +19,6 @@ module Homebrew
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def link_man_pages
|
|
||||||
linked_path = HOMEBREW_PREFIX/"share/man/man1"
|
|
||||||
|
|
||||||
if TARGET_MAN_PATH == linked_path
|
|
||||||
odie "The target path is the same as the linked one."
|
|
||||||
end
|
|
||||||
|
|
||||||
Dir["#{TARGET_MAN_PATH}/*.1"].each do |page|
|
|
||||||
FileUtils.ln_s page, linked_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def regenerate_man_pages
|
def regenerate_man_pages
|
||||||
Homebrew.install_gem_setup_path! "ronn"
|
Homebrew.install_gem_setup_path! "ronn"
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ module Homebrew
|
|||||||
Descriptions.update_cache(hub)
|
Descriptions.update_cache(hub)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
link_manpages
|
||||||
Tap.each(&:link_manpages)
|
Tap.each(&:link_manpages)
|
||||||
|
|
||||||
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
|
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
|
||||||
@ -158,6 +159,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_manpages
|
||||||
|
return if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s
|
||||||
|
link_path_manpages(HOMEBREW_REPOSITORY/"share", "brew update")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Reporter
|
class Reporter
|
||||||
|
@ -248,26 +248,7 @@ class Tap
|
|||||||
end
|
end
|
||||||
|
|
||||||
def link_manpages
|
def link_manpages
|
||||||
return unless (path/"man").exist?
|
link_path_manpages(path, "brew tap --repair")
|
||||||
conflicts = []
|
|
||||||
(path/"man").find do |src|
|
|
||||||
next if src.directory?
|
|
||||||
dst = HOMEBREW_PREFIX/"share"/src.relative_path_from(path)
|
|
||||||
next if dst.symlink? && src == dst.resolved_path
|
|
||||||
if dst.exist?
|
|
||||||
conflicts << dst
|
|
||||||
next
|
|
||||||
end
|
|
||||||
dst.make_relative_symlink(src)
|
|
||||||
end
|
|
||||||
unless conflicts.empty?
|
|
||||||
onoe <<-EOS.undent
|
|
||||||
Could not link #{name} manpages to:
|
|
||||||
#{conflicts.join("\n")}
|
|
||||||
|
|
||||||
Please delete these files and run `brew tap --repair`.
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# uninstall this {Tap}.
|
# uninstall this {Tap}.
|
||||||
|
@ -594,3 +594,26 @@ def truncate_text_to_approximate_size(s, max_bytes, options = {})
|
|||||||
out.encode!("UTF-8")
|
out.encode!("UTF-8")
|
||||||
out
|
out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_path_manpages(path, command)
|
||||||
|
return unless (path/"man").exist?
|
||||||
|
conflicts = []
|
||||||
|
(path/"man").find do |src|
|
||||||
|
next if src.directory?
|
||||||
|
dst = HOMEBREW_PREFIX/"share"/src.relative_path_from(path)
|
||||||
|
next if dst.symlink? && src == dst.resolved_path
|
||||||
|
if dst.exist?
|
||||||
|
conflicts << dst
|
||||||
|
next
|
||||||
|
end
|
||||||
|
dst.make_relative_symlink(src)
|
||||||
|
end
|
||||||
|
unless conflicts.empty?
|
||||||
|
onoe <<-EOS.undent
|
||||||
|
Could not link #{name} manpages to:
|
||||||
|
#{conflicts.join("\n")}
|
||||||
|
|
||||||
|
Please delete these files and run `#{command}`.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user