homebrew-core/Formula/git-annex.rb

93 lines
3.4 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-6.20180529/git-annex-6.20180529.tar.gz"
sha256 "a5ebeeef3a2a1c71e08592fed6ac149a3cda1c397bad8c1413f40d9a3da9a0e7"
head "git://git-annex.branchable.com/"
bottle do
sha256 "16dcb6a018708fc1ff101413fdb0c45c29a9f24bed092644b6cb46576d8f1d2e" => :high_sierra
sha256 "ecedb2f313c9bdba1ff4ff17907d3b5f3004668a613c01c92398e90e05046835" => :sierra
sha256 "be980db5477ced5a9b6a90180c4d748c230d0f5e51bb30a3dd9db00dcb49f210" => :el_capitan
end
option "with-git-union-merge", "Build the git-union-merge tool"
depends_on "cabal-install" => :build
depends_on "ghc@8.2" => :build
depends_on "pkg-config" => :build
depends_on "gsasl"
depends_on "libmagic"
depends_on "quvi"
depends_on "xdot" => :recommended
def install
# Reported 28 Feb 2018 to aws upstream https://github.com/aristidb/aws/issues/244
# This is already resolved in aws 0.20 but we can't move to 0.20 until
# esqueleto 2.6.0 ships. See https://github.com/bitemyapp/esqueleto/issues/88
install_cabal_package "--constraint", "http-conduit<2.3",
:using => ["alex", "happy", "c2hs"],
:flags => ["s3", "webapp"] do
# this can be made the default behavior again once git-union-merge builds properly when bottling
if build.with? "git-union-merge"
system "make", "git-union-merge", "PREFIX=#{prefix}"
bin.install "git-union-merge"
system "make", "git-union-merge.1", "PREFIX=#{prefix}"
end
end
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", 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