38 lines
861 B
Bash
Executable File
38 lines
861 B
Bash
Executable File
#!/bin/bash
|
|
fail() {
|
|
echo "$*" >&2
|
|
exit 1
|
|
}
|
|
|
|
declare project_type=$1
|
|
declare project=$2
|
|
|
|
if [[ "${project}" == "" ]] || [[ "${project_type}" == "" ]]; then
|
|
echo "usage: $0 expo|flutter PROJECT" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -d "projects/${project}" ]]; then
|
|
if ! mkdir -p "projects/${project}"; then
|
|
fail "mkdir -p projects/${project}"
|
|
fi
|
|
fi
|
|
declare full_path=$(realpath "projects/${project}")
|
|
|
|
if ! docker compose run -it --rm \
|
|
--name "${project}-seed" \
|
|
-v $(pwd)/scripts:/scripts \
|
|
-v "${full_path}:/projects/${project}" \
|
|
android-dev-container -- \
|
|
seed-project \
|
|
"${project_type}" \
|
|
"${project}" \
|
|
-- \
|
|
-u $(id -u) \
|
|
-g $(id) \
|
|
; then
|
|
fail "Unable to run seed-project for ${project}"
|
|
else
|
|
echo "Project '${project}' now exists in projects/${project}"
|
|
fi
|