-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Features 25, 23 and Fixes 21 and 24 (#26)
* 📦 NEW: fix npm WARN lifecycle The node binary mistmatch... * 🐛 FIX: #23 * 🐛 FIX: refactored parsing rountines * 🐛 FIX: smoother install of github-changelog-generator * 📖 DOC: improve log msg * 👌 IMPROVE: messages and spinners * 👌 IMPROVE: log utils * 🐛 FIX: #24 * 📖 DOC: ending message * 📖 DOC: console messages * 🤖 TEST: logs * 🐛 FIX: dev qa complete for #24 * 👌 IMPROVE: colorized spinner * 👌 IMPROVE: colorized spinner ansi 256
- Loading branch information
Showing
11 changed files
with
310 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
scripts-prepend-node-path=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
workspace_log='/var/log/workspace-image.log' | ||
init_log='/var/log/workspace-init.log' | ||
echo -e "\n\e[38;5;171mSUMMARY 📃\e[0m\n" | ||
echo -en "\e[38;5;194mResults of building the workspace image\e[0m \e[38;5;34m$workspace_log\e[0m ➥\n\e[38;5;183m" | ||
cat $workspace_log | ||
echo -en "\e[0m" | ||
echo '' | ||
echo -en "\e[38;5;194mResults of the gitpod initialization\e[0m \e[38;5;34m$init_log\e[0m ➥\e[38;5;39m" | ||
cat $init_log | ||
echo -en "\e[0m" | ||
echo -en "\n\e[38;5;171mALL DONE 🚀\e[0m\n" | ||
echo -e "\e[38;5;194mIf everything looks good in the above results then push the newly created\n project files to your git repo and get started coding your project\e[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,88 @@ | ||
#!/bin/bash | ||
#printf "\033c" | ||
|
||
# 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 spinner | ||
. bash/third-party/spinner.sh | ||
|
||
# Bootstrap scaffolding | ||
if [ ! -d "$GITPOD_REPO_ROOT/bootstrap" ]; then | ||
echo "Results of building the workspace image ➥" | ||
cat /var/log/workspace-image.log | ||
echo -e "\nMoving Laravel project from ~/temp-app to $GITPOD_REPO_ROOT ..." | ||
# Todo replacespinner with a real progress bar for coreutils | ||
msg="\nMoving Laravel project from ~/temp-app to $GITPOD_REPO_ROOT" | ||
log_silent "$msg" && start_spinner "$msg" | ||
shopt -s dotglob | ||
mv --no-clobber ~/test-app/* $GITPOD_REPO_ROOT | ||
RESULT=$? | ||
if [ $? -ne 0 ]; then | ||
>&2 echo "ERROR: Failed to move Laravel project from ~/temp-app to $GITPOD_REPO_ROOT" | ||
err_code=$? | ||
if [ $err_code != 0 ]; then | ||
stop_spinner $err_code | ||
log "ERROR: Failed to move Laravel project from ~/temp-app to $GITPOD_REPO_ROOT" -e | ||
else | ||
echo "SUCCESS: moved Laravel project from ~/temp-app to $GITPOD_REPO_ROOT" | ||
stop_spinner $err_code | ||
log "SUCCESS: moved Laravel project from ~/temp-app to $GITPOD_REPO_ROOT" | ||
fi | ||
# BEGIN: Optional configurations | ||
# Super user account for phpmyadmin | ||
installed_phpmyadmin=$(. /tmp/utils.sh parse_ini_value /tmp/starter.ini phpmyadmin install) | ||
if [ $installed_phpmyadmin -eq 1 ]; then | ||
echo "Creating phpmyadmin superuser: pmasu..." | ||
if [ "$installed_phpmyadmin" == 1 ]; then | ||
msg="Creating phpmyadmin superuser: pmasu" | ||
log_silent "$msg" && start_spinner "$msg" | ||
mysql -e "CREATE USER 'pmasu'@'%' IDENTIFIED BY '123456';" | ||
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'pmasu'@'%';" | ||
RESULT=$? | ||
if [ $? -ne 0 ]; then | ||
>&2 echo "ERROR: failed to create phpmyadmin superuser: pmasu" | ||
err_code=$? | ||
if [ $err_code != 0 ]; then | ||
stop_spinner $err_code | ||
log "ERROR: failed to create phpmyadmin superuser: pmasu" -e | ||
else | ||
echo "SUCCESS: created phpmyadmin superuser: pmasu" | ||
stop_spinner $err_code | ||
fi | ||
fi | ||
# Install https://github.com/github-changelog-generator/github-changelog-generator | ||
installed_changelog_gen=$(bash bash/utils.sh parse_ini_value starter.ini github-changelog-generator install) | ||
if [ "$installed_changelog_gen" == 1 ]; then | ||
msg="Installing github-changelog-generator" | ||
log_silent "$msg" && start_spinner "$msg" && | ||
gem install github_changelog_generator --no-document --silent && | ||
stop_spinner $? | ||
fi | ||
# END: Optional configurations | ||
|
||
# Move and or merge necessary failes then cleanup | ||
(echo; cat ~/test-app/.gitignore) >> $GITPOD_REPO_ROOT/.gitignore && rm ~/test-app/.gitignore | ||
mv ~/test-app/README.md $GITPOD_REPO_ROOT/README_LARAVEL.md | ||
rmdir ~/test-app | ||
fi | ||
|
||
# Aliases for git | ||
echo "Writing git aliases..." | ||
bash bash/utils.sh add_file_to_file_after \\[alias\\] bash/snippets/emoji-log ~/.gitconfig | ||
bash bash/utils.sh add_file_to_file_after \\[alias\\] bash/snippets/git-aliases ~/.gitconfig | ||
echo "Writing git aliases complete, check the log for any possible errors." | ||
echo "try: git a or: git aliases for a list your git aliases." | ||
# Rake tasks (will be written to ~/.rake). | ||
# Some rake tasks are dynamic and depend on the configuration in starter.ini | ||
bash bash/init-rake-tasks.sh | ||
|
||
# Aliases for git | ||
msg="Writing git aliases" | ||
log_silent "$msg" && start_spinner "$msg" && | ||
bash bash/utils.sh add_file_to_file_after \\[alias\\] bash/snippets/emoji-log ~/.gitconfig && | ||
bash bash/utils.sh add_file_to_file_after \\[alias\\] bash/snippets/git-aliases ~/.gitconfig && | ||
stop_spinner $? | ||
log "try: git a or: git aliases for a list your git aliases.\n" | ||
|
||
echo "If the above results are successful then make sure to add, commit and push the changes to your git repository." | ||
# Messages for github_changelog_generator | ||
[ "$installed_changelog_gen" == 1 ] && | ||
log "You may auto generate a CHANGELOG.md from github commits by running the command:\nrake changelog [...options]\n" && | ||
log "See starter.ini (github_changelog_generator section) for configurable options" && | ||
log "For a full list of options see the github-changelog-generator repository on github" |
Oops, something went wrong.