mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
cleaning
This commit is contained in:
parent
f301a8b213
commit
cc7808c378
5 changed files with 5 additions and 190 deletions
44
CHANGELOG.md
44
CHANGELOG.md
|
@ -1,44 +0,0 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
## [1.0~ynh4](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60) - 2021-04-23
|
||||
|
||||
#### Added
|
||||
* [Add a README_fr](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/c84b7d4e97f00e2c7de10d949891cf660f1d8459)
|
||||
|
||||
#### Changed
|
||||
* [Use php7.3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/b324c78780110e8eae05da47f8f151c1d50bf3c7)
|
||||
* [New permissions](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/a5cc8741477a0f37ffd1b84e08bb3dec8af34a46)
|
||||
# [Normalization from example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/a5cc8741477a0f37ffd1b84e08bb3dec8af34a46)
|
||||
|
||||
## [1.0~ynh3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42) - 2020-01-01
|
||||
|
||||
#### Added
|
||||
* [Add a changelog](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/60710bb18e1a4b7a3614e55d23e059af91969ea4)
|
||||
* [Actions and config-panel](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/56e40ac3a10e89a106418695268dec271a04ebb2)
|
||||
|
||||
#### Changed
|
||||
* [use scalable phpfpm](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/6e33fd4c24f9f83bc1378b05aba20d7da3dcb406)
|
||||
* [Optionnal sftp](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/f2e31fa4924c9985233e574c2c2f318eb3579996)
|
||||
- [Various upgrades](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/5ee2886daa40de744139bfee1390703ba958bd30)
|
||||
|
||||
## [1.0~ynh2](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/39) - 2019-05-26
|
||||
|
||||
#### Changed
|
||||
- [Normalization from example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/39/commits/cccc014552bf85fc682d1fc59e1b9c67ad8ec6f8)
|
||||
|
||||
|
||||
## [1.0~ynh1](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/34) - 2019-03-22
|
||||
|
||||
#### Added
|
||||
- [Add progression with ynh_print_info](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/34/commits/8c2f9fa5c7a6ab90ebbbee4eb4b82ed2be6ee292)
|
||||
|
||||
#### Changed
|
||||
- [Normalization from example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/34/commits/034e5fc83c8515d2a7781548600ab82b44c8611b)
|
||||
- [Use php7](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/34/commits/0f0bef3b8ca06d8f36f3de90c3502c529a6bc280)
|
||||
|
||||
|
||||
## [1.0](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/31) - 2019-03-13
|
||||
|
||||
#### Changed
|
||||
- [Apply example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/31)
|
|
@ -87,143 +87,6 @@ ynh_maintenance_mode_OFF () {
|
|||
systemctl reload nginx
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
# Create a changelog for an app after an upgrade from the file CHANGELOG.md.
|
||||
#
|
||||
# usage: ynh_app_changelog [--format=markdown/html/plain] [--output=changelog_file] --changelog=changelog_source]
|
||||
# | arg: -f --format= - Format in which the changelog will be printed
|
||||
# markdown: Default format.
|
||||
# html: Turn urls into html format.
|
||||
# plain: Plain text changelog
|
||||
# | arg: -o --output= - Output file for the changelog file (Default ./changelog)
|
||||
# | arg: -c --changelog= - CHANGELOG.md source (Default ../CHANGELOG.md)
|
||||
#
|
||||
# The changelog is printed into the file ./changelog and ./changelog_lite
|
||||
ynh_app_changelog () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=foc
|
||||
declare -Ar args_array=( [f]=format= [o]=output= [c]=changelog= )
|
||||
local format
|
||||
local output
|
||||
local changelog
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
format=${format:-markdown}
|
||||
output=${output:-changelog}
|
||||
changelog=${changelog:-../CHANGELOG.md}
|
||||
|
||||
local original_changelog="$changelog"
|
||||
local temp_changelog="changelog_temp"
|
||||
local final_changelog="$output"
|
||||
|
||||
if [ ! -n "$original_changelog" ]
|
||||
then
|
||||
echo "No changelog available..." > "$final_changelog"
|
||||
echo "No changelog available..." > "${final_changelog}_lite"
|
||||
return 0
|
||||
fi
|
||||
|
||||
#REMOVEME? local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version")
|
||||
local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version")
|
||||
|
||||
# Get the line of the version to update to into the changelog
|
||||
local update_version_line=$(grep --max-count=1 --line-number "^## \[$update_version" "$original_changelog" | cut -d':' -f1)
|
||||
# If there's no entry for this version yet into the changelog
|
||||
# Get the first available version
|
||||
if [ -z "$update_version_line" ]
|
||||
then
|
||||
update_version_line=$(grep --max-count=1 --line-number "^##" "$original_changelog" | cut -d':' -f1)
|
||||
fi
|
||||
|
||||
# Get the length of the complete changelog.
|
||||
local changelog_length=$(wc --lines "$original_changelog" | awk '{print $1}')
|
||||
# Cut the file before the version to update to.
|
||||
tail --lines=$(( $changelog_length - $update_version_line + 1 )) "$original_changelog" > "$temp_changelog"
|
||||
|
||||
# Get the length of the troncated changelog.
|
||||
changelog_length=$(wc --lines "$temp_changelog" | awk '{print $1}')
|
||||
# Get the line of the current version into the changelog
|
||||
# Keep only the last line found
|
||||
local current_version_line=$(grep --line-number "^## \[$current_version" "$temp_changelog" | cut -d':' -f1 | tail --lines=1)
|
||||
# If there's no entry for this version into the changelog
|
||||
# Get the last available version
|
||||
if [ -z "$current_version_line" ]
|
||||
then
|
||||
current_version_line=$(grep --line-number "^##" "$original_changelog" | cut -d':' -f1 | tail --lines=1)
|
||||
fi
|
||||
# Cut the file before the current version.
|
||||
# Then grep the previous version into the changelog to get the line number of the previous version
|
||||
local previous_version_line=$(tail --lines=$(( $changelog_length - $current_version_line )) \
|
||||
"$temp_changelog" | grep --max-count=1 --line-number "^## " | cut -d':' -f1)
|
||||
# If there's no previous version into the changelog
|
||||
# Go until the end of the changelog
|
||||
if [ -z "$previous_version_line" ]
|
||||
then
|
||||
previous_version_line=$changelog_length
|
||||
fi
|
||||
|
||||
# Cut the file after the previous version to keep only the changelog between the current version and the version to update to.
|
||||
head --lines=$(( $current_version_line + $previous_version_line - 1 )) "$temp_changelog" | tee "$final_changelog"
|
||||
|
||||
if [ "$format" = "html" ]
|
||||
then
|
||||
# Replace markdown links by html links
|
||||
ynh_replace_string --match_string="\[\(.*\)\](\(.*\)))" --replace_string="<a href=\"\2\">\1</a>)" --target_file="$final_changelog"
|
||||
ynh_replace_string --match_string="\[\(.*\)\](\(.*\))" --replace_string="<a href=\"\2\">\1</a>" --target_file="$final_changelog"
|
||||
elif [ "$format" = "plain" ]
|
||||
then
|
||||
# Change title format.
|
||||
ynh_replace_string --match_string="^##.*\[\(.*\)\](\(.*\)) - \(.*\)$" --replace_string="## \1 (\3) - \2" --target_file="$final_changelog"
|
||||
# Change modifications lines format.
|
||||
ynh_replace_string --match_string="^\([-*]\).*\[\(.*\)\]\(.*\)" --replace_string="\1 \2 \3" --target_file="$final_changelog"
|
||||
fi
|
||||
# else markdown. As the file is already in markdown, nothing to do.
|
||||
|
||||
# Keep only important changes into the changelog
|
||||
# Remove all minor changes
|
||||
sed '/^-/d' "$final_changelog" > "${final_changelog}_lite"
|
||||
# Remove all blank lines (to keep a clear workspace)
|
||||
sed --in-place '/^$/d' "${final_changelog}_lite"
|
||||
# Add a blank line at the end
|
||||
echo "" >> "${final_changelog}_lite"
|
||||
|
||||
# Clean titles if there's no significative changes
|
||||
local line
|
||||
local previous_line=""
|
||||
while read line <&3
|
||||
do
|
||||
if [ -n "$previous_line" ]
|
||||
then
|
||||
# Remove the line if it's a title or a blank line, and the previous one was a title as well.
|
||||
if ( [ "${line:0:1}" = "#" ] || [ ${#line} -eq 0 ] ) && [ "${previous_line:0:1}" = "#" ]
|
||||
then
|
||||
ynh_replace_special_string --match_string="${previous_line//[/.}" --replace_string="" --target_file="${final_changelog}_lite"
|
||||
fi
|
||||
fi
|
||||
previous_line="$line"
|
||||
done 3< "${final_changelog}_lite"
|
||||
|
||||
# Remove all blank lines again
|
||||
sed --in-place '/^$/d' "${final_changelog}_lite"
|
||||
|
||||
# Restore changelog format with blank lines
|
||||
ynh_replace_string --match_string="^##.*" --replace_string="\n\n&\n" --target_file="${final_changelog}_lite"
|
||||
# Remove the 2 first blank lines
|
||||
sed --in-place '1,2d' "${final_changelog}_lite"
|
||||
# Add a blank line at the end
|
||||
echo "" >> "${final_changelog}_lite"
|
||||
|
||||
# If changelog are empty, add an info
|
||||
if [ $(wc --words "$final_changelog" | awk '{print $1}') -eq 0 ]
|
||||
then
|
||||
echo "No changes from the changelog..." > "$final_changelog"
|
||||
fi
|
||||
if [ $(wc --words "${final_changelog}_lite" | awk '{print $1}') -eq 0 ]
|
||||
then
|
||||
echo "No significative changes from the changelog..." > "${final_changelog}_lite"
|
||||
fi
|
||||
}
|
||||
|
||||
ynh_system_user_add_group() {
|
||||
# Declare an array to define the options of this helper.
|
||||
|
|
|
@ -35,7 +35,6 @@ ynh_app_setting_set --app=$app --key=ssh_port --value=$ssh_port
|
|||
ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql
|
||||
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
||||
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
|
||||
ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
|
@ -101,12 +100,9 @@ mkdir -p "$install_dir/www"
|
|||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
then
|
||||
|
||||
ynh_add_config --template="../sources/www/index.html" --destination="$install_dir/www/index.html"
|
||||
|
||||
else
|
||||
# Copy files to the right place
|
||||
cp "../sources/www/index_no_sftp.html" "$install_dir/www/index.html"
|
||||
ynh_add_config --template="../sources/www/index_no_sftp.html" --destination="$install_dir/www/index.html"
|
||||
fi
|
||||
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Custom Web App</title>
|
||||
<title>My_Webapp</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>It works!</h1>
|
||||
<p>Congratulation, you have just installed your custom web app.</p>
|
||||
<p>Congratulation, you have just installed My_Webapp.</p>
|
||||
|
||||
<h2>Edit this site</h2>
|
||||
<p>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Custom Web App</title>
|
||||
<title>My_Webapp</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>It works!</h1>
|
||||
<p>Congratulation, you have just installed your custom web app.</p>
|
||||
<p>Congratulation, you have just installed your My_webapp.</p>
|
||||
|
||||
<h2>Edit this site</h2>
|
||||
<p>
|
||||
|
|
Loading…
Add table
Reference in a new issue