homebrew-core/Formula/git-annex.rb

83 lines
2.9 KiB
Ruby

require "language/haskell"
class GitAnnex < Formula
include Language::Haskell::Cabal
desc "Manage files with git without checking in file contents"
homepage "https://git-annex.branchable.com/"
url "https://hackage.haskell.org/package/git-annex-7.20200219/git-annex-7.20200219.tar.gz"
sha256 "a8ac72fc4750e52a3419b69d23665e51e55fcf74f89eb6b47e395e891294fc5f"
head "git://git-annex.branchable.com/"
bottle do
cellar :any
sha256 "84920d62612caae46817785314f3b7593904afd5818eaed6f35540339b0b07ee" => :catalina
sha256 "2df9cd0fadec10172238e03103b6fad92de34652a0f88ced7bba9c547f980af1" => :mojave
sha256 "54d2d67e39300ef280580ecc80da2c246bb20760843547dff369e66940882b9d" => :high_sierra
end
depends_on "cabal-install" => :build
depends_on "ghc@8.6" => :build
depends_on "pkg-config" => :build
depends_on "gsasl"
depends_on "libmagic"
depends_on "quvi"
depends_on "xdot"
def install
install_cabal_package "--constraint", "http-conduit>=2.3",
"--constraint", "network>=2.6.3.0",
:using => ["alex", "happy", "c2hs"],
:flags => ["s3", "webapp"]
bin.install_symlink "git-annex" => "git-annex-shell"
end
plist_options :manual => "git annex assistant --autostart"
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>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/git-annex</string>
<string>assistant</string>
<string>--autostart</string>
</array>
</dict>
</plist>
EOS
end
test do
# make sure git can find git-annex
ENV.prepend_path "PATH", bin
# We don't want this here or it gets "caught" by git-annex.
rm_r "Library/Python/2.7/lib/python/site-packages/homebrew.pth"
system "git", "init"
system "git", "annex", "init"
(testpath/"Hello.txt").write "Hello!"
assert !File.symlink?("Hello.txt")
assert_match /^add Hello.txt.*ok.*\(recording state in git\.\.\.\)/m, shell_output("git annex add .")
system "git", "commit", "-a", "-m", "Initial Commit"
assert File.symlink?("Hello.txt")
# The steps below are necessary to ensure the directory cleanly deletes.
# git-annex guards files in a way that isn't entirely friendly of automatically
# wiping temporary directories in the way `brew test` does at end of execution.
system "git", "rm", "Hello.txt", "-f"
system "git", "commit", "-a", "-m", "Farewell!"
system "git", "annex", "unused"
assert_match "dropunused 1 ok", shell_output("git annex dropunused 1 --force")
system "git", "annex", "uninit"
end
end