Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

drush: added wrapper to use HOMEBREW_PREFIX. #25245

Closed
wants to merge 1 commit into from
Closed

drush: added wrapper to use HOMEBREW_PREFIX. #25245

wants to merge 1 commit into from

Conversation

arnested
Copy link
Contributor

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.

@@ -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'
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@adamv
Copy link
Contributor

adamv commented Dec 15, 2013

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\" \"$@\"")
Copy link
Member

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

Copy link
Contributor Author

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.

@MikeMcQuaid
Copy link
Member

This seems like something we should ask upstream to fix too.

@arnested
Copy link
Contributor Author

This seems like something we should ask upstream to fix too.

I though about that too. But the right thing from Homebrews point og
view would be to use HOMEBREW_PREFIX (although that is normally
/usr/local).

Changing drush to have that flexibility would be much more work.

@MikeMcQuaid
Copy link
Member

Normally software that does this installs with a prefix option.

@arnested
Copy link
Contributor Author

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.

@adamv
Copy link
Contributor

adamv commented Feb 14, 2014

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.
@arnested
Copy link
Contributor Author

Squashed to a single commit.

@adamv adamv closed this in 5820ef6 Feb 14, 2014
spkane pushed a commit to spkane/homebrew that referenced this pull request Mar 3, 2014
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>
ehershey pushed a commit to ehershey/homebrew that referenced this pull request Apr 4, 2014
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>
@arnested arnested deleted the drush branch February 20, 2015 09:28
@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants