Skip to content

Commit

Permalink
♻️ REFACTOR: #82 ready for dev-qa
Browse files Browse the repository at this point in the history
  • Loading branch information
apolopena committed Mar 30, 2021
1 parent d208572 commit 4f6ee13
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 68 deletions.
19 changes: 2 additions & 17 deletions bash/before-tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,8 @@
# Gitpod currently does not persist files in the home directory so we must write them
# in everytime the workspace starts. We do this in the -before task in .gitpod.yml

# Log to the console and a file
log () {
if [ -z "$2" ]; then
bash bash/utils.sh log "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log "$1" /var/log/workspace-init.log -e
fi
}

# Log only to a file
log_silent () {
if [ -z "$2" ]; then
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log -e
fi
}
# Load logger
. workspace-init-log.sh

# Rake tasks (will be written to ~/.rake).
# Some rake tasks are dynamic and depend on the configuration in starter.ini
Expand Down
19 changes: 2 additions & 17 deletions bash/init-optional-scaffolding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,8 @@
# Description:
# Installs various packages according to the configuration set in starter.ini

# Log to the console and a file
log () {
if [ -z "$2" ]; then
bash bash/utils.sh log "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log "$1" /var/log/workspace-init.log -e
fi
}

# Log only to a file
log_silent () {
if [ -z "$2" ]; then
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log -e
fi
}
# Load logger
. workspace-init-log.sh

# regexp pattern for checking an array of exit codes
all_zeros_reg='^0$|^0*0$'
Expand Down
19 changes: 2 additions & 17 deletions bash/init-project.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
#!/bin/bash

# Log to the console and a file
log () {
if [ -z "$2" ]; then
bash bash/utils.sh log "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log "$1" /var/log/workspace-init.log -e
fi
}

# Log only to a file
log_silent () {
if [ -z "$2" ]; then
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log -e
fi
}
# Load logger
. workspace-init-log.sh

# BEGIN example code block - migrate database
# COMMENT: Load spinner
Expand Down
19 changes: 2 additions & 17 deletions bash/init-react-example.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
#!/bin/bash

# Log to the console and a file
log () {
if [ -z "$2" ]; then
bash bash/utils.sh log "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log "$1" /var/log/workspace-init.log -e
fi
}

# Log only to a file
log_silent () {
if [ -z "$2" ]; then
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log
else
bash bash/utils.sh log_silent "$1" /var/log/workspace-init.log -e
fi
}
# Load logger
. workspace-init-log.sh

declare -a exit_codes=()
all_zeros='^0$|^0*0$'
Expand Down

0 comments on commit 4f6ee13

Please sign in to comment.