require "formula" require "language/haskell" class GitAnnex < Formula include Language::Haskell::Cabal homepage "https://git-annex.branchable.com/" url "http://hackage.haskell.org/package/git-annex-5.20140717/git-annex-5.20140717.tar.gz" sha1 "f3d49408db14a6230436105b50ce9232da8e57ae" bottle do cellar :any sha1 "b4e1f525dbc89d322ac3706657bf86fb8b9e1697" => :mavericks sha1 "6363b33492c0a6d98cea8f1dc889b03285030357" => :mountain_lion sha1 "df28277b5ae4e48514236f6c0ef6a78387daef63" => :lion end depends_on "gcc" => :build depends_on "ghc" => :build depends_on "cabal-install" => :build depends_on "pkg-config" => :build depends_on "gsasl" depends_on "libidn" depends_on "gnutls" depends_on "gmp" def install cabal_sandbox do cabal_install_tools "alex", "happy", "c2hs" # gcc required to build gnuidn gcc = Formula["gcc"] cabal_install "--with-gcc=#{gcc.bin}/gcc-#{gcc.version_suffix}", "--only-dependencies" cabal_install "--prefix=#{prefix}" end bin.install_symlink "git-annex" => "git-annex-shell" system "make", "git-annex.1", "git-annex-shell.1", "git-union-merge.1" man1.install "git-annex.1", "git-annex-shell.1", "git-union-merge.1" end test do # make sure git can find git-annex ENV.prepend_path "PATH", bin # create a first git repository with an annex mkdir "my_annex" do system "git", "init" system "git", "annex", "init", "my_annex" cp bin/"git-annex", "bigfile" system "git", "annex", "add", "bigfile" system "git", "commit", "-am", "big file added" assert File.symlink? "bigfile" end # and propagate its content to another system "git", "clone", "my_annex", "my_annex_clone" Dir.chdir "my_annex_clone" do assert !File.file?("bigfile") system "git", "annex", "get", "bigfile" assert File.file? "bigfile" end # make test files writable so homebrew can drop them chmod_R 0777, testpath end end