From 22dcead3c1a8d100b2ed1fc43d82dcd7815207f1 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 22 May 2020 19:40:24 +0200 Subject: [PATCH] Force module versions --- scripts/_variables | 16 ++++++++++++++++ scripts/config | 2 +- scripts/install | 28 ++++++++++++++-------------- scripts/upgrade | 16 +++++++++++++++- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/scripts/_variables b/scripts/_variables index 7c959bf..7a046d0 100644 --- a/scripts/_variables +++ b/scripts/_variables @@ -12,3 +12,19 @@ nodejs_version=10 # Mypads version # This variable is mostly used to force an upgrade of the package in case of new versions of mypads. mypads_version=1.7.10 + +# Plugin versions +ep_align_version=0.2.0 +ep_author_hover_version=0.2.1 +ep_automatic_logut_version=1.0.8 +ep_comments_page_version=0.0.35 +ep_countable_version=0.0.7 +ep_delete_empty_pads_version=0.0.6 +ep_font_color_version=0.0.11 +ep_headings2_version=0.1.3 +ep_markdown_version=0.1.7 +ep_page_view_version=0.5.24 +ep_spellcheck_version=0.0.7 +ep_subscript_and_superscript_version=0.0.3 +ep_table_of_contents_version=0.1.15 +ep_user_font_size_version=0.0.1 diff --git a/scripts/config b/scripts/config index 7604af9..98ab80c 100644 --- a/scripts/config +++ b/scripts/config @@ -236,7 +236,7 @@ apply_config() { npm uninstall ep_automatic_logut else ynh_replace_string --match_string="^\/\/\(.*\"automatic_logut.*$\)" --replace_string="\1" --target_file="$config_file" - npm install ep_automatic_logut + npm install ep_automatic_logut@${ep_automatic_logut_version} fi popd chown -R $app: $final_path/node_modules diff --git a/scripts/install b/scripts/install index 898911d..7fe6788 100644 --- a/scripts/install +++ b/scripts/install @@ -242,37 +242,37 @@ ynh_script_progression --message="Installing Etherpad plugins..." --weight=90 pushd "$final_path" # Add Left/Center/Right/Justify to lines of text in a pad -npm install ep_align >> $install_log 2>&1 +npm install ep_align@${ep_align_version} >> $install_log 2>&1 # Framapad - Adds author names to span titles -npm install ep_author_hover >> $install_log 2>&1 +npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1 # Automatically disconnects user after some period of time (Prevent server overload) -npm install ep_automatic_logut >> $install_log 2>&1 +npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1 # Framapad - Adds comments on sidebar and link it to the text. -npm install ep_comments_page >> $install_log 2>&1 +npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1 # Framapad - Displays paragraphs, sentences, words and characters counts. -npm install ep_countable >> $install_log 2>&1 +npm install ep_countable@${ep_countable_version} >> $install_log 2>&1 # Framapad - Delete pads which were never edited -npm install ep_delete_empty_pads >> $install_log 2>&1 +npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1 # Framapad - Apply colors to fonts -npm install ep_font_color >> $install_log 2>&1 +npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1 # Framapad - Adds heading support to Etherpad Lite. -npm install ep_headings2 >> $install_log 2>&1 +npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1 # Framapad - Edit and Export as Markdown in Etherpad -npm install ep_markdown >> $install_log 2>&1 +npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1 if [ $mypads -eq 1 ]; then # Framapad - Groups and private pads for etherpad npm install ep_mypads@${mypads_version} >> $install_log 2>&1 fi # Framapad - Add support to do 'page view', with a toggle on/off option in Settings, also Page Breaks with Control Enter -npm install ep_page_view >> $install_log 2>&1 +npm install ep_page_view@${ep_page_view_version} >> $install_log 2>&1 # Framapad - Add support to do 'Spell checking' -npm install ep_spellcheck >> $install_log 2>&1 +npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1 # Framapad - Add support for Subscript and Superscript -npm install ep_subscript_and_superscript >> $install_log 2>&1 +npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1 # Framapad - View a table of contents for your pad -npm install ep_table_of_contents >> $install_log 2>&1 +npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1 # Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views -npm install ep_user_font_size >> $install_log 2>&1 +npm install ep_user_font_size@${ep_user_font_size_version} >> $install_log 2>&1 popd chown -R $app: $final_path/node_modules diff --git a/scripts/upgrade b/scripts/upgrade index dfb880d..4b9666f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -234,8 +234,22 @@ ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" ynh_exec_warn_less npm cache clean --force while read node_module do + # Ignore ep_etherpad-lite, this part is updated before in this script. + if [ "$node_module" = "ep_etherpad-lite" ]; then + continue + fi echo "Update $node_module" - ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --upgrade $node_module || true + # Build the name of the variable with the version. + module_version=${node_module}_version + # Get the content of the variable (from the file _variables) + module_version=${!module_version:-} + # If the module has no version stored in a variable into the file, keep it empty. + # That way, the upgrade will not be specific to a version. + ## Otherwise, add @ before the version number to force the upgrade to this version. + if [ -n "${module_version}" ]; then + module_version=@${module_version} + fi + ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --upgrade ${node_module}${module_version} || true done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")") #=================================================