Skip to content

Commit

Permalink
changed name of executable to archive_fusionvm
Browse files Browse the repository at this point in the history
Also updated readme
  • Loading branch information
NReilingh committed Dec 28, 2019
1 parent 958e962 commit 543cbcd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v1
- name: Package
run: tar -cvzf archive-fusionvm-${{ steps.get_version.outputs.VERSION }}.tar.gz archive_vms.zsh
run: tar -cvzf archive-fusionvm-${{ steps.get_version.outputs.VERSION }}.tar.gz archive_fusionvm
- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
This is a zsh script for macOS Catalina and VMware Fusion
that suspends and archives a folder of VMs to dmg.

## Installation

brew install nreilingh/nreilingh/archive-fusionvm

## Usage

archive_fusionvm path/to/folder/containing/.vmwarevm_files/ desired/output_file.dmg

## Contributing

This code has unit tests! Get ZUnit with `brew install zunit`
and then run `zunit` in the project directory to test.

File renamed without changes.
22 changes: 11 additions & 11 deletions tests/archive_vms.zunit → tests/archive_fusionvm.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
}

@test 'Exit with error when no arguments are supplied' {
run archive_vms.zsh
run archive_fusionvm

assert $state equals 3
}

@test 'Exit with error when no second argument is supplied' {
run archive_vms.zsh $TEMP/decoy_dir
run archive_fusionvm $TEMP/decoy_dir

assert $state equals 3
}

@test 'Exit with error when first argument path does not exist' {
run archive_vms.zsh /zxcvbn/foo/bar/baz/bluth $TEMP/out.dmg
run archive_fusionvm /zxcvbn/foo/bar/baz/bluth $TEMP/out.dmg

assert $state equals 3
}

@test 'First argument relative path is expanded to absolute path' {
# $RELTEMP is also set up in bootstrap
run archive_vms.zsh $RELTEMP/decoy_dir $TEMP/out.dmg
run archive_fusionvm $RELTEMP/decoy_dir $TEMP/out.dmg

# Filter run output to line that begins with SRCPATH.
srcpath=(${(M)lines:#SRCPATH*})
Expand All @@ -40,7 +40,7 @@
}

@test 'Exit with error when first argument path is a file' {
run archive_vms.zsh $TEMP/decoy_file $TEMP/out.dmg
run archive_fusionvm $TEMP/decoy_file $TEMP/out.dmg

assert $state equals 3
}
Expand All @@ -57,7 +57,7 @@
$bogusvm
EOF

run archive_vms.zsh $TEMP/decoy_dir $TEMP/out.dmg
run archive_fusionvm $TEMP/decoy_dir $TEMP/out.dmg

# Suspend calls are logged to file; read as array.
suspendout=(${(@f)"$(<$TEMP/vmrun_suspend.calls)"})
Expand All @@ -71,7 +71,7 @@
cat > $TEMP/vmrun_list_1 <<-EOF
EOF

run archive_vms.zsh $TEMP/decoy_dir $TEMP/out.dmg
run archive_fusionvm $TEMP/decoy_dir $TEMP/out.dmg

if [ -f $TEMP/vmrun_suspend.calls ]; then
fail 'vmrun suspend was called'
Expand All @@ -88,7 +88,7 @@
$TEMP/decoy_dir/examplevm.vmx
EOF

run archive_vms.zsh $TEMP/decoy_dir $TEMP/out.dmg
run archive_fusionvm $TEMP/decoy_dir $TEMP/out.dmg

suspendcalls=(${(@f)"$(<$TEMP/vmrun_suspend.calls)"})

Expand All @@ -104,7 +104,7 @@
$TEMP/decoy_dir/examplevm.vmx
EOF

run archive_vms.zsh $TEMP/decoy_dir $TEMP/out.dmg
run archive_fusionvm $TEMP/decoy_dir $TEMP/out.dmg

assert $state equals 4
if [ -f $TEMP/hdiutil.calls ]; then
Expand All @@ -115,7 +115,7 @@
}

@test 'hdiutil create is executed' {
run archive_vms.zsh $TEMP/decoy_dir $TEMP/out.dmg
run archive_fusionvm $TEMP/decoy_dir $TEMP/out.dmg

assert "$TEMP/hdiutil.calls" exists
}
Expand All @@ -124,7 +124,7 @@
arg1=$TEMP/decoy_dir
arg2=$TEMP/out.dmg

run archive_vms.zsh $arg1 $arg2
run archive_fusionvm $arg1 $arg2

# hdiutil mock outputs calls to file; read args as array
hdiutilout=(${(@f)"$(<$TEMP/hdiutil.calls)"})
Expand Down

0 comments on commit 543cbcd

Please sign in to comment.