Skip to content

Commit

Permalink
Improve dmg creation script and minor correction
Browse files Browse the repository at this point in the history
  • Loading branch information
davbeek committed Sep 21, 2024
1 parent c225f50 commit 569983b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
34 changes: 21 additions & 13 deletions scripts/app-dmg.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,36 @@ PLATFORM=$(uname -m)
TARGET_DIR_FILE=$ROOT_DIR/scripts/app-dmg-target-dir.txt
DMG_FILE=GitinspectorGUI.dmg

# Read the version from the version.txt file
VERSION="$(<$ROOT_DIR/src/gigui/version.txt)"

# Define the name of the .dmg file based on the platform and add version number
if [ "$PLATFORM" = "x86_64" ]; then
DMG_PLATFORM_FILE="GitinspectorGUI-Intel-$VERSION.dmg"
else
DMG_PLATFORM_FILE="GitinspectorGUI-AppleSilicon-$VERSION.dmg"
fi

cd $ROOT_DIR/app && {
if [ -e $TARGET_DIR_FILE ]; then
APP_TARGET_DIR="$(<$TARGET_DIR_FILE)/"
else
APP_TARGET_DIR=""
fi
# Read the target directory from the file
APP_TARGET_DIR="$(<$TARGET_DIR_FILE)"

# Use (e) flag to expand environment variables in APP_TARGET_DIR
APP_TARGET_DIR="${(e)APP_TARGET_DIR}"

# Create the .dmg file using hdiutil
hdiutil create -volname "GitinspectorGUI" -srcfolder "GitinspectorGUI.app" -ov -format UDZO "$DMG_FILE"

if [ "$PLATFORM" = "x86_64" ]; then
TARGET="${APP_TARGET_DIR}GitinspectorGUI-Intel-$VERSION.dmg"
else
TARGET="${APP_TARGET_DIR}GitinspectorGUI-AppleSilicon-$VERSION.dmg"
hdiutil create -volname "GitinspectorGUI" -srcfolder "GitinspectorGUI.app" \
-ov -format UDZO "$DMG_PLATFORM_FILE"

if [ -e "$TARGET_DIR_FILE" ]; then
if [ -d "$APP_TARGET_DIR" ]; then
cp $DMG_PLATFORM_FILE "$APP_TARGET_DIR"
echo Copied dmg to: "$APP_TARGET_DIR"
else
echo "Error: The target directory $APP_TARGET_DIR does not exist."
exit 1
fi
fi
mv GitinspectorGUI.dmg "$TARGET"
echo Moved dmg to: "$TARGET"
} || {
# No error message needed, because cd will output an error message when it fails
exit 1
Expand Down
2 changes: 1 addition & 1 deletion src/gigui/gitinspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def logfile(fname: FileStr):
formats = args.format

if not repo.authors_included or not formats:
return files_to_log, file_to_open, ("", "")
return [], "", ("", "")

base_name = Path(outfile_base).name
if args.fix == Keys.prefix:
Expand Down

0 comments on commit 569983b

Please sign in to comment.