From 61095ebcdfb2493ed45abd8da00dffe4331cba27 Mon Sep 17 00:00:00 2001 From: anmol26s <5068843+anmol26s@users.noreply.github.com> Date: Wed, 5 Sep 2018 11:06:40 -0400 Subject: [PATCH] Updated to version 0.4 and symfony fix for version 0.3 * Updated to version 0.4 * symfony fix * symfony fix * symfony fix * symfony fix * symfony fix * symfony fix * symfony fix * symfony fix * symfony/flex --no-plugins & clear and warmup the cache * Forgot bin/console in upgrade script * Added bin/console doctrine:migrations:version --add --all to install * symfony-cmd: not found fix * cd fix for update script * Added -n for doctrine:migrations:version in install --- README.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/_common.sh | 22 +++++++++++++++++++++- scripts/install | 2 ++ scripts/upgrade | 19 ++++++++++++++++++- 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8f9fe9f..8597754 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Integration level](https://dash.yunohost.org/integration/kimai2.svg)](https://ci-apps.yunohost.org/jenkins/job/kimai2%20%28Community%29/lastBuild/consoleFull) [![Install kimai2 with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=kimai2)
-Shipped Version: **0.3 (pre-release)** +Shipped Version: **0.4 (pre-release)** **Please note that this app will install PHP 7.2** diff --git a/conf/app.src b/conf/app.src index 913e8c2..1adfde7 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/0.3.tar.gz -SOURCE_SUM=87e1b544c4483e4c11cf96fa44aca9bd71fac3a168155cd10b9922ab22e92678 +SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/0.4.tar.gz +SOURCE_SUM=2bfe446b5aeca3facfc2903cad4ca33fe04e8e71e45c1ecfe31669b08d31afe1 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 2954d88..ec75a73 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Kimai2 package for YunoHost.", "fr": "Kimai2 de package d’application pour YunoHost." }, - "version": "0.3", + "version": "0.4", "url": "https://v2.kimai.org", "license": "free", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 9c5ee6e..f54d90a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -95,7 +95,7 @@ init_composer() { || ynh_die "Unable to install Composer" # update dependencies to create composer.lock - exec_composer "$DESTDIR" install --no-dev --prefer-dist --no-scripts \ + exec_composer "$DESTDIR" install --no-dev --optimize-autoloader \ || ynh_die "Unable to update Kimai2 core dependencies" } @@ -103,6 +103,26 @@ sudo_path () { sudo env "PATH=$PATH" $@ } +# Install and initialize Composer for upgrade script in the given directory +# usage: init_composer DESTDIR [AS_USER] +init_symfony_update() { + local DESTDIR=$1 + local AS_USER=${2:-admin} + + # install composer for upgrade script + curl -sS https://getcomposer.org/installer \ + | COMPOSER_HOME="${DESTDIR}/.composer" \ + sudo /usr/bin/php7.2 -- --install-dir="$DESTDIR" \ + || ynh_die "Unable to install Composer" + + # update symfony + exec_composer "$DESTDIR" update symfony/flex --no-plugins --no-scripts \ + || ynh_die "Unable to update symfony for Kimai2" +} + +sudo_path () { + sudo env "PATH=$PATH" $@ +} # # php7.2 helpers # diff --git a/scripts/install b/scripts/install index 2d24840..9036037 100755 --- a/scripts/install +++ b/scripts/install @@ -127,6 +127,8 @@ init_composer $final_path cd $final_path && sudo /usr/bin/php7.2 bin/console doctrine:schema:create cd $final_path && sudo /usr/bin/php7.2 bin/console cache:warmup --env=prod cd $final_path && sudo /usr/bin/php7.2 bin/console kimai:create-user "$admin" "$email" ROLE_SUPER_ADMIN "$admin_pass" +cd $final_path && sudo /usr/bin/php7.2 bin/console doctrine:migrations:version --add --all -n + #================================================= # SETUP APPLICATION diff --git a/scripts/upgrade b/scripts/upgrade index 36c388e..6abbf3b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,9 +74,26 @@ ynh_install_php7 # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -# Download, check integrity, uncompress and patch the source from app.src +# Download, check integrity, uncompress and patch the source from app.src and do required installation for update + +#version check for 0.3 +version=`sed -n 's/^future-release=//p' /var/www/kimai2/.github_changelog_generator` + +# Uncompress latest sources ynh_setup_source "$final_path" +# If the version is 0.3, symfony update is required +if [ "$version" = "0.3" ] +then + init_symfony_update $final_path +fi + +init_composer $final_path +( +cd $final_path && sudo /usr/bin/php7.2 bin/console cache:clear --env=prod +cd $final_path && sudo /usr/bin/php7.2 bin/console cache:warmup --env=prod +cd $final_path && sudo /usr/bin/php7.2 bin/console doctrine:migrations:migrate -n +) #================================================= # NGINX CONFIGURATION #=================================================