Skip to content

Commit

Permalink
Add shellcheck app management file
Browse files Browse the repository at this point in the history
- See #3.
  • Loading branch information
pylipp committed Jan 6, 2020
1 parent b04bfcd commit ec8341b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/sdd/apps/user/shellcheck
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
}
19 changes: 19 additions & 0 deletions test/apps/shellcheck.bats
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 ]
}

0 comments on commit ec8341b

Please sign in to comment.