I added test suites for our bash code that run on bats. There's a helper library in tests/bash/helpers.bash with extensions so you can do nice things like:
Also added is bash linting via shellcheck. There's a commented .shellcheckrc file for anyone who wants to use those same settings in their editor.
Changes
I totally abandoned any attempted usage of sudo. It's just too scary. Instead the installer checks write perms on all known paths for and bails out very early on if there's a problem.
[2019-06-25 16:34:36] [error] Could not verify the minimum installation requirements for your system
[2019-06-25 16:34:36] [error] BINARY_PATH errors:
[2019-06-25 16:34:36] [error] * binary path (/root/local/bin/northstack) does not exist, and its parent (/root) is not writable.
[2019-06-25 16:34:36] [error] * File: /root
[2019-06-25 16:34:36] [error] * Type: directory
[2019-06-25 16:34:36] [error] * Mode: (550 / dr-xr-x---)
[2019-06-25 16:34:36] [error] * Owner: (0 / root)
[2019-06-25 16:34:36] [error] * Group: (0 / root)
[2019-06-25 16:34:36] [error] LIBRARY_PATH errors:
[2019-06-25 16:34:36] [error] * library path (/root/local/northstack) does not exist, and its parent (/root) is not writable.
[2019-06-25 16:34:36] [error] * File: /root
[2019-06-25 16:34:36] [error] * Type: directory
[2019-06-25 16:34:36] [error] * Mode: (550 / dr-xr-x---)
[2019-06-25 16:34:36] [error] * Owner: (0 / root)
[2019-06-25 16:34:36] [error] * Group: (0 / root)
We're still using helper functions for most file operations (i.e. cp, rm, ln, etc) because they run things by a helper function assertSafePath just to sanity check.
What remains
At this point I still need to spend some time testing on Mac to sort out the GNU vs BSD coreutils madness.
New things
Changes
sudo
. It's just too scary. Instead the installer checks write perms on all known paths for and bails out very early on if there's a problem.cp
,rm
,ln
, etc) because they run things by a helper function assertSafePath just to sanity check.What remains
At this point I still need to spend some time testing on Mac to sort out the GNU vs BSD coreutils madness.