65 lines
2.5 KiB
Ruby
65 lines
2.5 KiB
Ruby
class Firefoxpwa < Formula
|
|
desc "Tool to install, manage and use Progressive Web Apps in Mozilla Firefox"
|
|
homepage "https://github.com/filips123/FirefoxPWA"
|
|
url "https://github.com/filips123/FirefoxPWA/archive/refs/tags/v1.1.0.tar.gz"
|
|
sha256 "e3a18c742cc44d0ffde698753182733da75bfe9a2e331efddeb133c479108328"
|
|
license "MPL-2.0"
|
|
revision 1
|
|
head "https://github.com/filips123/FirefoxPWA.git", branch: "main"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "4fbf340e22c41fdc52c9930d0e204676e995f30c4c02819b4364a4d98fdc07e2"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "9073ea5fe13a7d12483980167eabc5a5df55928d413a3ee971f9436a2badaa56"
|
|
sha256 cellar: :any_skip_relocation, catalina: "1620d3c7125ae7375fe32d5fb83e503adc1f6fd4cb99ea9bb7d640808201f6e8"
|
|
sha256 cellar: :any_skip_relocation, mojave: "0cd9de8abd4f35d253efee5f27ea3fa48289337e92e492f0ca14620464e1fbf6"
|
|
end
|
|
|
|
depends_on "rust" => :build
|
|
|
|
def install
|
|
cd "native"
|
|
|
|
# Prepare the project to work with Homebrew
|
|
ENV["FFPWA_EXECUTABLES"] = opt_bin
|
|
ENV["FFPWA_SYSDATA"] = opt_share
|
|
system "bash", "./packages/brew/configure.sh", version, opt_bin, opt_libexec
|
|
|
|
# Build and install the project
|
|
system "cargo", "install", *std_cargo_args
|
|
|
|
# Install all files
|
|
libexec.install bin/"firefoxpwa-connector"
|
|
share.install "manifests/brew.json" => "firefoxpwa.json"
|
|
share.install "userchrome/"
|
|
bash_completion.install "target/release/completions/firefoxpwa.bash" => "firefoxpwa"
|
|
fish_completion.install "target/release/completions/firefoxpwa.fish"
|
|
zsh_completion.install "target/release/completions/_firefoxpwa"
|
|
end
|
|
|
|
def caveats
|
|
filename = "firefoxpwa.json"
|
|
|
|
source = opt_share
|
|
destination = "/Library/Application Support/Mozilla/NativeMessagingHosts"
|
|
|
|
on_linux do
|
|
destination = "/usr/lib/mozilla/native-messaging-hosts"
|
|
end
|
|
|
|
<<~EOS
|
|
To use the browser extension, manually link the app manifest with:
|
|
sudo mkdir -p "#{destination}"
|
|
sudo ln -sf "#{source}/#{filename}" "#{destination}/#{filename}"
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
# Test version so we know if Homebrew configure script correctly sets it
|
|
assert_match "firefoxpwa #{version}", shell_output("#{bin}/firefoxpwa --version")
|
|
|
|
# Test launching non-existing site which should fail
|
|
output = shell_output("#{bin}/firefoxpwa site launch 00000000000000000000000000 2>&1", 1)
|
|
assert_includes output, "Site does not exist"
|
|
end
|
|
end
|