Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #1691 - Improves installation script #1692

Merged
merged 5 commits into from
Jun 28, 2019
Merged

Issue #1691 - Improves installation script #1692

merged 5 commits into from
Jun 28, 2019

Conversation

ajainuary
Copy link
Collaborator

As described in #1691 the PR includes some changes which allow for checking exit code before presenting the success message.

@ajainuary ajainuary requested a review from houshuang May 22, 2019 09:38
@ajainuary ajainuary marked this pull request as ready for review June 26, 2019 13:23
Copy link
Collaborator

@qgolsteyn qgolsteyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of comments.

Generally:

  • Would be good to add comments to describe the various commands in this script
  • Maybe we should clean up the script to remove nested if statements. Try to keep error checking contained and exit early.

initial_setup.sh Outdated Show resolved Hide resolved
initial_setup.sh Outdated
if which yarn && [[ `yarn --version` == $YARN_VERSION ]]; then
echo 'Using pre-installed global Yarn'; YARN=yarn
else
if [ -f "./node_modules/.bin/yarn" ] && [[ `./node_modules/.bin/yarn --version` == $YARN_VERSION ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the script is not run from the correct directory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go to the root repository

It is mentioned in the instructions for README.md
We could have error handling for that but seems a bit far-fetched idea to me.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, maybe add a quick comment in the file itself to keep this assumption close to the source code

initial_setup.sh Outdated
if ! "$YARN" install; then
echo "Sorry, there seems to be something wrong, please correct the errors and try again"
echo "There was some error installing the required packages, please rectify the errors and try again"
exit 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be a bit more descriptive with our error message. Maybe something along the lines of "Unable to run yarn install successfully. You might not be connected to the internet, or there might be a problem with your FROG folder"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be displayed by yarn itself. This just informs the user that his action wasn't successful.

initial_setup.sh Outdated Show resolved Hide resolved
initial_setup.sh Outdated
exit 0
echo
echo -e "\xE2\x9C\xA8 Finished Initial Setup."
echo -e "\xF0\x9F\xA4\x93 Run ${LBLUE}npm start server ${NC}to begin hacking!"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We could move the emojis to constants to help with readability

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could introduce a flag to remove emoji.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear if there is benefit in doing so, this file will normally only be run once

initial_setup.sh Outdated Show resolved Hide resolved
ajainuary and others added 2 commits June 27, 2019 12:01
Copy link
Collaborator

@qgolsteyn qgolsteyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! We could add some comments indicating the various steps we go through in this script for readability. Something like:

## INSTALLING PYTHON ##

<code goes here>

Very nitpicky so feel free to ignore if you don't have time

@houshuang houshuang merged commit 523a296 into develop Jun 28, 2019
@houshuang houshuang deleted the installer branch June 28, 2019 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants