bazaar: install plugins directory under /var

This commit is contained in:
Baptiste Fontaine 2015-02-02 22:34:00 +01:00
parent 5a658758e6
commit 187ae905c5

View file

@ -3,6 +3,7 @@ class Bazaar < Formula
homepage "http://bazaar.canonical.com/"
url "https://launchpad.net/bzr/2.6/2.6.0/+download/bzr-2.6.0.tar.gz"
sha256 "0994797182eb828867eee81cccc79480bd2946c99304266bc427b902cf91dab0"
revision 1
bottle do
cellar :any
@ -25,10 +26,40 @@ class Bazaar < Formula
inreplace "bzr", "#! /usr/bin/env python", "#!/usr/bin/python"
libexec.install "bzr", "bzrlib"
bin.install_symlink libexec+"bzr"
bin.install_symlink libexec/"bzr"
end
def post_install
# Install the plugins under /var/bazaar/plugins/
plugins_orig = libexec/"bzrlib/plugins"
plugins_new = var/"bazaar/plugins"
Dir[plugins_orig/"*"].each do |plugin|
path = Pathname.new plugin
plugins_new.install plugin unless File.exist? (plugins_new/path.basename)
end
rm_rf plugins_orig
ln_s plugins_new, plugins_orig
end
def caveats; <<-EOS
The plugins directory is located at:
#{var}/bazaar/plugins
EOS
end
test do
system bin/"bzr", "init-repo", "test"
bzr = "#{bin}/bzr"
whoami = "Homebrew"
system bzr, "whoami", whoami
assert_match whoami, shell_output("#{bin}/bzr whoami")
system bzr, "init-repo", "sample"
system bzr, "init", "sample/trunk"
touch testpath/"sample/trunk/test.txt"
cd "sample/trunk" do
system bzr, "add", "test.txt"
system bzr, "commit", "-m", "test"
end
end
end