feat: removed the SMC plugin from the Kit framework. Compile from SMC where needed.

This commit is contained in:
Serhiy Mytrovtsiy
2021-06-07 22:55:17 +02:00
parent 138dbc1171
commit c55d313d72
8 changed files with 214 additions and 673 deletions

45
Kit/scripts/i18n.py Normal file
View File

@@ -0,0 +1,45 @@
import os
import sys
PATH = os.getcwd()+"/Stats/Supporting Files/"
def get_keys(list):
arr = []
for el in list:
if el.startswith("//") or len(el) == 0 or el == "\n":
continue
key = el.replace("\n", "").split(" = ")[0].replace('"', "")
arr.append(key)
return arr
def main():
en_file = open(f"{PATH}/en.lproj/Localizable.strings", "r").readlines()
if en_file == None:
sys.exit("English language not found.")
en_count = len(en_file)
en_keys = get_keys(en_file)
if len(en_keys) == 0:
sys.exit("No English keys found.")
languages = list(filter(lambda x: x.endswith(".lproj"), os.listdir(PATH)))
for lang in languages:
file = open(f"{PATH}/{lang}/Localizable.strings", "r").readlines()
count = len(file)
name = lang.replace(".lproj", "")
keys = get_keys(file)
if len(keys) == 0:
sys.exit(f"No {name} keys found.")
if count != en_count:
print(f"`{lang}` has different number of lines ({count}) than English ({en_count})\n")
for i, el in enumerate(en_keys):
if el != keys[i]:
sys.exit(f"line {i}: en=`{el}`; {name}=`{keys[i]}`\n")
print(f"All fine, found {en_count} lines in {len(languages)} languages.")
if __name__ == "__main__":
main()

37
Kit/scripts/updater.sh Normal file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
DMG_PATH="$HOME/Downloads/Stats.dmg"
MOUNT_PATH="/tmp/Stats"
APPLICATION_PATH="/Applications/"
STEP=""
while [[ "$#" > 0 ]]; do case $1 in
-s|--step) STEP="$2"; shift;;
-d|--dmg) DMG_PATH="$2"; shift;;
-a|--app) APPLICATION_PATH="$2"; shift;;
-m|--mount) MOUNT_PATH="$2"; shift;;
*) echo "Unknown parameter passed: $1"; exit 1;;
esac; shift; done
if [[ "$STEP" == "2" ]]; then
rm -rf $APPLICATION_PATH/Stats.app
cp -rf $MOUNT_PATH/Stats.app $APPLICATION_PATH/Stats.app
$APPLICATION_PATH/Stats.app/Contents/MacOS/Stats --dmg "$DMG_PATH"
echo "New version started"
elif [[ "$STEP" == "3" ]]; then
/usr/bin/hdiutil detach "$MOUNT_PATH"
/bin/rm -rf "$MOUNT_PATH"
/bin/rm -rf "$DMG_PATH"
echo "Done"
else
rm -rf $APPLICATION_PATH/Stats.app
cp -rf $MOUNT_PATH/Stats.app $APPLICATION_PATH/Stats.app
$APPLICATION_PATH/Stats.app/Contents/MacOS/Stats --dmg-path "$DMG_PATH" --mount-path "$MOUNT_PATH"
echo "New version started"
fi