Commit 1744d407 authored by Aral Balkan's avatar Aral Balkan

Some semantic changes in the installer.

parent d9ba932f
......@@ -28,7 +28,7 @@ set -e
################################################################################
optionInstallEverything=false
optionForkFirst=false
optionFork=false
accountName=better
ask() {
......@@ -67,6 +67,11 @@ ask() {
done
}
exitPS(){
echo "PS. You can purchase and install Better from the App Store at:\nhttps://itunes.apple.com/us/app/better-by-ind.ie/id1080964978?mt=8\n"
echo "Laura, Osky, and I (Aral) appreciate your support! :)\nhttps://ind.ie/team\n"
}
menu(){
echo ""
echo " ____ _ _ ";
......@@ -91,7 +96,7 @@ $prompt "
1 ) optionInstallEverything=true; break;;
2 ) optionInstallEverything=false; break;;
$(( ${#options[@]}+1 )) ) echo "\nSee you later! :)\n"; exit;;
$(( ${#options[@]}+1 )) ) echo "\nSee you later! :)\n"; exitPS; exit;;
*) echo "\nOops, I only understand numbers between 1 and 3.";continue;;
esac
......@@ -99,9 +104,9 @@ $prompt "
done
# Question 2
title="\nShould I fork the repositories before cloning?\n\n• Fork if you want to hack on the code\n and submit merge requests easily.\n\n• Don’t fork if you just want to run Better\n or if you have commit access to the main repositories.\n\n• If you have no idea what any of this means, pick option 2\n (or purchase & install Better from the App Store with a tap) ;)\n"
title="\nShould I install from your forks or the canonical repositories?\n\n• Choose ‘use my forks’ if you want to hack on the code and submit\n merge requests easily. (Will automatically fork the projects\n if you haven’t done so already.)\n\n• Select ‘use canonical’ if you just want to run the app/inspector\n or if you have commit access to the canonical repositories.\n\n• If you have no idea what any of this means, pick option 2\n (or purchase & install Better from the App Store with a tap) ;)\n"
prompt="▶ "
options=("Fork." "Don’t fork.")
options=("Use my forks." "Use canonical.")
echo "$title"
PS3="
......@@ -110,10 +115,10 @@ $prompt "
case "$REPLY" in
1 ) optionForkFirst=true; break;;
2 ) optionForkFirst=false; break;;
1 ) optionFork=true; break;;
2 ) optionFork=false; break;;
$(( ${#options[@]}+1 )) ) echo "\nNo worries, we all get cold feet sometimes. Bye! :)\n"; exit;;
$(( ${#options[@]}+1 )) ) echo "\nNo worries, we all get cold feet sometimes. Bye! :)\n"; exitPS; exit;;
*) echo "\nOops, I only understand numbers between 1 and 3.";continue;;
esac
......@@ -124,9 +129,9 @@ $prompt "
# If person wants to fork, we need their private token so we can
# automatically fork the repositories via the GitLab API.
#
if [ $optionForkFirst = true ]; then
if [ $optionFork = true ]; then
echo """
Fork, it is! :)
Sure, I’ll use your forks (and create them if necessary) :)
To continue:
......@@ -159,7 +164,7 @@ To continue:
echo "• Only install Inspector\n"
fi
if [ $optionForkFirst = true ]; then
if [ $optionFork = true ]; then
echo "• Fork the Better repositories into your own GitLab account\n on source.ind.ie using the private key ${privateToken}"
else
echo "• Without forking (read-only unless you have commit access)"
......@@ -169,7 +174,7 @@ To continue:
# Confirm.
#
if ask "\nMay I proceed?" Y; then
echo "\n Thank you, proceeding with the installation.\n"
echo "\nThank you, proceeding with the installation."
if [ $optionInstallEverything = true ]; then
installEverything
else
......@@ -202,12 +207,12 @@ indentOutput(){
#
installEverything(){
if [ $optionForkFirst = true ]; then
echo "\nForking…"
forkEverything
if [ $optionFork = true ]; then
echo "\nEnsuring forks exist:\n"
ensureForksExistForEverything
fi
echo "\nInstalling everything."
echo "\nInstalling everything:"
# 1. Install the Better iOS App (which will, in turn, install its dependencies, the Inspector and Builder)
install "app" "Better iOS App"
......@@ -217,9 +222,9 @@ installEverything(){
}
installInspector(){
if [ $optionForkFirst = true ]; then
if [ $optionFork = true ]; then
echo "\nForking inspector (and builder)…"
forkInspector
ensureForksExistForInspector
fi
echo "\nInstalling inspector."
......@@ -260,9 +265,9 @@ install(){
}
#
# Forks and installs a component. e.g., fork "app" "Better iOS App"
# Forks and installs a component. e.g., ensureForkExists "app" "Better iOS App"
#
fork(){
ensureForkExists(){
componentToInstall=$1
humanName=$2
projectID=$3
......@@ -273,26 +278,28 @@ fork(){
return 0
fi
echo " • Forking ${humanName}…"
printf " • For ${humanName}…"
forkResult=$(curl --silent --header "PRIVATE-TOKEN: ${privateToken}" -X POST https://source.ind.ie/api/v3/projects/fork/${projectID})
printf " OK.\n"
}
#
# Fork the Inspector (which depends on the Builder)
#
forkInspector(){
fork "inspector" "Better Inspector" "151"
fork "builder" "Better Builder" "105"
ensureForksExistForInspector(){
ensureForkExists "inspector" "Better Inspector" "151"
ensureForkExists "builder" "Better Builder" "105"
}
#
# Forks all repositories.
#
forkEverything(){
fork "app" "Better iOS App" "107"
forkInspector
fork "safari" "Better Safari Extension" "152"
ensureForksExistForEverything(){
ensureForkExists "app" "Better iOS App" "107"
ensureForksExistForInspector
ensureForkExists "safari" "Better Safari Extension" "152"
}
main(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment