dev-cmd/man: modify '--fail-if-changed' to '--fail-if-not-changed'

This commit is contained in:
nandahkrishna 2021-02-23 02:45:01 +05:30
parent c32ead1c97
commit 0754fabec6
No known key found for this signature in database
GPG Key ID: 067E5FCD58ADF3AA
2 changed files with 10 additions and 14 deletions

View File

@ -50,9 +50,7 @@ jobs:
brew update-maintainers brew update-maintainers
fi fi
brew man if brew man --fail-if-not-changed; then
if [ -n "$(git status --porcelain=v1 2>/dev/null)" ]; then
git add "$GITHUB_WORKSPACE/README.md" \ git add "$GITHUB_WORKSPACE/README.md" \
"$GITHUB_WORKSPACE/docs/Manpage.md" \ "$GITHUB_WORKSPACE/docs/Manpage.md" \
"$GITHUB_WORKSPACE/manpages/brew.1" \ "$GITHUB_WORKSPACE/manpages/brew.1" \

View File

@ -24,9 +24,9 @@ module Homebrew
*Note:* Not (yet) working on Apple Silicon. *Note:* Not (yet) working on Apple Silicon.
EOS EOS
switch "--fail-if-changed", switch "--fail-if-not-changed",
description: "Return a failing status code if changes are detected in the manpage outputs. This "\ description: "Return a failing status code if no changes are detected in the manpage outputs. "\
"can be used to notify CI when the manpages are out of date. Additionally, "\ "This can be used to notify CI when the manpages are out of date. Additionally, "\
"the date used in new manpages will match those in the existing manpages (to allow "\ "the date used in new manpages will match those in the existing manpages (to allow "\
"comparison without factoring in the date)." "comparison without factoring in the date)."
named_args :none named_args :none
@ -42,19 +42,17 @@ module Homebrew
args = man_args.parse args = man_args.parse
Commands.rebuild_internal_commands_completion_list Commands.rebuild_internal_commands_completion_list
regenerate_man_pages(preserve_date: args.fail_if_changed?, quiet: args.quiet?) regenerate_man_pages(preserve_date: args.fail_if_not_changed?, quiet: args.quiet?)
Completions.update_shell_completions! Completions.update_shell_completions!
diff = system_command "git", args: [ diff = system_command "git", args: [
"-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "docs/Manpage.md", "manpages", "completions" "-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "docs/Manpage.md", "manpages", "completions"
] ]
if diff.status.success?
return unless diff.status.success?
puts "No changes to manpage or completions output detected." puts "No changes to manpage or completions output detected."
elsif args.fail_if_changed? Homebrew.failed = true if args.fail_if_not_changed?
puts "Changes to manpage or completions detected:"
puts diff.stdout
Homebrew.failed = true
end
end end
def regenerate_man_pages(preserve_date:, quiet:) def regenerate_man_pages(preserve_date:, quiet:)