collection 교체

This commit is contained in:
정훈 변
2024-02-23 16:37:40 +09:00
parent b494779b5b
commit 3fd554eee9
38862 changed files with 220204 additions and 6600073 deletions

View File

@@ -1,8 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Dimitrios Tydeas Mengidis <tydeas.dr@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Copyright (c) 2014, Dimitrios Tydeas Mengidis <tydeas.dr@gmail.com>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function
__metaclass__ = type
@@ -20,6 +21,13 @@ description:
Composer is a tool for dependency management in PHP. It allows you to
declare the dependent libraries your project needs and it will install
them in your project for you.
extends_documentation_fragment:
- community.general.attributes
attributes:
check_mode:
support: full
diff_mode:
support: none
options:
command:
type: str
@@ -30,6 +38,7 @@ options:
type: str
description:
- Composer arguments like required package, version and so on.
default: ''
executable:
type: path
description:
@@ -40,91 +49,69 @@ options:
description:
- Directory of your project (see --working-dir). This is required when
the command is not run globally.
- Will be ignored if C(global_command=true).
- Alias C(working-dir) has been deprecated and will be removed in community.general 5.0.0.
aliases: [ working-dir ]
- Will be ignored if O(global_command=true).
global_command:
description:
- Runs the specified command globally.
- Alias C(global-command) has been deprecated and will be removed in community.general 5.0.0.
type: bool
default: false
aliases: [ global-command ]
prefer_source:
description:
- Forces installation from package sources when possible (see --prefer-source).
- Alias C(prefer-source) has been deprecated and will be removed in community.general 5.0.0.
default: false
type: bool
aliases: [ prefer-source ]
prefer_dist:
description:
- Forces installation from package dist even for dev versions (see --prefer-dist).
- Alias C(prefer-dist) has been deprecated and will be removed in community.general 5.0.0.
default: false
type: bool
aliases: [ prefer-dist ]
no_dev:
description:
- Disables installation of require-dev packages (see --no-dev).
- Alias C(no-dev) has been deprecated and will be removed in community.general 5.0.0.
default: true
type: bool
aliases: [ no-dev ]
no_scripts:
description:
- Skips the execution of all scripts defined in composer.json (see --no-scripts).
- Alias C(no-scripts) has been deprecated and will be removed in community.general 5.0.0.
default: false
type: bool
aliases: [ no-scripts ]
no_plugins:
description:
- Disables all plugins ( see --no-plugins ).
- Alias C(no-plugins) has been deprecated and will be removed in community.general 5.0.0.
- Disables all plugins (see --no-plugins).
default: false
type: bool
aliases: [ no-plugins ]
optimize_autoloader:
description:
- Optimize autoloader during autoloader dump (see --optimize-autoloader).
- Convert PSR-0/4 autoloading to classmap to get a faster autoloader.
- Recommended especially for production, but can take a bit of time to run.
- Alias C(optimize-autoloader) has been deprecated and will be removed in community.general 5.0.0.
default: true
type: bool
aliases: [ optimize-autoloader ]
classmap_authoritative:
description:
- Autoload classes from classmap only.
- Implicitely enable optimize_autoloader.
- Implicitly enable optimize_autoloader.
- Recommended especially for production, but can take a bit of time to run.
- Alias C(classmap-authoritative) has been deprecated and will be removed in community.general 5.0.0.
default: false
type: bool
aliases: [ classmap-authoritative ]
apcu_autoloader:
description:
- Uses APCu to cache found/not-found classes
- Alias C(apcu-autoloader) has been deprecated and will be removed in community.general 5.0.0.
default: false
type: bool
aliases: [ apcu-autoloader ]
ignore_platform_reqs:
description:
- Ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these.
- Alias C(ignore-platform-reqs) has been deprecated and will be removed in community.general 5.0.0.
default: false
type: bool
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.
- Path to composer executable on the remote host, if composer is not in E(PATH) or a custom composer is needed.
version_added: 3.2.0
requirements:
- php
- composer installed in bin path (recommended /usr/local/bin) or specified in I(composer_executable)
- composer installed in bin path (recommended /usr/local/bin) or specified in O(composer_executable)
notes:
- 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.
@@ -147,12 +134,12 @@ EXAMPLES = '''
command: create-project
arguments: package/package /path/to/project ~1.0
working_dir: /path/to/project
prefer_dist: yes
prefer_dist: true
- name: Install a package globally
community.general.composer:
command: require
global_command: yes
global_command: true
arguments: my/package
'''
@@ -183,10 +170,15 @@ def get_available_options(module, command='install'):
return command_help_json['definition']['options']
def composer_command(module, command, arguments="", options=None, global_command=False):
def composer_command(module, command, arguments="", options=None):
if options is None:
options = []
global_command = module.params['global_command']
if not global_command:
options.extend(['--working-dir', "'%s'" % module.params['working_dir']])
if module.params['executable'] is None:
php_path = module.get_bin_path("php", True, ["/usr/local/bin"])
else:
@@ -207,39 +199,17 @@ def main():
command=dict(default="install", type="str"),
arguments=dict(default="", type="str"),
executable=dict(type="path", aliases=["php_path"]),
working_dir=dict(
type="path", aliases=["working-dir"],
deprecated_aliases=[dict(name='working-dir', version='5.0.0', collection_name='community.general')]),
global_command=dict(
default=False, type="bool", aliases=["global-command"],
deprecated_aliases=[dict(name='global-command', version='5.0.0', collection_name='community.general')]),
prefer_source=dict(
default=False, type="bool", aliases=["prefer-source"],
deprecated_aliases=[dict(name='prefer-source', version='5.0.0', collection_name='community.general')]),
prefer_dist=dict(
default=False, type="bool", aliases=["prefer-dist"],
deprecated_aliases=[dict(name='prefer-dist', version='5.0.0', collection_name='community.general')]),
no_dev=dict(
default=True, type="bool", aliases=["no-dev"],
deprecated_aliases=[dict(name='no-dev', version='5.0.0', collection_name='community.general')]),
no_scripts=dict(
default=False, type="bool", aliases=["no-scripts"],
deprecated_aliases=[dict(name='no-scripts', version='5.0.0', collection_name='community.general')]),
no_plugins=dict(
default=False, type="bool", aliases=["no-plugins"],
deprecated_aliases=[dict(name='no-plugins', version='5.0.0', collection_name='community.general')]),
apcu_autoloader=dict(
default=False, type="bool", aliases=["apcu-autoloader"],
deprecated_aliases=[dict(name='apcu-autoloader', version='5.0.0', collection_name='community.general')]),
optimize_autoloader=dict(
default=True, type="bool", aliases=["optimize-autoloader"],
deprecated_aliases=[dict(name='optimize-autoloader', version='5.0.0', collection_name='community.general')]),
classmap_authoritative=dict(
default=False, type="bool", aliases=["classmap-authoritative"],
deprecated_aliases=[dict(name='classmap-authoritative', version='5.0.0', collection_name='community.general')]),
ignore_platform_reqs=dict(
default=False, type="bool", aliases=["ignore-platform-reqs"],
deprecated_aliases=[dict(name='ignore-platform-reqs', version='5.0.0', collection_name='community.general')]),
working_dir=dict(type="path"),
global_command=dict(default=False, type="bool"),
prefer_source=dict(default=False, type="bool"),
prefer_dist=dict(default=False, type="bool"),
no_dev=dict(default=True, type="bool"),
no_scripts=dict(default=False, type="bool"),
no_plugins=dict(default=False, type="bool"),
apcu_autoloader=dict(default=False, type="bool"),
optimize_autoloader=dict(default=True, type="bool"),
classmap_authoritative=dict(default=False, type="bool"),
ignore_platform_reqs=dict(default=False, type="bool"),
composer_executable=dict(type="path"),
),
required_if=[('global_command', False, ['working_dir'])],
@@ -252,7 +222,6 @@ def main():
module.fail_json(msg="Use the 'arguments' param for passing arguments with the 'command'")
arguments = module.params['arguments']
global_command = module.params['global_command']
available_options = get_available_options(module=module, command=command)
options = []
@@ -269,9 +238,6 @@ def main():
option = "--%s" % option
options.append(option)
if not global_command:
options.extend(['--working-dir', "'%s'" % module.params['working_dir']])
option_params = {
'prefer_source': 'prefer-source',
'prefer_dist': 'prefer-dist',
@@ -295,7 +261,7 @@ def main():
else:
module.exit_json(skipped=True, msg="command '%s' does not support check mode, skipping" % command)
rc, out, err = composer_command(module, command, arguments, options, global_command)
rc, out, err = composer_command(module, command, arguments, options)
if rc != 0:
output = parse_out(err)