-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- See #3.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#! /bin/bash | ||
|
||
sdd_install() { | ||
local version=$1 | ||
local package=shellcheck-$version | ||
local archive=$package.linux.x86_64.tar.xz | ||
|
||
wget -P /tmp https://shellcheck.storage.googleapis.com/$archive | ||
cd /tmp | ||
tar xf $archive | ||
|
||
mv $package/shellcheck "$SDD_INSTALL_PREFIX"/bin | ||
|
||
rm -rf $archive $package | ||
} | ||
|
||
sdd_uninstall() { | ||
rm -v "$SDD_INSTALL_PREFIX"/bin/shellcheck | ||
} | ||
|
||
sdd_fetch_latest_version() { | ||
_name_of_latest_github_tag koalaman shellcheck | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
load '/usr/local/libexec/bats-support/load.bash' | ||
load '/usr/local/libexec/bats-assert/load.bash' | ||
|
||
@test "shellcheck of recent version can be installed and uninstalled" { | ||
run sdd install shellcheck | ||
assert_success | ||
assert_line -n 0 -p 'Latest version available: ' | ||
assert_output -p 'Installed "shellcheck".' | ||
|
||
run shellcheck --version | ||
[ $status -eq 0 ] | ||
|
||
run sdd uninstall shellcheck | ||
[ $status -eq 0 ] | ||
[ "${lines[-1]}" = 'Uninstalled "shellcheck".' ] | ||
|
||
run which shellcheck | ||
[ $status -eq 1 ] | ||
} |