chore: update rename script + info.xml

This commit is contained in:
2025-09-20 11:00:03 +03:00
parent 46ebcca925
commit 80300f3b68
2 changed files with 25 additions and 21 deletions

View File

@@ -6,22 +6,9 @@
-->
<id>nextcloudapptemplate</id>
<name>Nextcloud App Template</name>
<summary>Automatically fills the currency rates for your Cospend projects daily.</summary>
<summary>Enter your app summary here.</summary>
<description><![CDATA[
This NextCloud app automatically fetches currency information for your Cospend projects, and fills
them up using the main currency as base. No more manually updating exchange rates!
It will automatically run once a day by default and use your currency names to fetch the correct
rate.
Interval for fetch may be adjusted in the admin settings "Auto Currency" section.
> **Note**: This is a companion app to [Cospend](https://apps.nextcloud.com/apps/cospend).
>
> Without Cospend, this app will not work.
Enter your app description here.
]]></description>
<version>1.0.0</version>
<licence>agpl</licence>

View File

@@ -14,7 +14,12 @@
set -euo pipefail
# --- Resolve absolute path to this script (portable) ---
abs_path() { perl -MCwd=abs_path -e 'print abs_path(shift)' "$1"; }
SCRIPT_ABS="$(abs_path "$0")"
SOURCE_PACKAGE="${SOURCE_PACKAGE:-nextcloudapptemplate}"
SOURCE_APPNAME="${SOURCE_APPNAME:-Nextcloud App Template}"
SOURCE_PASCAL="${SOURCE_PASCAL:-NextcloudAppTemplate}"
SOURCE_USER="${SOURCE_USER:-your-user}"
SOURCE_FULL="${SOURCE_FULL:-Your Name}"
@@ -23,9 +28,11 @@ SOURCE_WEBSITE="${SOURCE_WEBSITE:-https://your.website}"
printf "Enter package name (e.g., mynextcloudapp): "
IFS= read PACKAGE
printf "Enter app name (e.g., My Nextcloud App): "
IFS= read APPNAME
printf "Enter PascalCase name (e.g., MyNextcloudApp): "
IFS= read PASCAL
printf "Enter username (e.g., myUsername): "
printf "Enter GitHub username (e.g., myUsername): "
IFS= read DEST_USER
printf "Enter full name (e.g., My Full Name): "
IFS= read DEST_FULL
@@ -34,13 +41,14 @@ IFS= read DEST_EMAIL
printf "Enter website (e.g., https://mywebsite.com): "
IFS= read DEST_WEBSITE
if [[ -z "${PACKAGE}" || -z "${PASCAL}" || -z "${DEST_USER}" || -z "${DEST_FULL}" || -z "${DEST_EMAIL}" || -z "${DEST_WEBSITE}" ]]; then
if [[ -z "${PACKAGE}" || -z "${APPNAME}" || -z "${PASCAL}" || -z "${DEST_USER}" || -z "${DEST_FULL}" || -z "${DEST_EMAIL}" || -z "${DEST_WEBSITE}" ]]; then
echo "All values are required." >&2
exit 1
fi
echo "Replacing:"
echo " ${SOURCE_PACKAGE} -> ${PACKAGE}"
echo " ${SOURCE_APPNAME} -> ${APPNAME}"
echo " ${SOURCE_PASCAL} -> ${PASCAL}"
echo " ${SOURCE_USER} -> ${DEST_USER}"
echo " ${SOURCE_FULL} -> ${DEST_FULL}"
@@ -71,12 +79,18 @@ done
unset 'PRUNE_EXPR[${#PRUNE_EXPR[@]}-1]'
# Export for Perl
export PACKAGE PASCAL DEST_USER DEST_FULL SOURCE_PACKAGE SOURCE_PASCAL SOURCE_USER SOURCE_FULL SOURCE_EMAIL DEST_EMAIL SOURCE_WEBSITE DEST_WEBSITE
export PACKAGE PASCAL DEST_USER DEST_FULL SOURCE_PACKAGE SOURCE_PASCAL SOURCE_USER SOURCE_FULL SOURCE_EMAIL DEST_EMAIL SOURCE_WEBSITE DEST_WEBSITE SOURCE_APPNAME APPNAME
# Iterate files safely (null-delimited), skip binaries, replace in place with perl
while IFS= read -r -d '' file; do
[[ -f "$file" ]] || continue
# Skip this script itself
FILE_ABS="$(abs_path "$file")"
if [[ "$FILE_ABS" == "$SCRIPT_ABS" ]]; then
continue
fi
# Skip binary files
if ! LC_ALL=C grep -Iq . "$file"; then
continue
@@ -87,6 +101,7 @@ while IFS= read -r -d '' file; do
perl -0777 -i.bak -pe '
BEGIN {
$src_k = $ENV{SOURCE_PACKAGE};
$src_a = $ENV{SOURCE_APPNAME};
$src_p = $ENV{SOURCE_PASCAL};
$src_u = $ENV{SOURCE_USER};
$src_f = $ENV{SOURCE_FULL};
@@ -94,6 +109,7 @@ while IFS= read -r -d '' file; do
$src_w = $ENV{SOURCE_WEBSITE};
$dst_k = $ENV{PACKAGE};
$dst_a = $ENV{APPNAME};
$dst_p = $ENV{PASCAL};
$dst_u = $ENV{DEST_USER};
$dst_f = $ENV{DEST_FULL};
@@ -101,6 +117,7 @@ while IFS= read -r -d '' file; do
$dst_w = $ENV{DEST_WEBSITE};
}
s/\Q$src_k\E/$dst_k/g;
s/\Q$src_a\E/$dst_a/g;
s/\Q$src_p\E/$dst_p/g;
s/\Q$src_u\E/$dst_u/g;
s/\Q$src_f\E/$dst_f/g;