homebrew-core/Formula/magit.rb
2015-07-03 09:34:13 +01:00

58 lines
1.8 KiB
Ruby

class Magit < Formula
desc "Emacs interface for Git"
homepage "https://github.com/magit/magit"
url "https://github.com/magit/magit/releases/download/2.1.0/magit-2.1.0.tar.gz"
sha256 "835ba1cc461583b012671aea8271b8faf372324f0156706d5801cc1b0e533fc8"
head "https://github.com/magit/magit.git", :shallow => false
bottle do
cellar :any
sha256 "b8a6d761f1417cc1dd28907508f820491c0e0c3687b8a97b5ec5a81d67721719" => :yosemite
sha256 "317e4c59fd1f3616ebb1dbc34beab2dbad9ccd4900b5d38dbf0e1378c3fc0de9" => :mavericks
sha256 "5b9ae10a1253e28ccbf196e3cba3b6433e9253156dae8510344c94900bd0eb7a" => :mountain_lion
end
depends_on :emacs => "24.4"
resource "dash" do
url "http://melpa.org/packages/dash-20150701.20.el"
sha256 "4d4e41c343fe0b3056d5572b7f15ba0212e9ecefd1d735eb6b403321d3b982f5"
end
def install
resource("dash").stage do
(share/"emacs/site-lisp").install "dash-20150701.20.el" => "dash.el"
end
(buildpath/"config.mk").write <<-EOS
LOAD_PATH = -L #{buildpath}/lisp -L #{share}/emacs/site-lisp
EOS
args = %W[
PREFIX=#{prefix}
lispdir=#{share}/emacs/site-lisp
docdir=#{doc}
]
# Can't run `make install` alone without ENV.j1:
# https://github.com/magit/magit/issues/1670
system "make"
system "make", "install", *args
end
def caveats; <<-EOS.undent
Add the following to your Emacs init file to allow loading of packages installed by Homebrew:
(add-to-list 'load-path "#{HOMEBREW_PREFIX}/share/emacs/site-lisp")
EOS
end
test do
(testpath/"test.el").write <<-EOS.undent
(add-to-list 'load-path "#{share}/emacs/site-lisp")
(require 'magit)
(print (minibuffer-prompt-width))
EOS
assert_equal "0", shell_output("emacs -batch -l #{testpath}/test.el").strip
end
end