Commit a5c622a2 authored by Aral Balkan's avatar Aral Balkan

Added forking.

parent 4e4740eb
......@@ -25,6 +25,7 @@ set -e
optionInstallEverything=false
optionForkFirst=false
accountName=better
ask() {
# Modified slightly from https://gist.github.com/davejamesmiller/1965569
......@@ -165,7 +166,11 @@ To continue:
#
if ask "\nMay I proceed?" Y; then
echo "\n Thank you, proceeding with the installation.\n"
exit
if [ $optionInstallEverything = true ]; then
installEverything
else
installInspector
fi
else
echo "\nSure, no problem, maybe some other time. Bye! :)\n"
exit
......@@ -193,6 +198,9 @@ indentOutput(){
#
installEverything(){
echo "\nForking."
forkEverything
echo "\nInstalling everything."
# 1. Install the Better iOS App (which will, in turn, install its dependencies, the Inspector and Builder)
......@@ -203,6 +211,9 @@ installEverything(){
}
installInspector(){
echo "\nForking inspector (and builder)."
forkInspector
echo "\nInstalling inspector."
install "inspector" "Better Inspector"
}
......@@ -240,6 +251,43 @@ install(){
echo "\n · ${humanName} installed."
}
#
# Forks and installs a component. e.g., fork "app" "Better iOS App"
#
fork(){
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
echo "\n · Forking ${humanName}…"
forkResult=$(curl --silent --header "PRIVATE-TOKEN: ${privateToken}" -X POST https://source.ind.ie/api/v3/projects/fork/${projectID})
echo "Fork result: ${forkResult}"
}
#
# Fork the Inspector (which depends on the Builder)
#
forkInspector(){
fork "inspector" "Better Inspector" "151"
fork "builder" "Better Builder" "105"
}
#
# Forks all repositories.
#
forkEverything(){
fork "app" "Better iOS App" "107"
forkTheInspector
fork "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