aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-08-24 14:41:35 +0100
committerGitHub2016-08-24 14:41:35 +0100
commitacfb1b1979fcee68c334c0abf7a7747b958e7d77 (patch)
tree15eb79c70a7c987052e5d796ac6f94982bc9fe4e /Library
parentfa19447a2d9d311909452ee35b309d08558c9a3a (diff)
parentec75fbcb65ac151f401ec3fb483a1a1acf63d5e4 (diff)
downloadbrew-acfb1b1979fcee68c334c0abf7a7747b958e7d77.tar.bz2
Merge pull request #783 from MikeMcQuaid/update-link-manpages
update-report: also link `brew*.1` manpages.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/man.rb14
-rw-r--r--Library/Homebrew/cmd/update-report.rb6
-rw-r--r--Library/Homebrew/tap.rb21
-rw-r--r--Library/Homebrew/utils.rb23
4 files changed, 31 insertions, 33 deletions
diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb
index 0191d76c7..c873e7568 100644
--- a/Library/Homebrew/cmd/man.rb
+++ b/Library/Homebrew/cmd/man.rb
@@ -11,7 +11,7 @@ module Homebrew
raise UsageError unless ARGV.named.empty?
if ARGV.flag? "--link"
- link_man_pages
+ odie "`brew man --link` is now done automatically by `brew update`."
else
regenerate_man_pages
end
@@ -19,18 +19,6 @@ module Homebrew
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
Homebrew.install_gem_setup_path! "ronn"
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index 9b648a538..5121bdb6c 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -85,6 +85,7 @@ module Homebrew
Descriptions.update_cache(hub)
end
+ link_manpages
Tap.each(&:link_manpages)
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
@@ -158,6 +159,11 @@ module Homebrew
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
class Reporter
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index fb194a5bb..8dd7fd155 100644
--- a/Library/Homebrew/tap.rb
+++ b/Library/Homebrew/tap.rb
@@ -248,26 +248,7 @@ class Tap
end
def link_manpages
- 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 `brew tap --repair`.
- EOS
- end
+ link_path_manpages(path, "brew tap --repair")
end
# uninstall this {Tap}.
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 0a1b5158d..7b7289ca2 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -594,3 +594,26 @@ def truncate_text_to_approximate_size(s, max_bytes, options = {})
out.encode!("UTF-8")
out
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