From 6d0899f298e455b9e1a4e1c51b9d754af2b05f32 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Mon, 28 Dec 2020 11:34:29 -0500 Subject: [PATCH] release-notes: clarify help text and minor refactor --- Library/Homebrew/dev-cmd/release-notes.rb | 9 +++++---- docs/Manpage.md | 2 +- manpages/brew.1 | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 1c9069af25..004915f284 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -18,7 +18,7 @@ module Homebrew If no is provided it defaults to the latest tag. If no is provided it defaults to `origin/master`. - If `--markdown` and a are passed, an extra line containg + If `--markdown` and a are passed, an extra line containing a link to the Homebrew blog will be adding to the output. Additionally, a warning will be shown if the latest minor release was less than one month ago. EOS @@ -35,11 +35,12 @@ module Homebrew previous_tag = args.named.first if previous_tag.present? - + most_recent_major_minor_tag = previous_tag.sub(/\d+$/, "0") + one_month_ago = Date.today << 1 previous_tag_date = Date.parse Utils.popen_read( - "git", "-C", HOMEBREW_REPOSITORY, "log", "-1", "--format=%aI", previous_tag.sub(/\d+$/, "0") + "git", "-C", HOMEBREW_REPOSITORY, "log", "-1", "--format=%aI", most_recent_major_minor_tag ) - opoo "The latest major/minor release was less than one month ago." if previous_tag_date > (Date.today << 1) + opoo "The latest major/minor release was less than one month ago." if previous_tag_date > one_month_ago end previous_tag ||= Utils.popen_read( diff --git a/docs/Manpage.md b/docs/Manpage.md index edcf3931b1..9066ac8f3c 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1197,7 +1197,7 @@ Print the merged pull requests on Homebrew/brew between two Git refs. If no *`previous_tag`* is provided it defaults to the latest tag. If no *`end_ref`* is provided it defaults to `origin/master`. -If `--markdown` and a *`previous_tag`* are passed, an extra line containg +If `--markdown` and a *`previous_tag`* are passed, an extra line containing a link to the Homebrew blog will be adding to the output. Additionally, a warning will be shown if the latest minor release was less than one month ago. diff --git a/manpages/brew.1 b/manpages/brew.1 index b5f5de5e18..ebb9a3daad 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1673,7 +1673,7 @@ Use \fBstackprof\fR instead of \fBruby\-prof\fR (the default)\. Print the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. . .P -If \fB\-\-markdown\fR and a \fIprevious_tag\fR are passed, an extra line containg a link to the Homebrew blog will be adding to the output\. Additionally, a warning will be shown if the latest minor release was less than one month ago\. +If \fB\-\-markdown\fR and a \fIprevious_tag\fR are passed, an extra line containing a link to the Homebrew blog will be adding to the output\. Additionally, a warning will be shown if the latest minor release was less than one month ago\. . .TP \fB\-\-markdown\fR