mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
switch to ynh_install_composer
This commit is contained in:
parent
cf6dc34a4f
commit
bf2aebb9e4
2 changed files with 46 additions and 1 deletions
|
@ -10,6 +10,7 @@ source _common.sh
|
||||||
source _pgsql.sh
|
source _pgsql.sh
|
||||||
source ynh_install_php
|
source ynh_install_php
|
||||||
source ynh_add_secure_repos__2
|
source ynh_add_secure_repos__2
|
||||||
|
source ynh_composer
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -113,7 +114,7 @@ ynh_add_fpm_config --phpversion=7.2
|
||||||
|
|
||||||
chown -R "$app": "$final_path"
|
chown -R "$app": "$final_path"
|
||||||
|
|
||||||
init_composer "$app" "$final_path"
|
ynh_install_composer --workdir=$final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
|
44
scripts/ynh_composer
Normal file
44
scripts/ynh_composer
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Execute a command with Composer
|
||||||
|
#
|
||||||
|
# usage: ynh_composer_exec [--workdir=$final_path] --commands="commands"
|
||||||
|
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
||||||
|
# | arg: -c, --commands - Commands to execute.
|
||||||
|
ynh_composer_exec () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=wc
|
||||||
|
declare -Ar args_array=( [w]=workdir= [c]=commands= )
|
||||||
|
local workdir
|
||||||
|
local commands
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
workdir="${workdir:-$final_path}"
|
||||||
|
|
||||||
|
COMPOSER_HOME="$workdir/.composer" \
|
||||||
|
php "$workdir/composer.phar" $commands \
|
||||||
|
-d "$workdir" --quiet --no-interaction
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install and initialize Composer in the given directory
|
||||||
|
#
|
||||||
|
# usage: ynh_install_composer [--workdir=$final_path]
|
||||||
|
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
||||||
|
ynh_install_composer () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=w
|
||||||
|
declare -Ar args_array=( [w]=workdir= )
|
||||||
|
local workdir
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
workdir="${workdir:-$final_path}"
|
||||||
|
|
||||||
|
curl -sS https://getcomposer.org/installer \
|
||||||
|
| COMPOSER_HOME="$workdir/.composer" \
|
||||||
|
php -- --quiet --install-dir="$workdir" \
|
||||||
|
|| ynh_die "Unable to install Composer."
|
||||||
|
|
||||||
|
# update dependencies to create composer.lock
|
||||||
|
ynh_composer_exec --workdir="$workdir" --commands="install --no-dev" \
|
||||||
|
|| ynh_die "Unable to update core dependencies with Composer."
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue