From 2041896ec95b6e648c7cbb44fb91629ceb6df882 Mon Sep 17 00:00:00 2001 From: apolopena <3060702+apolopena@users.noreply.github.com> Date: Tue, 30 Mar 2021 12:07:46 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A1=20UPDATE=20COMMENTS:=20https://git?= =?UTF-8?q?hub.com/apolopena/gitpod-laravel8-starter/issues/82,=20Add=20MI?= =?UTF-8?q?T=20license,=20unify=20headers=20in=20code=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/before-tasks.sh | 12 ++++++++++-- bash/change-passwords.sh | 15 +++++++++------ bash/helpers.sh | 20 ++++++++++++-------- bash/init-complete.sh | 12 ++++++++++-- bash/init-gitpod.sh | 7 +++++++ bash/init-optional-scaffolding.sh | 9 ++++++--- bash/init-phpmyadmin.sh | 28 ++++++++-------------------- bash/init-project.sh | 10 +++++++++- bash/init-rake-tasks.sh | 7 +++++++ bash/init-react-example.sh | 7 +++++++ bash/scaffold-project.sh | 13 ++++++++----- bash/snippets/license/MIT-header | 4 ++++ bash/update-composer.sh | 7 +++++++ bash/utils.sh | 17 ++++++++++------- bash/workspace-init-log.sh | 5 ++++- bash/workspace-init-logger.sh | 28 ---------------------------- 16 files changed, 118 insertions(+), 83 deletions(-) create mode 100644 bash/snippets/license/MIT-header delete mode 100644 bash/workspace-init-logger.sh diff --git a/bash/before-tasks.sh b/bash/before-tasks.sh index 0ccac8e1..7b50b4e3 100644 --- a/bash/before-tasks.sh +++ b/bash/before-tasks.sh @@ -1,7 +1,15 @@ #!/bin/bash - +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# before-tasks.sh +# Description: +# Tasks that should be run everytime the worspace is created or started. +# +# Notes: # 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 +# in everytime the workspace starts. We do this in the 'before' task in .gitpod.yml # Load logger . workspace-init-log.sh diff --git a/bash/change-passwords.sh b/bash/change-passwords.sh index c0f8460f..84943417 100644 --- a/bash/change-passwords.sh +++ b/bash/change-passwords.sh @@ -1,15 +1,18 @@ #!/bin/bash # -# change-passwords.sh +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena # +# change-passwords.sh # Description: -# changes passwords for phpmyadmin from the defaults in version control to the values set in .starter.env -# Author: Apolo Pena +# Changes passwords for phpmyadmin from the defaults in version control to the values set in .starter.env # -# NOTE: +# Notes: # This script should be always run at least once by the user as an mandatory additional layer of security -# This script requires the file .starter.env to exist along will all the key value pairs as set -# in example.starter.ini +# This script requires the file .starter.env to exist along will all the key value pairs set. +# +# See: +# example.starter.ini # Load spinner . bash/third-party/spinner.sh diff --git a/bash/helpers.sh b/bash/helpers.sh index 3cbf3da3..f67657d1 100644 --- a/bash/helpers.sh +++ b/bash/helpers.sh @@ -1,19 +1,23 @@ #!/bin/bash - +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# # helpers.sh -# Author: Apolo Pena -# Description: A variety of useful functions with that depend on gitpod -# and other binaries, aliases and functions such as code in .bashrc -# other than coreutils. -# Note: Do not execute this script witout calling a function from it +# Description: +# A variety of useful functions that depend on Gitpod and other +# binaries, aliases and functions such as code in .bashrc +# +# Notes: +# Do not execute this script without calling a function from it # Additional Note: some functions use functions from .bashrc so the -i flag # is the safest way to invoke functions from this script. +# Do not execute this script without calling a function from it. # # Usage: bash -i arg1 arg2 arg3 ... -# version () { - echo "helpers.sh version 0.0.6" + echo "helpers.sh version 0.0.7" } # start_server diff --git a/bash/init-complete.sh b/bash/init-complete.sh index f6d504bf..b46759b9 100644 --- a/bash/init-complete.sh +++ b/bash/init-complete.sh @@ -1,6 +1,14 @@ #!/bin/bash - -# Note: always call this file last from the init command in .gitpod.yml +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# init-complete.sh +# Description: +# Tasks to be run everytime a gitpod workspace is created or started. +# +# Notes: +# Always call this file last from the 'init' command in .gitpod.yml # Summarize results bash bash/helpers.sh show_first_run_summary diff --git a/bash/init-gitpod.sh b/bash/init-gitpod.sh index 595843a3..f2c936f5 100644 --- a/bash/init-gitpod.sh +++ b/bash/init-gitpod.sh @@ -1,4 +1,11 @@ #!/bin/bash +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# init-gitpod.sh +# Description: +# Tasks to be run when a gitpod workspace is created for the first time. # Load logger . workspace-init-log.sh diff --git a/bash/init-optional-scaffolding.sh b/bash/init-optional-scaffolding.sh index 2de044ce..b7b4db72 100644 --- a/bash/init-optional-scaffolding.sh +++ b/bash/init-optional-scaffolding.sh @@ -1,8 +1,11 @@ #!/bin/bash - -# init-optional-scaffoliding.sh +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# init-optional-scaffolding.sh # Description: -# Installs various packages according to the configuration set in starter.ini +# Installs various packages and scaffolding according to the directive set in starter.ini # Load logger . workspace-init-log.sh diff --git a/bash/init-phpmyadmin.sh b/bash/init-phpmyadmin.sh index 232321aa..27ab051b 100644 --- a/bash/init-phpmyadmin.sh +++ b/bash/init-phpmyadmin.sh @@ -1,26 +1,14 @@ #!/bin/bash - -# init-phpmyadmin.sh +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# init-gitpod.sh # Description: -# Initial configuration for an existing phpmyadmin installation - -# 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 -} +# Configures an existing phpmyadmin installation. -# 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$' diff --git a/bash/init-project.sh b/bash/init-project.sh index a3b1abd5..b89ca094 100644 --- a/bash/init-project.sh +++ b/bash/init-project.sh @@ -1,7 +1,15 @@ #!/bin/bash +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# init-gitpod.sh +# Description: +# Initial configuration for an existing phpmyadmin installation. + # Load logger -. workspace-init-log.sh +. workspace-init-logger.sh # BEGIN example code block - migrate database # COMMENT: Load spinner diff --git a/bash/init-rake-tasks.sh b/bash/init-rake-tasks.sh index 9ee22417..ace5ad42 100644 --- a/bash/init-rake-tasks.sh +++ b/bash/init-rake-tasks.sh @@ -1,4 +1,11 @@ #!/bin/bash +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# init-rake-tasks.sh +# Description: +# Creates rake tasks dynamically. parse="bash bash/utils.sh parse_ini_value starter.ini" diff --git a/bash/init-react-example.sh b/bash/init-react-example.sh index 0034a23d..2601985b 100644 --- a/bash/init-react-example.sh +++ b/bash/init-react-example.sh @@ -1,4 +1,11 @@ #!/bin/bash +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# init-react-example.sh +# Description: +# Initial setup for the gitpod-laravel8-starter react example. # Load logger . workspace-init-log.sh diff --git a/bash/scaffold-project.sh b/bash/scaffold-project.sh index b2a47cdf..d336a3a9 100644 --- a/bash/scaffold-project.sh +++ b/bash/scaffold-project.sh @@ -1,12 +1,15 @@ #!/bin/bash # -# scaffold-project.sh +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena # -# Description:Creates all project files in /tmp -# Author: Apolo Pena +# scaffold-project.sh +# Description: +# Creates the main Laravel 8 project scaffolding. # -# NOTE: This script assumes it is being run from .gitpod.Dockerfile -# and all of this scripts dependencies have already been copied to /tmp +# Notes: +# This script assumes it is being run from .gitpod.Dockerfile and +# that all of this scripts dependencies have already been copied to /tmp LOG='/var/log/workspace-image.log' SCAFF_NAME='laravel8-starter' diff --git a/bash/snippets/license/MIT-header b/bash/snippets/license/MIT-header new file mode 100644 index 00000000..ae747adf --- /dev/null +++ b/bash/snippets/license/MIT-header @@ -0,0 +1,4 @@ +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# \ No newline at end of file diff --git a/bash/update-composer.sh b/bash/update-composer.sh index 479dac0c..0c4b4a3b 100644 --- a/bash/update-composer.sh +++ b/bash/update-composer.sh @@ -1,4 +1,11 @@ #!/bin/bash +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# +# update-composer.sh +# Description: +# Programatically updates composer to the latest version. LOG='/var/log/workspace-image.log' # BEGIN: update composer to the latest version diff --git a/bash/utils.sh b/bash/utils.sh index 2ca4dea8..1495027c 100644 --- a/bash/utils.sh +++ b/bash/utils.sh @@ -1,16 +1,19 @@ #!/bin/bash - +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# # utils.sh -# Author: Apolo Pena -# Description: A variety of useful functions with no dependecies. -# Note: Do not execute this script witout calling a function from it +# Description: +# A variety of useful functions with no dependecies. # -# Usage: bash arg1 arg2 arg3 ... +# Notes: +# Do not execute this script without calling a function from it. # - +# Usage: bash arg1 arg2 arg3 ... version () { - echo "utils.sh version 0.0.8" + echo "utils.sh version 0.0.9" } # Use absolute paths or paths relative to this script diff --git a/bash/workspace-init-log.sh b/bash/workspace-init-log.sh index 79c0285c..a8aade5e 100644 --- a/bash/workspace-init-log.sh +++ b/bash/workspace-init-log.sh @@ -1,5 +1,8 @@ #!/bin/bash - +# +# SPDX-License-Identifier: MIT +# Copyright © 2021 Apolo Pena +# # workspace-init-logger.sh # Description: # Log wrapper for logging to workspace-init.log diff --git a/bash/workspace-init-logger.sh b/bash/workspace-init-logger.sh deleted file mode 100644 index 79c0285c..00000000 --- a/bash/workspace-init-logger.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# workspace-init-logger.sh -# Description: -# Log wrapper for logging to workspace-init.log -# -# Usage: -# . workspace-init-logger -# log "SUCCESS: Logging to workspace-init.log" -# log "ERROR: something went wrong" - e - -# 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 -} \ No newline at end of file