Merge pull request #11041 from xxyzz/man

Supports .gz man page
This commit is contained in:
Markus Reiter 2021-04-07 21:48:28 +02:00 committed by GitHub
commit 731e25e0cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,7 @@ module Cask
attr_reader :section attr_reader :section
def self.from_args(cask, source) 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 raise CaskInvalidError, "'#{source}' is not a valid man page name" unless section

View File

@ -23,6 +23,8 @@ describe Cask::Artifact::Manpage, :cask do
let(:source_path) { cask.staged_path.join("manpage.1") } let(:source_path) { cask.staged_path.join("manpage.1") }
let(:target_path) { cask.config.manpagedir.join("man1/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 before do
InstallHelper.install_without_artifacts(cask) InstallHelper.install_without_artifacts(cask)
@ -35,6 +37,7 @@ describe Cask::Artifact::Manpage, :cask do
install_phase.call install_phase.call
expect(File).to be_identical target_path, source_path expect(File).to be_identical target_path, source_path
expect(File).to be_identical gz_target_path, gz_source_path
end end
end end
end end

View File

@ -1,9 +1,10 @@
cask "with-autodetected-manpage-section" do cask "with-autodetected-manpage-section" do
version "1.2.3" version "1.2.3"
sha256 "68b7e71a2ca7585b004f52652749589941e3029ff0884e8aa3b099594e0282c0" sha256 "1f078d5fbbaf44b05d0389b14a15f6704e0e5f8f663bc38153a4d685e38baad5"
url "file://#{TEST_FIXTURE_DIR}/cask/AppWithManpage.zip" url "file://#{TEST_FIXTURE_DIR}/cask/AppWithManpage.zip"
homepage "https://brew.sh/with-autodetected-manpage-section" homepage "https://brew.sh/with-autodetected-manpage-section"
manpage "manpage.1" manpage "manpage.1"
manpage "gzpage.1.gz"
end end