| 1 |
#!/usr/bin/env bash |
| 2 |
set -euo pipefail |
| 3 |
|
| 4 |
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" |
| 5 |
REF_DIR="${ROOT_DIR}/.refs" |
| 6 |
|
| 7 |
clone_or_update() { |
| 8 |
local group="$1" |
| 9 |
local name="$2" |
| 10 |
local url="$3" |
| 11 |
local target="${REF_DIR}/${group}/${name}" |
| 12 |
|
| 13 |
mkdir -p "${REF_DIR}/${group}" |
| 14 |
|
| 15 |
if [[ -d "${target}/.git" ]]; then |
| 16 |
echo "Updating ${group}/${name}" |
| 17 |
git -C "${target}" fetch --all --tags --prune |
| 18 |
git -C "${target}" pull --ff-only |
| 19 |
else |
| 20 |
echo "Cloning ${group}/${name}" |
| 21 |
git clone "${url}" "${target}" |
| 22 |
fi |
| 23 |
} |
| 24 |
|
| 25 |
clone_or_update "stdlib" "stdlib" "https://github.com/fortran-lang/stdlib.git" |
| 26 |
|
| 27 |
clone_or_update "terminal-ui" "fortran-ncurses" \ |
| 28 |
"https://github.com/interkosmos/fortran-ncurses.git" |
| 29 |
clone_or_update "terminal-ui" "M_ncurses" \ |
| 30 |
"https://github.com/urbanjost/M_ncurses.git" |
| 31 |
|
| 32 |
clone_or_update "system" "M_process" \ |
| 33 |
"https://github.com/urbanjost/M_process.git" |
| 34 |
clone_or_update "system" "M_system" \ |
| 35 |
"https://github.com/urbanjost/M_system.git" |
| 36 |
clone_or_update "system" "fortran-unix" \ |
| 37 |
"https://github.com/interkosmos/fortran-unix.git" |
| 38 |
|
| 39 |
clone_or_update "testing" "test-drive" \ |
| 40 |
"https://github.com/fortran-lang/test-drive.git" |
| 41 |
clone_or_update "testing" "vegetables" \ |
| 42 |
"https://github.com/everythingfunctional/vegetables.git" |