aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd/man.rb
diff options
context:
space:
mode:
authorSteven Peters2016-09-28 03:28:20 -0700
committerSteven Peters2016-09-29 18:21:49 -0700
commit44d13ce2560266eff535208ffc437b0243930ac3 (patch)
tree888cc6967cbdee3da9f0d80a660a7154f243c21f /Library/Homebrew/dev-cmd/man.rb
parentd6246278859f76ee1142754412d44a80eb1da0c6 (diff)
downloadbrew-44d13ce2560266eff535208ffc437b0243930ac3.tar.bz2
dev-cmd/man: display diff --stat, add --exit-code
The --fail-if-changed option will cause `brew man` to return a failing status code if the man files have changed.
Diffstat (limited to 'Library/Homebrew/dev-cmd/man.rb')
-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