drush: added wrapper to use HOMEBREW_PREFIX. #25245
Conversation
@@ -9,7 +9,9 @@ class Drush < Formula | |||
def install | |||
prefix.install_metafiles | |||
libexec.install Dir['*'] -['drush.bat'] | |||
bin.install_symlink libexec/'drush' | |||
sh = bin + 'drush' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a "here doc" for write:
(bin/'drush').write <<-EOS.undent
#/bin/sh
stuff goes here
EOS
The explicit chmod
shouldn't be needed as the "linking" step should identify this as a shell script and add +x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good idea! Done in 9de6dc3.
Added a style note. |
@@ -9,7 +9,9 @@ class Drush < Formula | |||
def install | |||
prefix.install_metafiles | |||
libexec.install Dir['*'] -['drush.bat'] | |||
bin.install_symlink libexec/'drush' | |||
sh = bin + 'drush' | |||
sh.write("#!/bin/sh\n\nETC_PREFIX=#{HOMEBREW_PREFIX}\nSHARE_PREFIX=#{HOMEBREW_PREFIX}\n\nexec \"#{prefix}/libexec/drush\" \"$@\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(bin+'drush').write <<-EOS.undent
...
EOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good idea! Done in 9de6dc3.
This seems like something we should ask upstream to fix too. |
I though about that too. But the right thing from Homebrews point og Changing drush to have that flexibility would be much more work. |
Normally software that does this installs with a prefix option. |
I know. But drush does not come with an installation steps. It is "just" a script that is added without any "compile" step. That's why I think changing drush I as much more work. |
Can we get this squashed to a single commit? Is it ready to go? |
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.
Squashed to a single commit. |
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#25245. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
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#25245. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
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.