homebrew-core/Formula/spotifyd.rb

67 lines
2.1 KiB
Ruby

class Spotifyd < Formula
desc "Spotify daemon"
homepage "https://github.com/Spotifyd/spotifyd"
url "https://github.com/Spotifyd/spotifyd/archive/v0.3.1.tar.gz"
sha256 "4777b4fa14fbcda3d4beaf4413db2a23bf40a974d7179ecd75c04b63ed970cff"
license "GPL-3.0-only"
head "https://github.com/Spotifyd/spotifyd.git"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any_skip_relocation, big_sur: "36aa765d39afcf5a8d67dca42b47d26ffde5c4d57128059df1769303da338658"
sha256 cellar: :any_skip_relocation, catalina: "8edb6b275d6f10a2ff3998f64219b7959476f6ffeca4b7030928559107b3d19f"
sha256 cellar: :any_skip_relocation, mojave: "a979db72f9715af0fd7564e2eaabac690a4488b2ccadc09e44a85e12d0ca308e"
end
depends_on "pkg-config" => :build
depends_on "rust" => :build
depends_on "dbus"
def install
ENV["COREAUDIO_SDK_PATH"] = MacOS.sdk_path_if_needed
system "cargo", "install", "--no-default-features",
"--features=dbus_keyring,rodio_backend",
*std_cargo_args
end
def caveats
<<~EOS
Configure spotifyd using these instructions:
https://github.com/Spotifyd/spotifyd#configuration-file
EOS
end
plist_options manual: "spotifyd --no-daemon"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>KeepAlive</key>
<true/>
<key>ThrottleInterval</key>
<integer>30</integer>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/spotifyd</string>
<string>--no-daemon</string>
</array>
</dict>
</plist>
EOS
end
test do
cmd = "#{bin}/spotifyd --username homebrew_fake_user_for_testing --password homebrew --no-daemon --backend rodio"
assert_match "Authentication failed", shell_output(cmd, 101)
end
end