1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

composer: add composer_executable (#2650) (#2670)

* composer: add composer_executable

* Add changelog

* Improve documentation thanks to felixfontein

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit c3cab7c68c)

Co-authored-by: Amin Vakil <info@aminvakil.com>
This commit is contained in:
patchback[bot] 2021-05-28 13:24:44 +02:00 committed by GitHub
parent 0f8bb43723
commit 3723e458d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View file

@ -0,0 +1,3 @@
---
minor_changes:
- composer - add ``composer_executable`` option (https://github.com/ansible-collections/community.general/issues/2649).

View file

@ -117,9 +117,14 @@ options:
default: false default: false
type: bool type: bool
aliases: [ ignore-platform-reqs ] aliases: [ ignore-platform-reqs ]
composer_executable:
type: path
description:
- Path to composer executable on the remote host, if composer is not in C(PATH) or a custom composer is needed.
version_added: 3.2.0
requirements: requirements:
- php - php
- composer installed in bin path (recommended /usr/local/bin) - composer installed in bin path (recommended /usr/local/bin) or specified in I(composer_executable)
notes: notes:
- Default options that are always appended in each execution are --no-ansi, --no-interaction and --no-progress if available. - Default options that are always appended in each execution are --no-ansi, --no-interaction and --no-progress if available.
- We received reports about issues on macOS if composer was installed by Homebrew. Please use the official install method to avoid issues. - We received reports about issues on macOS if composer was installed by Homebrew. Please use the official install method to avoid issues.
@ -187,7 +192,11 @@ def composer_command(module, command, arguments="", options=None, global_command
else: else:
php_path = module.params['executable'] php_path = module.params['executable']
composer_path = module.get_bin_path("composer", True, ["/usr/local/bin"]) if module.params['composer_executable'] is None:
composer_path = module.get_bin_path("composer", True, ["/usr/local/bin"])
else:
composer_path = module.params['composer_executable']
cmd = "%s %s %s %s %s %s" % (php_path, composer_path, "global" if global_command else "", command, " ".join(options), arguments) cmd = "%s %s %s %s %s %s" % (php_path, composer_path, "global" if global_command else "", command, " ".join(options), arguments)
return module.run_command(cmd) return module.run_command(cmd)
@ -231,6 +240,7 @@ def main():
ignore_platform_reqs=dict( ignore_platform_reqs=dict(
default=False, type="bool", aliases=["ignore-platform-reqs"], default=False, type="bool", aliases=["ignore-platform-reqs"],
deprecated_aliases=[dict(name='ignore-platform-reqs', version='5.0.0', collection_name='community.general')]), deprecated_aliases=[dict(name='ignore-platform-reqs', version='5.0.0', collection_name='community.general')]),
composer_executable=dict(type="path"),
), ),
required_if=[('global_command', False, ['working_dir'])], required_if=[('global_command', False, ['working_dir'])],
supports_check_mode=True supports_check_mode=True