aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/dev-cmd')
-rw-r--r--Library/Homebrew/dev-cmd/man.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb
index 871fbf46c..d7f47d199 100644
--- a/Library/Homebrew/dev-cmd/man.rb
+++ b/Library/Homebrew/dev-cmd/man.rb
@@ -1,5 +1,9 @@
-#: * `man`:
+#: * `man` [`--fail-if-changed`]:
#: Generate Homebrew's manpages.
+#:
+#: If `--fail-if-changed` is passed, the command will return a failing
+#: status code if changes are detected in the manpage outputs.
+#: This can be used for CI to be notified when the manpages are out of date.
require "formula"
require "erb"
@@ -18,6 +22,12 @@ module Homebrew
else
regenerate_man_pages
end
+
+ if system "git", "-C", HOMEBREW_REPOSITORY, "diff", "--quiet", "docs/brew.1.html", "manpages"
+ puts "No changes to manpage output detected."
+ elsif ARGV.include?("--fail-if-changed")
+ Homebrew.failed = true
+ end
end
private