From 09f4af3efe59beb07ee5262054492e331337b79f Mon Sep 17 00:00:00 2001 From: Tagada <36127788+Tagadda@users.noreply.github.com> Date: Wed, 5 Jan 2022 15:46:26 +0100 Subject: [PATCH] fix linter --- manifest.json | 2 +- scripts/_common.sh | 5 +++-- scripts/install | 14 +++++++------- scripts/upgrade | 20 ++++++++++---------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/manifest.json b/manifest.json index c47ee13..1cfa73c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Libre and federated social network, fork of Mastodon", "fr": "Réseau social libre et fédéré, scission de Mastodon" }, - "version": "2021-12-27~ynh1", + "version": "2021.12.27~ynh1", "url": "https://github.com/glitch-soc/mastodon", "upstream": { "license": "free", diff --git a/scripts/_common.sh b/scripts/_common.sh index 181a153..8d24a71 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,9 +9,9 @@ pkg_dependencies="imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git MEMORY_NEEDED="2560" -RUBY_VERSION="2.7.2" +RUBY_VERSION="3.0.3" -NODEJS_VERSION="16" +NODEJS_VERSION="12" #================================================= # PERSONAL HELPERS @@ -117,6 +117,7 @@ ynh_is_main_device_a_sd_card () { # FUTURE OFFICIAL HELPERS #================================================= +# ynh_install_ruby__2 ynh_ruby_try_bash_extension() { if [ -x src/configure ]; then src/configure && make -C src || { diff --git a/scripts/install b/scripts/install index d7d2dd3..b445743 100644 --- a/scripts/install +++ b/scripts/install @@ -90,13 +90,13 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_script_progression --message="Creating a PostgreSQL database..." +ynh_psql_test_if_first_run # Create PostgreSQL database db_name=$(ynh_sanitize_dbid --db_name="${app}_production") db_user=$(ynh_sanitize_dbid --db_name=$app) db_pwd=$(ynh_string_random --length=30) ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd -ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;" @@ -204,13 +204,13 @@ pushd "$final_path/live" sudo -u $app $ynh_ruby_load_path bin/bundle config without 'development test' sudo -u $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN) ynh_use_nodejs - sudo -u $app $ynh_node_load_PATH yarn install --pure-lockfile + ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH yarn install --pure-lockfile echo "SAFETY_ASSURED=1">> $config - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:setup --quiet - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > /dev/null - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts modify "$admin" --approve + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:setup --quiet + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > /dev/null + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts modify "$admin" --approve popd vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K.+" "$final_path/live/key.txt") diff --git a/scripts/upgrade b/scripts/upgrade index e7e660c..c60fb2f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,12 +84,6 @@ fi # Remove paperclip_secret ynh_app_setting_delete --app=$app --key=paperclip_secret -# If redis_namespace doesn't exist, create it -if [[ -z "$redis_namespace" ]]; then - redis_namespace=${app}_production - ynh_app_setting_set --app=$app --key=redis_namespace --value=$redis_namespace -fi - # If secret_key_base doesn't exist, retrieve it or create it if [[ -z "$secret_key_base" ]]; then secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" $config) @@ -116,6 +110,12 @@ if [[ -z "$vapid_private_key" ]]; then ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key" fi +# If redis_namespace doesn't exist, create it +if [[ -z "$redis_namespace" ]]; then + redis_namespace=${app}_production + ynh_app_setting_set --app=$app --key=redis_namespace --value=$redis_namespace +fi + #Remove previous added repository ynh_remove_extra_repo @@ -267,10 +267,10 @@ pushd "$final_path/live" sudo -u $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN) ynh_use_nodejs sudo -u $app $ynh_node_load_PATH yarn install --pure-lockfile - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:clean - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate - sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl cache clear + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:clean + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate + ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl cache clear popd #=================================================