homebrew-core/Formula/transmission.rb
2018-05-03 10:11:30 +02:00

86 lines
2.6 KiB
Ruby

class Transmission < Formula
desc "Lightweight BitTorrent client"
homepage "https://www.transmissionbt.com/"
url "https://github.com/transmission/transmission-releases/raw/dc77bea/transmission-2.94.tar.xz"
sha256 "35442cc849f91f8df982c3d0d479d650c6ca19310a994eccdaa79a4af3916b7d"
bottle do
sha256 "f9d035ba6b2e2fe96080f368b9b396c05a643680bb1e6714b6eb4d2161ca63e0" => :high_sierra
sha256 "cf4f5ccc5069e03addf77882152e6358f2aeb514ffab78d7ed20e54b22d42936" => :sierra
sha256 "e31b76dc003d69cfeb5f67478a95dd8e824e26606b585270b15bfffe79cae59c" => :el_capitan
end
option "with-nls", "Build with native language support"
depends_on "pkg-config" => :build
depends_on "libevent"
if build.with? "nls"
depends_on "intltool" => :build
depends_on "gettext"
end
def install
ENV.append "LDFLAGS", "-framework Foundation -prebind"
ENV.append "LDFLAGS", "-liconv"
args = %W[--disable-dependency-tracking
--prefix=#{prefix}
--disable-mac
--without-gtk]
args << "--disable-nls" if build.without? "nls"
system "./configure", *args
system "make", "install"
(var/"transmission").mkpath
end
def caveats; <<~EOS
This formula only installs the command line utilities.
Transmission.app can be downloaded directly from the website:
https://www.transmissionbt.com/
Alternatively, install with Homebrew-Cask:
brew cask install transmission
EOS
end
plist_options :manual => "transmission-daemon --foreground"
def plist; <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//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>ProgramArguments</key>
<array>
<string>#{opt_bin}/transmission-daemon</string>
<string>--foreground</string>
<string>--config-dir</string>
<string>#{var}/transmission/</string>
<string>--log-info</string>
<string>--logfile</string>
<string>#{var}/transmission/transmission-daemon.log</string>
</array>
<key>KeepAlive</key>
<dict>
<key>NetworkState</key>
<true/>
</dict>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
system "#{bin}/transmission-create", "-o", "#{testpath}/test.mp3.torrent", test_fixtures("test.mp3")
assert_match /^magnet:/, shell_output("#{bin}/transmission-show -m #{testpath}/test.mp3.torrent")
end
end