diff options
| author | Mike McQuaid | 2016-10-01 12:13:27 +0100 |
|---|---|---|
| committer | GitHub | 2016-10-01 12:13:27 +0100 |
| commit | c64ce3ef07dbbba79f311c1dd928c743fc897667 (patch) | |
| tree | 4f09c49a19b3e543ad7db363eca3ac7950c17d76 /Library/Homebrew/dev-cmd/man.rb | |
| parent | 41b2df8e338c3fe345afc89b1bb394e824213561 (diff) | |
| parent | c4adc6801612ef804ae36c528d096b954818a7c9 (diff) | |
| download | brew-c64ce3ef07dbbba79f311c1dd928c743fc897667.tar.bz2 | |
Merge pull request #1199 from MikeMcQuaid/man-fail-if-changed-date
man: set date when --fail-if-changed.
Diffstat (limited to 'Library/Homebrew/dev-cmd/man.rb')
| -rw-r--r-- | Library/Homebrew/dev-cmd/man.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index d7f47d199..6c0c00747 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -78,10 +78,25 @@ module Homebrew end def convert_man_page(markup, target) + manual = target.basename(".1") + organisation = "Homebrew" + + # Set the manpage date to the existing one if we're checking for changes. + # This avoids the only change being e.g. a new date. + date = if ARGV.include?("--fail-if-changed") && + target.extname == ".1" && target.exist? + /"(\d{1,2})" "([A-Z][a-z]+) (\d{4})" "#{organisation}" "#{manual}"/ =~ target.read + Date.parse("#{$1} #{$2} #{$3}") + else + Date.today + end + date = date.strftime("%Y-%m-%d") + shared_args = %W[ --pipe - --organization=Homebrew + --organization=#{organisation} --manual=#{target.basename(".1")} + --date=#{date} ] format_flag, format_desc = target_path_to_format(target) |
