-
Notifications
You must be signed in to change notification settings - Fork 19
Set bash PATH for Composer vendor binaries #337
Set bash PATH for Composer vendor binaries #337
Conversation
- "{{ beet_base }}" | ||
- "{{ beet_root }}" | ||
- "{{ beet_web }}" | ||
- "{{ composer_home_path }}" |
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.
This composer_home_path
may not be required as I think it is added to the path already in the Ansible composer role (I just saw that fly by in the circle-ci tests). I'd included it here as a fallback.
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 thanks for the PR -- I have an existing PR open on the composer role which would address this -- geerlingguy/ansible-role-composer#26
It would be my preference to include it in the upstream role (+1 if you want) but if we can't get it included, we may need to fork this role as any composer related tasks should be in the composer role.
To provide a bit of background, I've been trying to remove as many tasks/roles from the core project and move them into external roles -- http://beetbox.readthedocs.io/en/latest/contributing/contributing/
The goal is to minimise the support requirements on the core project and push features back to roles which can be maintained externally.
There is a pull request #333 here for a new beetboxvm.composer project role. Should I be sending this over to there for inclusion into its |
@christopher-hopper the composer project role will be only for initialising a custom composer based project, this will hopefully be a generic replacement for many projects which now only require a simple You can only have a single active project role so it would be better for this to be added to the composer role - https://github.com/beetboxvm/beetbox/blob/master/provisioning/ansible/playbook-provision.yml#L57 |
@thom8 IMO this PATH variable change is a bit of glue, specific to the way this project uses that Let's see how that pans out anyway. Feel free to take any ideas from this suggested change into either |
@christopher-hopper doesn't look like there's much support upstream, however I'm reluctant to include it inside the How about we look at creating a more generic role to manage your PATH? It could support 2 list vars for global and user in an external role and then we set this to run by default with some defaults for composer. I'm sure it could come in handy for other package managers as well. |
@thom8 You wouldn't need a variable for the global composer vendor binaries path. That's going to always be the same. As for the project vendor binaries path, that would vary depending on the project
You could make it configurable, but default to that behaviour. |
@thom8
Then to find the global vendor binaries path, you run this and concatenate the two:
So no need to add a variable for the composer global vendor binaries path. You just ensure that the new ansible role you propose is run after composer is installed, then execute those commands to find the path for global vendor binaries as the vagrant user. |
@thom8 perhaps it would be worth adding a variable to specify where the composer project's This vendor binaries path can be changed in the
That would give you the vendor binaries path for the project. |
@christopher-hopper the new composer role is a project role. Project roles are special in the fact that you can only have 1 active at a time, other examples are here -- https://github.com/beetboxvm/beetbox#project-roles
I'm suggesting that we create a role specifically for managing your eg. This project can then include some default paths which would safely only be included if they existed otherwise it can be overridden to your requirements. eg.
|
the major benefit of externalising this that we can add better test coverage to the new role. |
Rather than adding the project bin directory to the PATH you can also use composer scripts -- https://pantheon.io/blog/writing-composer-scripts
|
@thom8 I've done a bit of work with composer scripts and maybe you're right, perhaps this is better implemented per-project using a composer script. In fact I wouldn't be at all surprised if there weren't a Packagist project out there already that can just be added as a requirement to a project to set-up the PATH on install/update. |
When I have Composer installed dependencies in my project, I'd prefer to use their vendor binaries to any installed as part of beetbox. For example, when we have Drush as a Composer managed dependency, at a specific version in our project, I want to have that preferred over the version installed by beetbox.
The following Pull Request is a suggestion. I've been copying it as a post task to beetbox projects to save me getting everyone to add these lines to their beetbox
~/.bashrc
: