diff --git a/bash/init-gitpod.sh b/bash/init-gitpod.sh index 5ec993d1..2ee5b1f2 100644 --- a/bash/init-gitpod.sh +++ b/bash/init-gitpod.sh @@ -41,8 +41,29 @@ if [ ! -d "$GITPOD_REPO_ROOT/bootstrap" ]; then stop_spinner $err_code log "SUCCESS: moved Laravel project from ~/temp-app to $GITPOD_REPO_ROOT" fi - # configure Laravel to use gitpod urls + + # BEGIN: parse configurations + + # Configure .editorconfig + if [ -e .editorconfig ]; then + ec_type=$(bash bash/utils.sh parse_ini_value starter.ini .editorconfig type) + case $(echo "$ec_type" | tr '[:upper:]' '[:lower:]') in + 'laravel-js-2space') + cp bash/snippets/editorconfig/laravel-js-2space .editorconfig + ;; + 'none') + rm .editorconfig + ;; + *) + #Ignore invalid types + ;; + esac + fi + + # Laravel .env [ -e .env ] && url=$(gp url 8000); sed -i'' "s#^APP_URL=http://localhost*#APP_URL=$url\nASSET_URL=$url#g" .env + # END: parse configurations + # BEGIN: Optional configurations # Super user account for phpmyadmin installed_phpmyadmin=$(. bash/utils.sh parse_ini_value starter.ini phpmyadmin install) diff --git a/bash/snippets/editorconfig/laravel-js-2space b/bash/snippets/editorconfig/laravel-js-2space new file mode 100644 index 00000000..e6d1b86e --- /dev/null +++ b/bash/snippets/editorconfig/laravel-js-2space @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[*.php] +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 \ No newline at end of file diff --git a/starter.ini b/starter.ini index 67ce8313..c48e0d4a 100644 --- a/starter.ini +++ b/starter.ini @@ -2,13 +2,24 @@ # starter.ini # Configuration for gitpod to build your stack as you like it # Note: Boolean values should always be set to 1 (true) or 0 (false) -# Additional Note: Version numbers for node packages support semantic versioning or can be left blank +# Note: Version numbers for node packages support semantic versioning or can be left blank +# Note: Unless in the comments for a section, configuration is +# used only the first time a workspace is started. #################### [development] # Valid values: apache, php default_server=apache +[.editorconfig] +# valid values are: +# laravel-default: use the .editorconfig that comes with the laravel project scaffolding +# laravel-js-2space: altered vesrion of laravel-default allowing for 2 space indents for most files. +# --> see: bash/snippets/editorconfig/laravel-js-2space +# none: delete .editorconfig. Do not enforce project wide editor settings. +# Note: if left blank or set to an invalid value, laravel-default will be used +type=laravel-js-2space + [phpmyadmin] # This install happens in .gitpod.Dockerfile so it can get cached one way or the other, # force a build of the image workspace (see .gitpod.Dockerfile) to get your desired results.