Remove the Gitlab forking functionality

(We no longer host other accounts on Gitlab so it doesn’t make sense any longer. If we move onto a future federated Git of some sort, we can re-evaluate the installation flow.)
parent 4f8a2de3
......@@ -6,17 +6,16 @@ set -e
#
# Better Installer.
#
# Gives you the option to carry out a full installation (good for developers
# who want to work on the Better iOS app or Better Safari Extension, etc.) or
# just install the Better Inspector (if you want to help create/edit content).
# Gives you the option to carry out a full installation (if you want to work on
# the Better iOS or macOS apps) or just install the Better Inspector and
# Better Builder (if you want to help create/edit content or want to run the
# back-end on Linux, etc., and don’t care about the iOS and macOS apps).
#
# The installer should run on Linux and macOS.
#
# The installation script is non-destructive and will not replace existing
# directories from a previous installation.
#
# Developers have the option of automatically forking the repositories
# during installation so that they can easily hack on Better and submit
# merge requests to the upstream (canonical) repositories.
#
# This is Independent Technology.
#
# ▲❤ We practice Ethical Design (https://ind.ie/ethical-design)
......@@ -31,8 +30,11 @@ set -e
# Properties
#
sourceURLSSH=git@source.ind.ie:better/better.git
sourceURLHTTPS=https://source.ind.ie/better/better.git
sourceURL=null
optionInstallEverything=false
optionFork=false
optionAccountName=better
humanNameOfThingToInstall=null
......@@ -77,8 +79,17 @@ ask() {
# Prints out a link to the Better app on the App Store on premature exits.
#
exitPS(){
echo -e "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 -e "Laura, Osky, and I (Aral) appreciate your support! :)\nhttps://ind.ie/team\n"
echo "PS. You can support us by buying Better Blocker."
echo ""
echo "For iPhone & iPad from the App Store:"
echo "https://itunes.apple.com/us/app/better-by-ind.ie/id1080964978?mt=8"
echo ""
echo "For Mac from the Mac App Store:"
echo "https://itunes.apple.com/us/app/better/id1121192229?ls=1&mt=12"
echo ""
echo "Laura, Aral, and Osky appreciate your support! :)"
echo "https://ind.ie/team"
echo ""
}
#
......@@ -100,10 +111,10 @@ menu(){
echo " | |_) | __/ |_| || __/ | ";
echo " |____/ \___|\__|\__\___|_| ";
# Question 1
# Question 1: Pick projects to install.
title="\n\nHello! What would you like to install?\n"
prompt="▶ "
options=("Everything (iOS App, Safari Extension, Inspector)" "Just the Inspector")
options=("Everything (iOS App, Safari Extension, Inspector)" "Just the Inspector and Builder")
echo -e "$title"
PS3="
......@@ -113,7 +124,7 @@ $prompt "
case "$REPLY" in
1 ) optionInstallEverything=true; humanNameOfThingToInstall="iOS App, etc.,"; break;;
2 ) optionInstallEverything=false; humanNameOfThingToInstall="Inspector"; break;;
2 ) optionInstallEverything=false; humanNameOfThingToInstall="Inspector and Builder"; break;;
$(( ${#options[@]}+1 )) ) echo -e "\nSee you later! :)\n"; exitPS; exit;;
*) echo -e "\nOops, I only understand numbers between 1 and 3.";continue;;
......@@ -122,10 +133,10 @@ $prompt "
done
# Question 2
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. (This will automatically fork the projects\n if you haven’t done so already yourself, so don’t worry.)\n\n• Select ‘use canonical repositories’ if you just want to run the\n ${humanNameOfThingToInstall} 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"
# Question 2: Pick SSH or HTTPS clone URL.
title="\nShould I clone via SSH or HTTPS?\n\n• Choose SSH if you have commit access to the repositories\n\n• Otherwise choose HTTPS\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=("Use my forks." "Use canonical repositories.")
options=("SSH" "HTTPS")
echo -e "$title"
PS3="
......@@ -134,8 +145,8 @@ $prompt "
case "$REPLY" in
1 ) optionFork=true; break;;
2 ) optionFork=false; break;;
1 ) sourceURL=sourceURLSSH; break;;
2 ) sourceURL=sourceURLHTTPS; break;;
$(( ${#options[@]}+1 )) ) echo -e "\nNo worries, we all get cold feet sometimes. Bye! :)\n"; exitPS; exit;;
*) echo -e "\nOops, I only understand numbers between 1 and 3.";continue;;
......@@ -144,34 +155,6 @@ $prompt "
done
#
# If person wants to fork, we need their private token so we can
# automatically fork the repositories via the GitLab API.
#
if [ $optionFork = true ]; then
echo """
Sure, I’ll use your forks (and create them if necessary) :)
To continue:
1. Sign up for an account at:
https://source.ind.ie
2. Generate and add an SSH key to your account at:
https://source.ind.ie/profile/keys
3. Visit:
https://source.ind.ie/profile/account
4. Copy your Private Token
"""
read -e -p "5. Paste it here: " privateToken
fi
#
# Summarise.
#
......@@ -180,22 +163,15 @@ To continue:
if [ $optionInstallEverything = true ]; then
echo -e "• Install everything (iOS App, Safari Extension, Inspector).\n"
else
echo -e "• Install only Better Inspector (and its dependencies).\n"
fi
if [ $optionFork = true ]; then
# Get the account name.
optionAccountName=$(accountName)
echo -e "• Use (and create, if necessary) your own forks on your\n ${optionAccountName} GitLab account on source.ind.ie."
else
echo "• Using the canonical repositories (read-only unless you have commit access)."
echo -e "• Install only Better Inspector and Builder (and their dependencies).\n"
fi
#
# Persist the account name in a hidden file so that the other
# installers can use it also.
# (This is a carryover from when we were hosting accounts on our Gitlab and
# you could choose to use your accounts.)
# TODO: Update all installation scripts to remove this as it is no longer necessary.
#
echo $optionAccountName > .accountname
......@@ -240,11 +216,6 @@ indentOutput(){
#
installEverything(){
if [ $optionFork = true ]; then
echo -e "\nEnsuring forks exist:\n"
ensureForksExistForEverything
fi
echo -e "\nInstalling everything:"
# 1. Install the Better iOS App (which will, in turn, install its dependencies, the Inspector and Builder)
......@@ -256,12 +227,7 @@ installEverything(){
installInspector(){
if [ $optionFork = true ]; then
echo -e "\nForking inspector (and builder)…"
ensureForksExistForInspector
fi
echo -e "\nInstalling inspector."
echo -e "\nInstalling Inspector and Builder:"
install "inspector" "Better Inspector"
}
......@@ -298,47 +264,6 @@ install(){
echo -e "\n${humanName} installed."
}
#
# Forks (if necessary) and installs a component. e.g., ensureForkExists "app" "Better iOS App" "<ID of project on source.ind.ie>"
#
ensureForkExists(){
componentToInstall=$1
humanName=$2
projectID=$3
# Check if a Better Builder installation exists.
if [ -d componentToInstall ]; then
echo " • Existing ${humanName} found locally. Skipping fork."
return 0
fi
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)
#
ensureForksExistForInspector(){
ensureForkExists "inspector" "Better Inspector" "151"
ensureForkExists "builder" "Better Builder" "105"
ensureForkExists "themes" "Better Themes" "136"
ensureForkExists "content" "Better Content" "106"
}
#
# Forks all repositories.
#
ensureForksExistForEverything(){
ensureForkExists "app" "Better iOS App" "107"
ensureForksExistForInspector
ensureForkExists "safari" "Better Safari Extension" "152"
}
main(){
# Kick things off by showing the menu.
menu
......
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