1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/firefly-iii_ynh.git synced 2024-09-03 18:36:13 +02:00

Merge pull request #42 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2021-08-04 20:35:59 +02:00 committed by GitHub
commit 8195b11d46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 267 additions and 334 deletions

View file

@ -1,6 +1,6 @@
--- ---
name: Bug report name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
--- ---
@ -8,28 +8,30 @@ about: Create a report to help us debug, it would be nice to fill the template a
1. *Read this whole template first.* 1. *Read this whole template first.*
2. *Determine if you are on the right place:* 2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to Firefly III itself. Refer to its documentation or repository for help.* - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.* - *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.* 3. *Delete the italic comments as you write over them below, and remove this guide.*
--- ---
**Describe the bug** ### Describe the bug
*A clear and concise description of what the bug is.* *A clear and concise description of what the bug is.*
**Versions** ### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x - YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes* - Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain: - If yes, please explain:
- Using, or trying to install package version/branch: - Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce** ### Steps to reproduce
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:* - *If you performed a command from the CLI, the command itself is enough. For example:*
```sh ```sh
sudo yunohost app install firefly-iii sudo yunohost app install the_app
``` ```
- *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:* - *If the error occurs in your browser, explain what you did:*
@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a
3. *Scroll down to '...'* 3. *Scroll down to '...'*
4. *See error* 4. *See error*
**Expected behavior** ### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* *A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs** ### Logs
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.* *If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -1,55 +1,39 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Firefly III for YunoHost # Firefly III for YunoHost
[![Integration level](https://dash.yunohost.org/integration/firefly-iii.svg)](https://dash.yunohost.org/appci/app/firefly-iii) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/firefly-iii.svg)](https://dash.yunohost.org/appci/app/firefly-iii) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.maintain.svg)
[![Install Firefly III with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=firefly-iii) [![Install Firefly III with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=firefly-iii)
> *This package allows you to install Firefly III quickly and simply on a YunoHost server. *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Firefly III quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
"Firefly III" is a (self-hosted) manager for your personal finances. It can help you keep track of your expenses and income, so you can spend less and save more. Firefly III supports the use of budgets, categories and tags. It can import data from external sources and it has many neat financial reports available. You can [read all about it in the main repository](https://github.com/firefly-iii/firefly-iii) and in the [official documentation](https://firefly-iii.readthedocs.io/en/latest/).
**Shipped version:** 5.4.6 Self-hosted financial manager
**Shipped version:** 5.5.13~ynh1
**Demo:** https://demo.firefly-iii.org/login
## Screenshots ## Screenshots
![](index.png) ![](./doc/screenshots/budget.png)
![](./doc/screenshots/ff2.png)
## Demo ## Documentation and resources
* [Demo 1](https://demo.firefly-iii.org/login) * Official app website: https://firefly-iii.org/
* [Demo 2](http://www.softaculous.com/softaculous/demos/Firefly_III) * Official user documentation: https://yunohost.org/apps
* Official admin documentation: https://docs.firefly-iii.org/firefly-iii/about-firefly-iii/introduction/
## Documentation * Upstream app code repository: https://github.com/firefly-iii/firefly-iii
* YunoHost documentation for this app: https://yunohost.org/app_firefly-iii
* Official documentation: https://docs.firefly-iii.org/ * Report a bug: https://github.com/YunoHost-Apps/firefly-iii_ynh/issues
## YunoHost specific features
#### Multi-user support
- The admin user should be the first user to log into Firefly III
- SSO is not working yet
- You will probably be warned about missing locale from your system. Once you change the language to those corresponding to your system, the warning will desapear
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/firefly-iii%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/firefly-iii/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/firefly-iii%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/firefly-iii/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/firefly-iii_ynh/issues
* App website: https://firefly-iii.org/
* Upstream app repository: https://github.com/firefly-iii/firefly-iii
* YunoHost website: https://yunohost.org/
TODO
- [ ] Make Firefly III admin user dependant of the user choosen at installation
- [ ] Make SSO work
- [ ] Define default language according to system language
---
## Developer info ## Developer info
@ -61,3 +45,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/
or or
sudo yunohost app upgrade firefly-iii -u https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing --debug sudo yunohost app upgrade firefly-iii -u https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

45
README_fr.md Normal file
View file

@ -0,0 +1,45 @@
# Firefly III pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/firefly-iii.svg)](https://dash.yunohost.org/appci/app/firefly-iii) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.maintain.svg)
[![Installer Firefly III avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=firefly-iii)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Firefly III rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Gestionnaire de finances personnelles
**Version incluse :** 5.5.13~ynh1
**Démo :** https://demo.firefly-iii.org/login
## Captures d'écran
![](./doc/screenshots/budget.png)
![](./doc/screenshots/ff2.png)
## Documentations et ressources
* Site officiel de l'app : https://firefly-iii.org/
* Documentation officielle utilisateur : https://yunohost.org/apps
* Documentation officielle de l'admin : https://docs.firefly-iii.org/firefly-iii/about-firefly-iii/introduction/
* Dépôt de code officiel de l'app : https://github.com/firefly-iii/firefly-iii
* Documentation YunoHost pour cette app : https://yunohost.org/app_firefly-iii
* Signaler un bug : https://github.com/YunoHost-Apps/firefly-iii_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing --debug
ou
sudo yunohost app upgrade firefly-iii -u https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 KiB

BIN
cata.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View file

@ -1,12 +1,9 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) admin="john"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -15,10 +12,9 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=231c5e281e9cafabd35d4a6ef3c27fec6f3c470f upgrade=1 from_commit=5ee628f58c4f9ea6b6fd48d843453c47ed3d34e4
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=0 change_url=0
;;; Options ;;; Options
Email=anmol@datamol.org Email=anmol@datamol.org

View file

@ -12,7 +12,7 @@ SITE_OWNER=mail@example.com
# The encryption key for your sessions. Keep this very secure. # The encryption key for your sessions. Keep this very secure.
# Change it to a string of exactly 32 chars or use something like `php artisan key:generate` to generate it. # Change it to a string of exactly 32 chars or use something like `php artisan key:generate` to generate it.
# If you use Docker or similar, you can set this variable from a file by using APP_KEY_FILE # If you use Docker or similar, you can set this variable from a file by using APP_KEY_FILE
APP_KEY=SomeRandomStringOf32CharsExactly APP_KEY=__RANDOM_KEY__
# Firefly III will launch using this language (for new users and unauthenticated visitors) # Firefly III will launch using this language (for new users and unauthenticated visitors)
# For a list of available languages: https://github.com/firefly-iii/firefly-iii/tree/main/resources/lang # For a list of available languages: https://github.com/firefly-iii/firefly-iii/tree/main/resources/lang
@ -59,11 +59,11 @@ APP_LOG_LEVEL=notice
# Use "mysql" for MySQL and MariaDB. # Use "mysql" for MySQL and MariaDB.
# Use "sqlite" for SQLite. # Use "sqlite" for SQLite.
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=fireflyiiidb DB_HOST=127.0.0.1
DB_PORT=3306 DB_PORT=3306
DB_DATABASE=firefly DB_DATABASE=__DB_NAME__
DB_USERNAME=firefly DB_USERNAME=__DB_NAME__
DB_PASSWORD=secret_firefly_password DB_PASSWORD=__DB_PWD__
# MySQL supports SSL. You can configure it here. # MySQL supports SSL. You can configure it here.
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE # If you use Docker or similar, you can set these variables from a file by appending them with _FILE
@ -117,10 +117,10 @@ COOKIE_SECURE=false
# If you want Firefly III to mail you, update these settings # If you want Firefly III to mail you, update these settings
# For instructions, see: https://docs.firefly-iii.org/advanced-installation/email # For instructions, see: https://docs.firefly-iii.org/advanced-installation/email
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE # If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MAIL_MAILER=log MAIL_MAILER=smtp
MAIL_HOST=null MAIL_HOST=127.0.0.1
MAIL_PORT=2525 MAIL_PORT=25
MAIL_FROM=changeme@example.com MAIL_FROM=__EMAIL__
MAIL_USERNAME=null MAIL_USERNAME=null
MAIL_PASSWORD=null MAIL_PASSWORD=null
MAIL_ENCRYPTION=null MAIL_ENCRYPTION=null
@ -212,10 +212,10 @@ ADLDAP_AUTO_CONNECT=true
# LDAP connection settings # LDAP connection settings
# You can set the following variables from a file by appending them with _FILE: # You can set the following variables from a file by appending them with _FILE:
# ADLDAP_CONTROLLERS, ADLDAP_PORT, ADLDAP_BASEDN # ADLDAP_CONTROLLERS, ADLDAP_PORT, ADLDAP_BASEDN
ADLDAP_CONTROLLERS= ADLDAP_CONTROLLERS=127.0.0.1
ADLDAP_PORT=389 ADLDAP_PORT=389
ADLDAP_TIMEOUT=5 ADLDAP_TIMEOUT=5
ADLDAP_BASEDN="" ADLDAP_BASEDN="dc=yunohost,dc=org"
ADLDAP_FOLLOW_REFFERALS=false ADLDAP_FOLLOW_REFFERALS=false
# SSL/TLS settings # SSL/TLS settings
@ -233,15 +233,15 @@ ADLDAP_ADMIN_USERNAME=
ADLDAP_ADMIN_PASSWORD= ADLDAP_ADMIN_PASSWORD=
# You can set the following variables from a file by appending them with _FILE: # You can set the following variables from a file by appending them with _FILE:
ADLDAP_ACCOUNT_PREFIX= ADLDAP_ACCOUNT_PREFIX="uid="
ADLDAP_ACCOUNT_SUFFIX= ADLDAP_ACCOUNT_SUFFIX=",dc=yunohost,dc=org"
# LDAP authentication settings. # LDAP authentication settings.
ADLDAP_PASSWORD_SYNC=false ADLDAP_PASSWORD_SYNC=false
ADLDAP_LOGIN_FALLBACK=false ADLDAP_LOGIN_FALLBACK=false
ADLDAP_DISCOVER_FIELD=distinguishedname ADLDAP_DISCOVER_FIELD="uid"
ADLDAP_AUTH_FIELD=distinguishedname ADLDAP_AUTH_FIELD="uid"
# field to sync as local username. # field to sync as local username.
# You can set the following variable from a file by appending it with _FILE: # You can set the following variable from a file by appending it with _FILE:
@ -326,4 +326,4 @@ FIREFLY_III_LAYOUT=v1
# #
# If you're stuck I understand you get desperate but look SOMEWHERE ELSE. # If you're stuck I understand you get desperate but look SOMEWHERE ELSE.
# #
APP_URL=http://localhost APP_URL=http://__DOMAIN____PATH__

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/firefly-iii/firefly-iii/archive/5.4.6.tar.gz SOURCE_URL=https://github.com/firefly-iii/firefly-iii/archive/refs/tags/5.5.13.tar.gz
SOURCE_SUM=ff78e16c022662c0e0c29fa4092928257fedcf17d1801e0582191cfcd631e6a9 SOURCE_SUM=13deecec37a01029d7b9057dc7941e6e18e42551477d5ad46683247402904828
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -2,7 +2,7 @@
location __PATH__/ { location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/public/ ; alias __FINALPATH__/public/;
# Force usage of https # Force usage of https
if ($scheme = http) { if ($scheme = http) {
@ -30,7 +30,7 @@ location __PATH__/ {
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }

0
doc/DISCLAIMER.md Normal file
View file

View file

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 115 KiB

BIN
doc/screenshots/ff2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
index.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 KiB

View file

@ -3,11 +3,19 @@
"id": "firefly-iii", "id": "firefly-iii",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Self-hosted financial manager.", "en": "Self-hosted financial manager",
"fr": "Gestionnaire de finances personnelles." "fr": "Gestionnaire de finances personnelles"
}, },
"version": "5.4.6~ynh2", "version": "5.5.13~ynh1",
"url": "https://firefly-iii.org/", "url": "https://firefly-iii.org/",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://firefly-iii.org/",
"demo": "https://demo.firefly-iii.org/login",
"admindoc": "https://docs.firefly-iii.org/firefly-iii/about-firefly-iii/introduction/",
"userdoc": "https://yunohost.org/apps",
"code": "https://github.com/firefly-iii/firefly-iii"
},
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "Anmol Sharma", "name": "Anmol Sharma",
@ -15,12 +23,12 @@
"url": "https://datamol.org" "url": "https://datamol.org"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.0" "yunohost": ">= 4.2.4"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.4-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
@ -28,38 +36,22 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain for Firefly III",
"fr": "Choisissez un nom de domaine pour Firefly III"
},
"example": "example.com" "example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Firefly III",
"fr": "Choisissez un chemin pour Firefly III"
},
"example": "/example", "example": "/example",
"default": "/firefly" "default": "/firefly"
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user",
"ask": {
"en": "Choose an admin user (should be a YunoHost registered user)",
"fr": "Choisissez ladministrateur (should be a YunoHost registered user)"
},
"example": "johndoe" "example": "johndoe"
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true "default": true
} }
] ]

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -5,12 +5,22 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
latest_tag=$(curl -s https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep 'tag_name' | cut -d\" -f4)
tag="5.5.11"
pkg_dependencies="redis-server" pkg_dependencies="redis-server"
YNH_PHP_VERSION="7.4" YNH_PHP_VERSION="7.4"
# Composer version
YNH_COMPOSER_VERSION="2.0.13"
extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-ldap" extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-ldap"
# Composer version
YNH_COMPOSER_VERSION="2.0.13"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================

View file

@ -28,11 +28,6 @@ ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================

View file

@ -7,7 +7,6 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_composer__2
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -27,7 +26,7 @@ admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
random_key=$(ynh_string_random --length=32) random_key=$(ynh_string_random --length=32)
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
update=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
@ -49,8 +48,8 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=random_key --value=$random_key ynh_app_setting_set --app=$app --key=random_key --value=$random_key
ynh_app_setting_set --app=$app --key=update --value=$update
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
@ -59,6 +58,14 @@ ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
@ -69,14 +76,27 @@ db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." ynh_script_progression --message="Cloning Firefly-iii..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R 775 $final_path/storage
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -86,14 +106,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -117,36 +129,9 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$f
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." ynh_script_progression --message="Modifying a config file..."
config="$final_path/.env" ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
cp -f ../conf/.env "$config" chmod 400 "$final_path/.env"
chown $app "$final_path/.env"
ynh_replace_string --match_string="SomeRandomStringOf32CharsExactly" --replace_string="$random_key" --target_file="$config"
ynh_replace_string --match_string="fireflyiiidb" --replace_string="127.0.0.1" --target_file="$config"
ynh_replace_string --match_string="DB_DATABASE=firefly" --replace_string="DB_DATABASE=$db_name" --target_file="$config"
ynh_replace_string --match_string="DB_USERNAME=firefly" --replace_string="DB_USERNAME=$db_name" --target_file="$config"
ynh_replace_string --match_string="secret_firefly_password" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="MAIL_MAILER=log" --replace_string="MAIL_MAILER=smtp" --target_file="$config"
ynh_replace_string --match_string="MAIL_HOST=null" --replace_string="MAIL_HOST=127.0.0.1" --target_file="$config"
ynh_replace_string --match_string="MAIL_PORT=2525" --replace_string="MAIL_PORT=25" --target_file="$config"
ynh_replace_string --match_string="mail@example.com" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="changeme@example.com" --replace_string="$app@$domain" --target_file="$config"
# These helpers are for reference to impliment remove them once app gets support for LDAP. Put them directly in .env
# ynh_replace_string --match_string="ADLDAP_CONTROLLERS=" --replace_string="ADLDAP_CONTROLLERS=127.0.0.1" --target_file="$config"
# ynh_replace_string --match_string='ADLDAP_BASEDN=""' --replace_string='ADLDAP_BASEDN="dc=yunohost,dc=org"' --target_file="$config"
# ynh_replace_string --match_string="ADLDAP_ACCOUNT_PREFIX=" --replace_string='ADLDAP_ACCOUNT_PREFIX="uid="' --target_file="$config"
# ynh_replace_string --match_string="ADLDAP_ACCOUNT_SUFFIX=" --replace_string='ADLDAP_ACCOUNT_SUFFIX=",dc=yunohost,dc=org"' --target_file="$config"
# ynh_replace_string --match_string="distinguishedname" --replace_string="uid" --target_file="$config"
# ynh_replace_string --match_string="userprincipalname" --replace_string="uid" --target_file="$config"
ynh_replace_string --match_string="localhost" --replace_string="$domain$path_url" --target_file="$config"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
#================================================= #=================================================
# DEPLOY # DEPLOY
@ -159,27 +144,14 @@ pushd "$final_path"
php$phpversion artisan passport:install php$phpversion artisan passport:install
popd popd
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set right permissions
chown -R $app: $final_path
chmod -R 775 $final_path/storage
#================================================= #=================================================
# SETUP A CRON # SETUP A CRON
#================================================= #=================================================
ynh_script_progression --message="Setuping a cron..." ynh_script_progression --message="Setuping a cron..."
cp ../conf/cron /etc/cron.d/$app ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE

View file

@ -50,6 +50,14 @@ ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -57,21 +65,9 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
#================================================= chmod 750 "$final_path"
# RECREATE THE DEDICATED USER chmod -R o-rwx "$final_path"
#================================================= chown -R $app:www-data "$final_path"
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION

View file

@ -7,7 +7,6 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_composer__2
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -20,12 +19,12 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
random_key=$(ynh_app_setting_get --app=$app --key=random_key) random_key=$(ynh_app_setting_get --app=$app --key=random_key)
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
update=$(ynh_app_setting_get --app=$app --key=update)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -34,20 +33,25 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If db_name doesn't exist, create it # If db_name doesn't exist, create it
if [ -z "$db_name" ]; then if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
@ -68,18 +72,12 @@ if ynh_legacy_permissions_exists; then
fi fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." ynh_script_progression --message="Making sure dedicated system user exists..."
# Backup the current version of the app # Create a dedicated user (if not existing)
ynh_backup_before_upgrade ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -89,32 +87,63 @@ ynh_abort_if_errors
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." if [ `cd $final_path && git rev-parse --is-inside-work-tree` ];
then
pushd "$final_path"
if [ $update -eq 1 ]
then
git fetch origin tag $latest_tag --no-tags
git checkout $latest_tag
else
git fetch origin tag $tag --no-tags
git checkout $tag
fi
ynh_secure_remove bootstrap/cache/*
ynh_secure_remove vendor/
popd
else
ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Create a temporary directory # Backup the config file in the temp dir
tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir
mkdir -p "$tmpdir/storage/upload" mkdir -p "$tmpdir/storage/upload"
mkdir -p "$tmpdir/storage/export" mkdir -p "$tmpdir/storage/export"
mkdir -p "$final_path/storage/upload/" mkdir -p "$final_path/storage/upload/"
mkdir -p "$final_path/storage/export/" mkdir -p "$final_path/storage/export/"
cp -a "$final_path/storage/upload/" "$tmpdir/storage/upload/" cp -aT "$final_path/storage/upload" "$tmpdir/storage/upload/$"
cp -a "$final_path/.env" "$tmpdir/.env" cp -a "$final_path/.env" "$tmpdir/.env"
cp -a "$final_path/storage/export/" "$tmpdir/storage/export/" cp -aT "$final_path/storage/export" "$tmpdir/storage/export/"
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" if [ $update -eq 1 ]
then
git clone -b $latest_tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
# Restore the config file else
cp -a "$tmpdir/storage/upload/" "$final_path/storage/upload/" git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
cp -a "$tmpdir/storage/export/" "$final_path/storage/export/"
fi
ynh_secure_remove bootstrap/cache/*
# Restore the config file and data
mkdir -p "$final_path/storage/upload/"
mkdir -p "$final_path/storage/export/"
cp -aT "$tmpdir/storage/upload" "$final_path/storage/upload"
cp -aT "$tmpdir/storage/export" "$final_path/storage/export"
cp -a "$tmpdir/.env" "$final_path/.env" cp -a "$tmpdir/.env" "$final_path/.env"
# Remove temporary directory # Remove temporary directory
ynh_secure_remove --file="$tmpdir" ynh_secure_remove --file="$tmpdir"
fi
fi fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R 775 $final_path/storage
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -130,14 +159,6 @@ ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies "$pkg_dependencies" ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -154,8 +175,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Updating PHP dependencies..." ynh_script_progression --message="Updating PHP dependencies..."
chown -R $app: $final_path chown -R $app $final_path
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
#================================================= #=================================================
@ -163,32 +183,10 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$f
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." ynh_script_progression --message="Modifying a config file..."
config="$final_path/.env" ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
ynh_backup_if_checksum_is_different --file="$config"
cp ../conf/.env "$config"
ynh_replace_string --match_string="SomeRandomStringOf32CharsExactly" --replace_string="$random_key" --target_file="$config" chmod 400 "$final_path/.env"
ynh_replace_string --match_string="fireflyiiidb" --replace_string="127.0.0.1" --target_file="$config" chown $app "$final_path/.env"
ynh_replace_string --match_string="DB_DATABASE=firefly" --replace_string="DB_DATABASE=$db_name" --target_file="$config"
ynh_replace_string --match_string="DB_USERNAME=firefly" --replace_string="DB_USERNAME=$db_name" --target_file="$config"
ynh_replace_string --match_string="secret_firefly_password" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="MAIL_MAILER=log" --replace_string="MAIL_MAILER=smtp" --target_file="$config"
ynh_replace_string --match_string="MAIL_HOST=null" --replace_string="MAIL_HOST=127.0.0.1" --target_file="$config"
ynh_replace_string --match_string="MAIL_PORT=2525" --replace_string="MAIL_PORT=25" --target_file="$config"
ynh_replace_string --match_string="mail@example.com" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="changeme@example.com" --replace_string="$app@$domain" --target_file="$config"
# These helpers are for reference.Remove them once app gets support for LDAP. Put them directly in .env
# ynh_replace_string --match_string="ADLDAP_CONTROLLERS=" --replace_string="ADLDAP_CONTROLLERS=127.0.0.1" --target_file="$config"
# ynh_replace_string --match_string='ADLDAP_BASEDN=""' --replace_string='ADLDAP_BASEDN="dc=yunohost,dc=org"' --target_file="$config"
# ynh_replace_string --match_string="ADLDAP_ACCOUNT_PREFIX=" --replace_string='ADLDAP_ACCOUNT_PREFIX="uid="' --target_file="$config"
# ynh_replace_string --match_string="ADLDAP_ACCOUNT_SUFFIX=" --replace_string='ADLDAP_ACCOUNT_SUFFIX=",dc=yunohost,dc=org"' --target_file="$config"
# ynh_replace_string --match_string="distinguishedname" --replace_string="uid" --target_file="$config"
# ynh_replace_string --match_string="userprincipalname" --replace_string="uid" --target_file="$config"
ynh_replace_string --match_string="localhost" --replace_string="$domain$path_url" --target_file="$config"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$config"
#================================================= #=================================================
# DEPLOYMENT # DEPLOYMENT
@ -212,27 +210,14 @@ ynh_script_progression --message="Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R $app: $final_path
chmod -R 775 $final_path/storage
#================================================= #=================================================
# SETUP A CRON # SETUP A CRON
#================================================= #=================================================
ynh_script_progression --message="Setuping a cron..." ynh_script_progression --message="Setuping a cron..."
cp ../conf/cron /etc/cron.d/$app ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -1,53 +0,0 @@
#!/bin/bash
# Execute a command with Composer
#
# 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 () {
# 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:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --no-interaction
}
# Install and initialize Composer in the given directory
#
# 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=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:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --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 $install_args" \
|| ynh_die "Unable to update core dependencies with Composer."
}