homebrew-core/Formula/drush.rb
Arne Jørgensen 09486f5d9e drush: added wrapper to use HOMEBREW_PREFIX.
Added a new bin wrapper script.

The purpose is to set the environment variables ETC_PREFIX and
SHARE_PREFIX - both pointing to HOMEBREW_PREFIX.

As an example drush locates site wide installed commands in
$SHARE_PREFIX/share/drush/commands. SHARE_PREFIX (and ETC_PREFIX)
defaults to /usr and hence drush will look for site wide installed
commands in /usr/share/drush/commands.

That location is outside of where Homebrew should write stuff so this
makes it impossible for other formulas to install site wide commands.

The new wrapper script sets ETC_PREFIX and
SHARE_PREFIX to point to HOMEBREW_PREFIX. And now it is possible to have
other formulas install site wide drush commands.

Closes Homebrew/homebrew#25245.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2014-02-14 07:51:57 -08:00

22 lines
635 B
Ruby

require 'formula'
class Drush < Formula
homepage 'https://github.com/drush-ops/drush'
head 'https://github.com/drush-ops/drush.git'
url 'https://github.com/drush-ops/drush/archive/6.2.0.tar.gz'
sha1 '7e13d5264f362ec09efbe8218e13dcd646ba75b3'
def install
prefix.install_metafiles
libexec.install Dir['*'] -['drush.bat']
(bin+'drush').write <<-EOS.undent
#!/bin/sh
export ETC_PREFIX=${ETC_PREFIX:=#{HOMEBREW_PREFIX}}
export SHARE_PREFIX=${SHARE_PREFIX:=#{HOMEBREW_PREFIX}}
exec "#{libexec}/drush" "$@"
EOS
bash_completion.install libexec/'drush.complete.sh' => 'drush'
end
end