Last active
December 6, 2020 01:08
-
-
Save yukirii/3db47eb5c7625f84e4b9ab9468a3632a to your computer and use it in GitHub Desktop.
バイナリの取得に失敗した場合にメッセージを表示する Homebrew Formula https://blog.yukirii.dev/customize-homebrew-download-strategy/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AwesomeToolDownloadStrategy < CurlDownloadStrategy | |
def fetch | |
super | |
rescue CurlDownloadStrategyError => e | |
opoo <<EOL | |
awesome-tool のインストールは VPN に接続されている状態で実行する必要があります。 | |
Download に失敗した場合 VPN に接続されているか確認してください。 | |
EOL | |
raise e | |
end | |
end | |
class AwesomeTool < Formula | |
desc "awesome tool" | |
homepage "http://example.com/awesome/tool/" | |
url "http://example.com/awesome-tool/v1.0.0/awesome-tool-Darwin-amd64.tar.gz", using: AwesomeToolDownloadStrategy | |
version "v1.0.0" | |
sha256 "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234" | |
def install | |
bin.install "awesome-tool" | |
end | |
test do | |
system "#{bin}/awesome-tool -version" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment