1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kimai2_ynh.git synced 2024-09-03 19:26:26 +02:00

Moving to git release

This commit is contained in:
yalh76 2020-04-18 17:59:42 +02:00
parent f47e446999
commit bf7ffa001c
6 changed files with 84 additions and 5 deletions

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://github.com/kevinpapst/kimai2/releases/download/1.8/kimai-release-1.8.zip
SOURCE_SUM=c4de84b78102d30e858746f107839fe4144c80a31bbfb84e8476f95258be1c0c
SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.8.tar.gz
SOURCE_SUM=b5133d4dc98a360042fdbd9ac054b72ad9db3ce274ee733981375610ab7f46ef
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -7,7 +7,8 @@
# dependencies used by the app
pkg_dependencies=""
extra_pkg_dependencies="php7.3-mbstring php7.3-gd php7.3-intl php7.3-pdo php7.3-xml php7.3-zip php7.3-xsl php7.3-ldap php7.3-mysql php7.3-sqlite3 php7.3-ctype php7.3-iconv php7.3-json php7.3-cli php7.3-simplexml php7.3-tokenizer"
extra_pkg_dependencies="php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-pdo php7.3-zip php7.3-xml php7.3-xsl php7.3-ldap php7.3-mysql php7.3-sqlite3"
# php7.3-ctype php7.3-iconv php7.3-cli php7.3-simplexml php7.3-tokenizer php7.3-common php7.3-curl
#=================================================
# PERSONAL HELPERS

View file

@ -9,6 +9,7 @@
source _common.sh
source ynh_add_extra_apt_repos__3
source ynh_install_php__3
source ynh_composer__2
source ynh_send_readme_to_admin__2
source /usr/share/yunohost/helpers
@ -77,6 +78,13 @@ else
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
fi
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -144,6 +152,9 @@ fi
#=================================================
ynh_print_info --message="Building Kimai 2..."
ynh_install_composer --phpversion="7.3" --workdir="$final_path"
ynh_composer_exec --phpversion="7.3" --workdir="$final_path" --commands="install --no-dev --optimize-autoloader"
pushd "$final_path"
php7.3 bin/console kimai:install -n
popd

View file

@ -90,6 +90,14 @@ else
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
fi
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================

View file

@ -9,6 +9,7 @@
source _common.sh
source ynh_add_extra_apt_repos__3
source ynh_install_php__3
source ynh_composer__2
source /usr/share/yunohost/helpers
#=================================================
@ -134,6 +135,13 @@ ynh_print_info --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_print_info --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -187,6 +195,9 @@ fi
#=================================================
ynh_print_info --message="Upgrading Kimai 2..."
ynh_install_composer --phpversion="7.3" --workdir="$final_path"
ynh_composer_exec --phpversion="7.3" --workdir="$final_path" --commands="install --no-dev --optimize-autoloader"
pushd "$final_path"
php7.3 bin/console kimai:update
popd

48
scripts/ynh_composer__2 Normal file
View file

@ -0,0 +1,48 @@
#!/bin/bash
# Execute a command with Composer
#
# usage: ynh_composer_exec --phpversion=phpversion [--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=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer --phpversion=phpversion [--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=vw
declare -Ar args_array=( [v]=phpversion= [w]=workdir= )
local phpversion
local workdir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" \
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \
|| ynh_die "Unable to update core dependencies with Composer."
}