Skip to content

Commit

Permalink
Merge pull request #51 from lucymhdavies/no-more-mas-account
Browse files Browse the repository at this point in the history
Permanently skip `mas account` check
  • Loading branch information
skylarmacdonald authored Dec 30, 2024
2 parents af5b25c + 75d4603 commit 9df2f54
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 34 deletions.
6 changes: 3 additions & 3 deletions test/type-file.bats
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ setup () {
@test "file compile: echoes base64 representation to screen" {
run file compile path/to/target Readme.md
[ "$status" -eq 0 ]
expected="borkfiles__UmVhZG1lLm1kCg=\"$(base64 Readme.md)\""
expected="borkfiles__UmVhZG1lLm1kCg=\"$(cat Readme.md | base64)\""
accum="${lines[2]}"
line=2
while [ "$line" -lt ${#lines[*]} ]; do
Expand All @@ -139,15 +139,15 @@ is_compiled () { [ -n "$is_compiled" ]; }

@test "file status: if compiled, uses stored variable" {
is_compiled=1
borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(base64 Readme.md)"
borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(cat Readme.md | base64)"
respond_to "$(md5cmd $platform path/to/target)" "echo $readsum"
run file status path/to/target path/from/source
[ "$status" -eq $STATUS_OK ]
}

@test "file install: if compiled, uses stored variable" {
is_compiled=1
borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(base64 Readme.md)"
borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(cat Readme.md | base64)"
run file install path/to/target path/from/source
[ "$status" -eq $STATUS_OK ]
run baked_output
Expand Down
21 changes: 0 additions & 21 deletions test/type-mas.bats
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,6 @@ setup () {
[ "$status" -eq $STATUS_FAILED_PRECONDITION ]
}

@test "mas status: returns FAILED_PRECONDITION when logged out" {
respond_to "mas account" "return 1"
respond_to "uname -r" "echo 20.0.0"
run mas status 497799835 Xcode
[ "$status" -eq $STATUS_FAILED_PRECONDITION ]
}

@test "mas status: does not return FAILED_PRECONDITION when mas account fails on macOS >= 12" {
respond_to "mas account" "return 1"
respond_to "uname -r" "echo 21.4.0"
run mas status 497799835 Xcode
[ "$status" -eq $STATUS_OK ]
}

@test "mas status: does not return FAILED_PRECONDITION when mas account fails on macOS >= 13" {
respond_to "mas account" "return 1"
respond_to "uname -r" "echo 22.2.0"
run mas status 497799835 Xcode
[ "$status" -eq $STATUS_OK ]
}

@test "mas status: returns MISSING when app not installed" {
run mas status 477670270 2Do
[ "$status" -eq $STATUS_MISSING ]
Expand Down
10 changes: 0 additions & 10 deletions types/mas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ case $action in
status)
baking_platform_is "Darwin" || return $STATUS_UNSUPPORTED_PLATFORM
needs_exec "mas" || return $STATUS_FAILED_PRECONDITION
bake mas account
# Workaround for mas account failing on macOS >= 12 (i.e. Darwin >= 21)
# https://github.com/borksh/bork/issues/42
if [ "$?" -gt 0 ]; then
release=$(get_baking_platform_release)
str_matches "$release" "^21\." || \
str_matches "$release" "^22\." || \
str_matches "$release" "^23\." || \
return $STATUS_FAILED_PRECONDITION
fi
bake mas list | grep -E "^$appid" > /dev/null
[ "$?" -gt 0 ] && return $STATUS_MISSING
bake mas outdated | grep -E "^$appid" > /dev/null
Expand Down

0 comments on commit 9df2f54

Please sign in to comment.