From 1c24a68b2c938d3dd93cae47970ca793b95c7e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 00:51:19 +0200 Subject: [PATCH] Found out what's wrong, fixed --- scripts/_common.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c8c93ef..07f04b7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -26,7 +26,7 @@ fi #================================================= env_ruby() { - ynh_exec_as "$app" "$ynh_ruby_load_path" env "$@" + ynh_exec_as "$app" "$ynh_ruby_load_path" "$@" } @@ -41,7 +41,6 @@ fabmanager_build_ruby() { env_ruby bin/bundle config set path 'vendor/bundle' env_ruby bin/bundle install env_ruby bin/bundle binstubs --all - popd } @@ -49,7 +48,10 @@ fabmanager_build_ui() { pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install - env_ruby bash -c "source '$install_dir/.env' ; RAILS_ENV=production bin/bundle exec rake assets:precompile" + ( + set -a; source "$install_dir/.env"; set +a # Export all variables of .env + env_ruby RAILS_ENV=production bin/bundle exec rake assets:precompile + ) ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean --all popd } @@ -57,14 +59,20 @@ fabmanager_build_ui() { fabmanager_seed_db() { pushd "$install_dir" ynh_replace_string --match_string="DateTime.current" --replace_string="DateTime.current - 1.days" --target_file="$install_dir/db/seeds.rb" - env_ruby bin/bundle exec rails db:seed RAILS_ENV=production ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" + ( + set -a; source "$install_dir/.env"; set +a # Export all variables of .env + env_ruby RAILS_ENV=production ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" bin/bundle exec rails db:seed + ) popd } fabmanager_migrate_db() { pushd "$install_dir" ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;" - env_ruby bin/bundle exec rails db:migrate RAILS_ENV=production + ( + set -a; source "$install_dir/.env"; set +a # Export all variables of .env + env_ruby RAILS_ENV=production bin/bundle exec rails db:migrate + ) ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;" popd }