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

Some semantic changes in the installer.

parent d9ba932f
...@@ -28,7 +28,7 @@ set -e ...@@ -28,7 +28,7 @@ set -e
################################################################################ ################################################################################
optionInstallEverything=false optionInstallEverything=false
optionForkFirst=false optionFork=false
accountName=better accountName=better
ask() { ask() {
...@@ -67,6 +67,11 @@ ask() { ...@@ -67,6 +67,11 @@ ask() {
done 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(){ menu(){
echo "" echo ""
echo " ____ _ _ "; echo " ____ _ _ ";
...@@ -91,7 +96,7 @@ $prompt " ...@@ -91,7 +96,7 @@ $prompt "
1 ) optionInstallEverything=true; break;; 1 ) optionInstallEverything=true; break;;
2 ) optionInstallEverything=false; 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;; *) echo "\nOops, I only understand numbers between 1 and 3.";continue;;
esac esac
...@@ -99,9 +104,9 @@ $prompt " ...@@ -99,9 +104,9 @@ $prompt "
done done
# Question 2 # 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="▶ " prompt="▶ "
options=("Fork." "Don’t fork.") options=("Use my forks." "Use canonical.")
echo "$title" echo "$title"
PS3=" PS3="
...@@ -110,10 +115,10 @@ $prompt " ...@@ -110,10 +115,10 @@ $prompt "
case "$REPLY" in case "$REPLY" in
1 ) optionForkFirst=true; break;; 1 ) optionFork=true; break;;
2 ) optionForkFirst=false; 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;; *) echo "\nOops, I only understand numbers between 1 and 3.";continue;;
esac esac
...@@ -124,9 +129,9 @@ $prompt " ...@@ -124,9 +129,9 @@ $prompt "
# If person wants to fork, we need their private token so we can # If person wants to fork, we need their private token so we can
# automatically fork the repositories via the GitLab API. # automatically fork the repositories via the GitLab API.
# #
if [ $optionForkFirst = true ]; then if [ $optionFork = true ]; then
echo """ echo """
Fork, it is! :) Sure, I’ll use your forks (and create them if necessary) :)
To continue: To continue:
...@@ -159,7 +164,7 @@ To continue: ...@@ -159,7 +164,7 @@ To continue:
echo "• Only install Inspector\n" echo "• Only install Inspector\n"
fi 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}" echo "• Fork the Better repositories into your own GitLab account\n on source.ind.ie using the private key ${privateToken}"
else else
echo "• Without forking (read-only unless you have commit access)" echo "• Without forking (read-only unless you have commit access)"
...@@ -169,7 +174,7 @@ To continue: ...@@ -169,7 +174,7 @@ To continue:
# Confirm. # Confirm.
# #
if ask "\nMay I proceed?" Y; then 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 if [ $optionInstallEverything = true ]; then
installEverything installEverything
else else
...@@ -202,12 +207,12 @@ indentOutput(){ ...@@ -202,12 +207,12 @@ indentOutput(){
# #
installEverything(){ installEverything(){
if [ $optionForkFirst = true ]; then if [ $optionFork = true ]; then
echo "\nForking…" echo "\nEnsuring forks exist:\n"
forkEverything ensureForksExistForEverything
fi fi
echo "\nInstalling everything." echo "\nInstalling everything:"
# 1. Install the Better iOS App (which will, in turn, install its dependencies, the Inspector and Builder) # 1. Install the Better iOS App (which will, in turn, install its dependencies, the Inspector and Builder)
install "app" "Better iOS App" install "app" "Better iOS App"
...@@ -217,9 +222,9 @@ installEverything(){ ...@@ -217,9 +222,9 @@ installEverything(){
} }
installInspector(){ installInspector(){
if [ $optionForkFirst = true ]; then if [ $optionFork = true ]; then
echo "\nForking inspector (and builder)…" echo "\nForking inspector (and builder)…"
forkInspector ensureForksExistForInspector
fi fi
echo "\nInstalling inspector." echo "\nInstalling inspector."
...@@ -260,9 +265,9 @@ install(){ ...@@ -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 componentToInstall=$1
humanName=$2 humanName=$2
projectID=$3 projectID=$3
...@@ -273,26 +278,28 @@ fork(){ ...@@ -273,26 +278,28 @@ fork(){
return 0 return 0
fi 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}) 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) # Fork the Inspector (which depends on the Builder)
# #
forkInspector(){ ensureForksExistForInspector(){
fork "inspector" "Better Inspector" "151" ensureForkExists "inspector" "Better Inspector" "151"
fork "builder" "Better Builder" "105" ensureForkExists "builder" "Better Builder" "105"
} }
# #
# Forks all repositories. # Forks all repositories.
# #
forkEverything(){ ensureForksExistForEverything(){
fork "app" "Better iOS App" "107" ensureForkExists "app" "Better iOS App" "107"
forkInspector ensureForksExistForInspector
fork "safari" "Better Safari Extension" "152" ensureForkExists "safari" "Better Safari Extension" "152"
} }
main(){ 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