Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project vendor/bin to PATH. #26

Merged
merged 1 commit into from
Feb 9, 2017

Conversation

thom8
Copy link
Contributor

@thom8 thom8 commented Jul 9, 2016

Add the ability to automatically add a projects vendor/bin directory to the PATH --

you wouldn't need the drush role if drush was a project dependency.

- name: Add composer_project_path bin directory to global $PATH.
template:
src: composer-project.sh.j2
dest: /etc/profile.d/composer-project.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative, I'd be setting the destination of this PATH variable change to the shell of a user. The user running Composer manager.

Composer being a dependency manager for PHP projects, rather than a global package installer for all users on a system, assumes that it will be run by and for a single user on a system. The Composer global install for example is for adding a package dependency globally to all projects, but not all users. It installs packages globally to the home path of the user executing the Composer manager require command.

For this reason, I'd suggest adding the PATH variable change to the shell for all users on the system is probably not a great idea. I'm happy though to be convinced otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christopher-hopper agree that this would be preferable however this would also require adding user context to this role.

However I've it easier to leverage custom composer commands.

Note: Before executing scripts, Composer's bin-dir is temporarily pushed on top of the PATH environment variable so that binaries of dependencies are easily accessible.

@@ -0,0 +1 @@
export PATH=$PATH:{{ composer_project_path }}/vendor/bin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the composer project path should come before $PATH so that eg. a project specific drush takes precedence over the globally installed one. No?

@christopher-hopper
Copy link

Agree. Project path should take preference.

On Mon, Nov 21, 2016, 03:44 Oskar Schöldström notifications@github.com
wrote:

@oxyc commented on this pull request.

In templates/composer-project.sh.j2
#26 (review)
:

@@ -0,0 +1 @@
+export PATH=$PATH:{{ composer_project_path }}/vendor/bin

I think the composer project path should come before $PATH so that eg. a
project specific drush takes precedence over the globally installed one. No?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#26 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAbno-WKDuYQdGIdFaNg1ejbNU3PuXF-ks5rAHj2gaJpZM4JIiZr
.

@thom8
Copy link
Contributor Author

thom8 commented Feb 8, 2017

@oxyc switched PATH order so project bin takes precedence.

  • updated README.md

@geerlingguy
Copy link
Owner

Works for me!

@geerlingguy geerlingguy merged commit c354f1b into geerlingguy:master Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants