meta: script handles spaces now
This commit is contained in:
parent
e2a45d9d30
commit
2f77a3d364
@ -6,19 +6,20 @@ S3_BUCKET="https://dl.breadone.xyz/cask" # prod
|
||||
# S3_BUCKET="https://dl.breadone.xyz/homebrew/casks" # staging
|
||||
|
||||
# get reported version of app, remove quotes, print just the version
|
||||
version=$(mdls -name kMDItemVersion $APP_FILE | tr -d '"' | awk '{print $3}')
|
||||
version=$(mdls -name kMDItemVersion "$APP_FILE" | tr -d '"' | awk '{print $3}')
|
||||
|
||||
# just the app file name, eg Things3.app
|
||||
FILENAME=$(basename $APP_FILE)
|
||||
FILENAME=$(basename "$APP_FILE")
|
||||
|
||||
# remove extension, eg Things3
|
||||
APP_NAME="${FILENAME%.app}"
|
||||
APPNAME="${FILENAME%.app}"
|
||||
APPNAME_TRIM=$(echo $APPNAME | sed 's/^[^=]*= //; s/"//g' | tr ' ' '-') # replace spaces with dashes
|
||||
|
||||
# interpolate to final zip name, eg Things3-3.12.5.zip
|
||||
ZIP_PATH="$APP_NAME-$version.zip"
|
||||
ZIP_PATH="$APPNAME_TRIM-$version.zip"
|
||||
|
||||
# Compress the file
|
||||
ditto -c -k --sequesterRsrc --keepParent $APP_FILE $ZIP_PATH
|
||||
ditto -c -k --sequesterRsrc --keepParent "$APP_FILE" $ZIP_PATH
|
||||
|
||||
# Get hash of file
|
||||
hash=$(sha256 $ZIP_PATH | awk '{ print $4 }')
|
||||
@ -29,14 +30,16 @@ curl -X PUT "$S3_BUCKET/$ZIP_PATH" \
|
||||
--data-binary "@$ZIP_PATH"
|
||||
|
||||
# output (mostly complete) cask file
|
||||
echo 'cask "'$(echo "$APP_NAME" | tr '[:upper:]' '[:lower:]')'" do' # lowercase appname
|
||||
echo 'cask "'$(echo "$APPNAME_TRIM" | tr '[:upper:]' '[:lower:]')'" do' # lowercase appname
|
||||
echo ' version "'$version'"'
|
||||
echo ' sha256 "'$hash'"'
|
||||
echo ''
|
||||
echo ' url "'$S3_BUCKET/$ZIP_PATH'"'
|
||||
echo ' name "'$APP_NAME'"'
|
||||
echo ' name "'$APPNAME'"'
|
||||
echo ' desc "ENTER_DESCRIPTION"'
|
||||
echo ' homepage "ENTER_HOMEPAGE"'
|
||||
echo ''
|
||||
echo ' app "'$FILENAME'"'
|
||||
echo 'end'
|
||||
echo 'end'
|
||||
|
||||
rm $ZIP_PATH
|
Loading…
x
Reference in New Issue
Block a user