Commit a5c622a2 authored by Aral Balkan's avatar Aral Balkan
Browse files

Added forking.

parent 4e4740eb
...@@ -25,6 +25,7 @@ set -e ...@@ -25,6 +25,7 @@ set -e
optionInstallEverything=false optionInstallEverything=false
optionForkFirst=false optionForkFirst=false
accountName=better
ask() { ask() {
# Modified slightly from https://gist.github.com/davejamesmiller/1965569 # Modified slightly from https://gist.github.com/davejamesmiller/1965569
...@@ -165,7 +166,11 @@ To continue: ...@@ -165,7 +166,11 @@ To continue:
# #
if ask "\nMay I proceed?" Y; then if ask "\nMay I proceed?" Y; then
echo "\n Thank you, proceeding with the installation.\n" echo "\n Thank you, proceeding with the installation.\n"
exit if [ $optionInstallEverything = true ]; then
installEverything
else
installInspector
fi
else else
echo "\nSure, no problem, maybe some other time. Bye! :)\n" echo "\nSure, no problem, maybe some other time. Bye! :)\n"
exit exit
...@@ -193,6 +198,9 @@ indentOutput(){ ...@@ -193,6 +198,9 @@ indentOutput(){
# #
installEverything(){ installEverything(){
echo "\nForking."
forkEverything
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)
...@@ -203,6 +211,9 @@ installEverything(){ ...@@ -203,6 +211,9 @@ installEverything(){
} }
installInspector(){ installInspector(){
echo "\nForking inspector (and builder)."
forkInspector
echo "\nInstalling inspector." echo "\nInstalling inspector."
install "inspector" "Better Inspector" install "inspector" "Better Inspector"
} }
...@@ -240,6 +251,43 @@ install(){ ...@@ -240,6 +251,43 @@ install(){
echo "\n · ${humanName} installed." 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(){ main(){
# Kick things off by showing the menu. # Kick things off by showing the menu.
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