aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd/man.rb
diff options
context:
space:
mode:
authorMike McQuaid2016-09-30 08:22:37 +0100
committerGitHub2016-09-30 08:22:37 +0100
commit41b2df8e338c3fe345afc89b1bb394e824213561 (patch)
treee0df425837c6d2d9d0234cdb6f0e602fa4de9f4a /Library/Homebrew/dev-cmd/man.rb
parent4e7e4ca4718e2516de05cc414ad5afb46aef488b (diff)
parent779833a0c3c89076a683e82391894825693e25f6 (diff)
downloadbrew-41b2df8e338c3fe345afc89b1bb394e824213561.tar.bz2
Merge pull request #1177 from scpeters/man_exit_code
Man exit code
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