Skip to content

Commit

Permalink
fix minor bugs in ./debug.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
sakithb committed Dec 5, 2023
1 parent a276554 commit 1391805
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions debug.sh
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
#! /bin/bash

EXT_DIR="$HOME/.local/share/gnome-shell/extensions/[email protected]/";
EXT_DIR="$HOME/.local/share/gnome-shell/extensions/[email protected]/"

build() {
VERSION=$(cat metadata.json | grep '"version"' | sed 's/[^0-9]*//g');
VERSION=$(cat metadata.json | grep '"version"' | sed 's/[^0-9]*//g')

gnome-extensions pack --podir=po/ --extra-source=dbus.js --extra-source=player.js --extra-source=utils.js --extra-source=widget.js --extra-source=LICENSE

if [[ `git status --porcelain` ]]; then
VERSION="~$VERSION~" ;
if [[ $(git status --porcelain) ]]; then
VERSION="~$VERSION~"
fi

mkdir -p "./builds/v$VERSION";
mv [email protected] "./builds/v$VERSION/extension.zip";
mkdir -p "./builds/v$VERSION"
mv [email protected] "./builds/v$VERSION/extension.zip"
}

copy() {
mkdir -p "$EXT_DIR";
cp -r ./* "$EXT_DIR";
mkdir -p "$EXT_DIR"
cp -r ./* "$EXT_DIR"
}

debug() {
copy;
copy

export MUTTER_DEBUG_DUMMY_MODE_SPECS=1366x768;
dbus-run-session -- gnome-shell --unsafe-mode --nested --wayland
export MUTTER_DEBUG_DUMMY_MODE_SPECS=1366x768
dbus-run-session -- gnome-shell --unsafe-mode --nested --wayland --no-x11
}

update_po_files() {
xgettext --from-code=UTF-8 --output=po/mediacontrols.pot *.js ./schemas/*.xml

cd po

for POFILE in *.po
do
echo "Updating: $POFILE"
msgmerge -U "$POFILE" "mediacontrols.pot"
done
for POFILE in *.po; do
echo "Updating: $POFILE"
msgmerge -U "$POFILE" "mediacontrols.pot"
done

rm *.po~
echo "Done."
}

lint() {
npx eslint -c .eslintrc.yml *.js
npx eslint -c .eslintrc.yml *.js
}

lint_fix() {
npx eslint -c .eslintrc.yml *.js --fix
}

PARAMS=();
PARAMS=()

for i in $@
do
PARAMS+=( $i )
for i in "$@"; do
PARAMS+=($i)
done

if [[ " ${PARAMS[*]} " =~ " -h" ]]; then
echo "Usage: ./debug.sh [options]";
echo "Options:";
echo " -h Show this help message";
echo " -b Build extension";
echo " -u Update extension source files";
echo " -d Debug extension";
echo " -t Update translation po files";
echo " -l Lint codebase (check)";
echo " -f Lint codebase (fix)";
exit;
echo "Usage: ./debug.sh [options]"
echo "Options:"
echo " -h Show this help message"
echo " -b Build extension"
echo " -u Update extension source files"
echo " -d Debug extension"
echo " -t Update translation po files"
echo " -l Lint codebase (check)"
echo " -f Lint codebase (fix)"
exit
fi

if [[ " ${PARAMS[*]} " =~ " -b " ]]; then
build;
build
fi

if [[ " ${PARAMS[*]} " =~ " -d " ]]; then
debug;
debug
fi

if [[ " ${PARAMS[*]} " =~ " -u " ]]; then
copy;
copy
gnome-extensions disable [email protected]
gnome-extensions enable [email protected]
fi

if [[ " ${PARAMS[*]} " =~ " -t " ]]; then
update_po_files;
update_po_files
fi

if [[ " ${PARAMS[*]} " =~ " -l " ]]; then
lint;
lint
fi

if [[ " ${PARAMS[*]} " =~ " -f " ]]; then
lint_fix;
fi
lint_fix
fi

0 comments on commit 1391805

Please sign in to comment.