diff --git a/Library/Homebrew/cask/artifact/manpage.rb b/Library/Homebrew/cask/artifact/manpage.rb index 3824296cbd..2c085154de 100644 --- a/Library/Homebrew/cask/artifact/manpage.rb +++ b/Library/Homebrew/cask/artifact/manpage.rb @@ -12,7 +12,7 @@ module Cask attr_reader :section def self.from_args(cask, source) - section = source.to_s[/\.([1-8]|n|l)$/, 1] + section = source.to_s[/\.([1-8]|n|l)(?:\.gz)?$/, 1] raise CaskInvalidError, "'#{source}' is not a valid man page name" unless section diff --git a/Library/Homebrew/test/cask/artifact/manpage_spec.rb b/Library/Homebrew/test/cask/artifact/manpage_spec.rb index 5cfacd2b2e..9a447b7d0d 100644 --- a/Library/Homebrew/test/cask/artifact/manpage_spec.rb +++ b/Library/Homebrew/test/cask/artifact/manpage_spec.rb @@ -23,6 +23,8 @@ describe Cask::Artifact::Manpage, :cask do let(:source_path) { cask.staged_path.join("manpage.1") } let(:target_path) { cask.config.manpagedir.join("man1/manpage.1") } + let(:gz_source_path) { cask.staged_path.join("gzpage.1.gz") } + let(:gz_target_path) { cask.config.manpagedir.join("man1/gzpage.1.gz") } before do InstallHelper.install_without_artifacts(cask) @@ -35,6 +37,7 @@ describe Cask::Artifact::Manpage, :cask do install_phase.call expect(File).to be_identical target_path, source_path + expect(File).to be_identical gz_target_path, gz_source_path end end end diff --git a/Library/Homebrew/test/support/fixtures/cask/AppWithManpage.zip b/Library/Homebrew/test/support/fixtures/cask/AppWithManpage.zip index 938933a1ca..0fc0ba5d3c 100644 Binary files a/Library/Homebrew/test/support/fixtures/cask/AppWithManpage.zip and b/Library/Homebrew/test/support/fixtures/cask/AppWithManpage.zip differ diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-autodetected-manpage-section.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-autodetected-manpage-section.rb index b05174b380..00eff60a6c 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-autodetected-manpage-section.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-autodetected-manpage-section.rb @@ -1,9 +1,10 @@ cask "with-autodetected-manpage-section" do version "1.2.3" - sha256 "68b7e71a2ca7585b004f52652749589941e3029ff0884e8aa3b099594e0282c0" + sha256 "1f078d5fbbaf44b05d0389b14a15f6704e0e5f8f663bc38153a4d685e38baad5" url "file://#{TEST_FIXTURE_DIR}/cask/AppWithManpage.zip" homepage "https://brew.sh/with-autodetected-manpage-section" manpage "manpage.1" + manpage "gzpage.1.gz" end