Skip to content

Commit

Permalink
refactor: move state files to root
Browse files Browse the repository at this point in the history
  • Loading branch information
filipe1309 committed Jan 3, 2022
1 parent 6eb39ca commit 9324d69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .shub/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ echo ""

.shub/self-update.sh && exit 0

if [ -f ".shub/.shub-state.ini" ]; then
source .shub/.shub-state.ini
source .shub/.shub-state-variables.ini
if [ -f ".shub-state.ini" ]; then
source .shub-state.ini
source .shub-state-variables.ini
echo -e "${YELLOW}⚠️ State file founded!${NC}"

read -r -p "Do you want to use state file at step $(echo -e $GREEN"$STATE"$NC) [$(echo -e $GREEN"Y"$NC)/n]? " response
Expand Down Expand Up @@ -236,7 +236,7 @@ if test $STATE -lt 6; then
git checkout -b $GIT_BRANCH_NEXT_CLASS_LW
fi

if [ -f ".shub/.shub-state.ini" ]; then
if [ -f ".shub-state.ini" ]; then
flush_state
fi

Expand Down
10 changes: 5 additions & 5 deletions .shub/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ confirm() {
if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
echo -e "${GREEN}Ok =)${NC}"
else
if [ -f ".shub/.shub-state.ini" ]; then
if [ -f ".shub-state.ini" ]; then
flush_state
fi
exit 0;
Expand Down Expand Up @@ -82,14 +82,14 @@ array_contains () {
}

save_state_var() {
echo "$1=\"$2\"" >> .shub/.shub-state-variables.ini
echo "$1=\"$2\"" >> .shub-state-variables.ini
}

commit_state() {
echo "STATE=\"$1\"" > .shub/.shub-state.ini
echo "STATE=\"$1\"" > .shub-state.ini
}

flush_state() {
rm .shub/.shub-state.ini
rm .shub/.shub-state-variables.ini
rm .shub-state.ini
rm .shub-state-variables.ini
}

0 comments on commit 9324d69

Please sign in to comment.