1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ampache_ynh.git synced 2024-09-03 18:15:55 +02:00

Composer cleanup

This commit is contained in:
yalh76 2020-04-25 19:03:49 +02:00
parent 1c14538608
commit 6a9c02b56e
3 changed files with 12 additions and 11 deletions

View file

@ -16,7 +16,8 @@ extra_pkg_dependencies="php7.3-mysql php7.3-curl php7.3-simplexml php7.3-gd"
# Execute a command with Composer
#
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands"
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
@ -38,18 +39,22 @@ ynh_composer_exec () {
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path]
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"]
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vw
declare -Ar args_array=( [v]=phpversion= [w]=workdir= )
local legacy_args=vwa
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args=)
local phpversion
local workdir
local install_args
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"
install_args="${install_args:-}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
@ -57,7 +62,7 @@ ynh_install_composer () {
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer."
}

View file

@ -146,9 +146,7 @@ ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$app < "$final_
ynh_script_progression --message="Installing ampache with composer..." --weight=45
# Install composer
ynh_install_composer --phpversion="7.3" --workdir="$final_path"
ynh_exec_warn_less ynh_composer_exec --phpversion="7.3" --workdir=$final_path --commands=\"install --prefer-source --no-dev\"
ynh_install_composer --phpversion="7.3" --workdir="$final_path" --install_args="--prefer-source --no-dev"
#=================================================
# INSTALL MULTIMEDIA DIRECTORIES

View file

@ -182,10 +182,8 @@ then
ynh_script_progression --message="Upgrading ampache with composer..." --weight=30
# Install composer
ynh_install_composer --phpversion="7.3" --workdir="$final_path"
ynh_install_composer --phpversion="7.3" --workdir="$final_path" --install_args="--prefer-source --no-dev"
ynh_composer_exec --phpversion="7.3" --workdir=$final_path --commands="config discard-changes true"
ynh_composer_exec --phpversion="7.3" --workdir=$final_path --commands="update --prefer-source --no-dev"
fi
#=================================================