-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Conversation
- name: Add composer_project_path bin directory to global $PATH. | ||
template: | ||
src: composer-project.sh.j2 | ||
dest: /etc/profile.d/composer-project.sh |
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.
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.
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.
@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.
templates/composer-project.sh.j2
Outdated
@@ -0,0 +1 @@ | |||
export PATH=$PATH:{{ composer_project_path }}/vendor/bin |
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.
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?
Agree. Project path should take preference. On Mon, Nov 21, 2016, 03:44 Oskar Schöldström notifications@github.com
|
@oxyc switched
|
Works for me! |
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.