From a5ea0292f2aa92d619194d228eeee53f36b07023 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Sun, 9 May 2021 19:27:07 +0200 Subject: [PATCH] 1st test --- Makefile | 2 ++ include.sh | 13 +++++++++++++ install.sh | 8 +++++--- specs/astrXbian_spec.sh | 24 ++++++++++++++---------- 4 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 include.sh diff --git a/Makefile b/Makefile index 8be89b1..0cc7de9 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,5 @@ shellcheck-%: shellspec-%: shellspec $* + +~/.zen/secret.june: diff --git a/include.sh b/include.sh new file mode 100644 index 0000000..1811918 --- /dev/null +++ b/include.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +i_am() { + echo 'v0.4' +} + +i_am_root() { + [ $(id -u) -eq 0 ] +} + +i_should_install() { + [[ ! -f ~/.zen/secret.june ]] +} diff --git a/install.sh b/install.sh index 5eeea4b..ea54064 100755 --- a/install.sh +++ b/install.sh @@ -1,13 +1,15 @@ #!/bin/bash +set -x +. ./include.sh ######################################################################## -# Version: 0.3 +# Version: 0.4 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ######################################################################## { -[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1 +i_am_root && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1 # MAIN # -if [[ ! -f ~/.zen/secret.june ]]; +if i_should_install; then # Check requirements diff --git a/specs/astrXbian_spec.sh b/specs/astrXbian_spec.sh index 6e57e6f..f9d3201 100644 --- a/specs/astrXbian_spec.sh +++ b/specs/astrXbian_spec.sh @@ -1,15 +1,19 @@ #shellcheck shell=sh -Describe "AstrXbian" - Describe "install()" - install() { - echo # - } - - It "installs world, but not implemented" - Pending "You should implement install function" - When call install world - The output should eq "amen" +Describe 'AstrXbian' + Describe 'install()' + Include ./include.sh + It 'should be me' + When call i_am + The output should eq 'v0.4' + End + It 'should not be superuser' + When call i_am_root + The status should not be success + End + It 'should install AstrXbian' + When call i_should_install + The status should be success End End End