Skip to content
Snippets Groups Projects
Commit 6fbdf337 authored by Antonio Ragagnin's avatar Antonio Ragagnin :speech_balloon:
Browse files

fix clone script

parent 4c6858f3
No related branches found
No related tags found
No related merge requests found
cloneall.bash 100644 → 100755
#!/bin/bash #!/bin/bash
set -vex set -vex
REPOS=(gitlab-profile core io integrate octree domain PM) REPOS=(${REPOS:=gitlab-profile core io integrate octree domain PM})
SESSION_NAME=how : ${SESSION_NAME:=hw}
while getopts "csapt" opt
while getopts "cptlr:" opt
do do
case "$opt" in case "$opt" in
c ) clona=1 ;; c ) clona=1 ;;
s ) tmuxa=1 ;; p ) pyinsta=1 ;;
a ) attaccha=1 ;; t ) tmuxa=1 ;;
p ) installa=1 ;; l ) linka=1 ;;
t ) testa=1 ;; r ) shift $(( OPTIND - 2 )) && REPOS=($@) && break
esac esac
done done
if [ -z "$clona" ] && [ -z "$tmuxa" ] && [ -z "$attaccha" ];then if [ -z "$clona" ] && [ -z "$pyinsta" ] && [ -z "$tmuxa" ] && [ -z "$linka" ];then
echo 'usage: ./cloneall.bash -c (clone repos) -p (pip install) -t (python tests) -s (create screen tmux session) -a (attach to tmux)' echo 'usage: ./cloneall.bash -c (clone repos) -p (python install and tests) -t (attach to tmux) -l (full tree of links) -r (repos)'
exit 1 exit 1
fi fi
for REPO in "${REPOS[@]}"; do
echo [ $REPO ]
done
#exit 0
if [ ! -z "$clona" ]; then if [ ! -z "$clona" ]; then
[[ ! -d "venv" ]] && python3 -mvenv venv [[ ! -d "venv" ]] && python3 -mvenv venv
. venv/bin/activate . venv/bin/activate
...@@ -33,19 +39,34 @@ if [ ! -z "$clona" ]; then ...@@ -33,19 +39,34 @@ if [ ! -z "$clona" ]; then
pushd $REPO pushd $REPO
git switch dev || echo no dev branch git switch dev || echo no dev branch
if [[ "$REPO" != "gitlab-profile" ]]; then if [[ "$REPO" != "gitlab-profile" ]]; then
[ ! -z "$installa" ] && python -mpip install -e . [ ! -z "$pyinsta" ] && python -mpip install -e . && python -m hotwheels.checkup hotwheels/
[ ! -z "$testa" ] && python -m hotwheels.checkup hotwheels/
fi fi
popd popd
done done
fi fi
if [ ! -z "$linka" ]; then
mkdir -p full/hotwheels
touch full/hotwheels/__init__.py || echo cant touch
for f in core/hotwheels/*; do
[[ "${f##*/:0:2}" == "__" ]] && continue
ln -sf $PWD/$f full/hotwheels/${f##*/}
done
for REPO in "${REPOS[@]}"; do
if [ "$REPO" != "core" ] && [ "$REPO" != "gitlab-profile" ]; then
ln -sf $PWD/$REPO/hotwheels/$REPO full/hotwheels/$REPO
fi
done
fi
if [ ! -z "$tmuxa" ]; then if [ ! -z "$tmuxa" ]; then
if ! tmux has-session -t $SESSION_NAME ; then if ! tmux has-session -t $SESSION_NAME ; then
# Create a new tmux session # Create a new tmux session
tmux new-session -d -s $SESSION_NAME -c $PWD tmux new-session -d -s $SESSION_NAME -c $PWD
[[ -d full ]] && REPOS+=(full)
for index in "${!REPOS[@]}"; do for index in "${!REPOS[@]}"; do
value="${REPOS[index]}" value="${REPOS[index]}"
...@@ -57,9 +78,6 @@ if [ ! -z "$tmuxa" ]; then ...@@ -57,9 +78,6 @@ if [ ! -z "$tmuxa" ]; then
tmux new-window -t $SESSION_NAME -c $PWD tmux new-window -t $SESSION_NAME -c $PWD
done done
fi fi
fi
if [ ! -z "$attaccha" ]; then
tmux attach-session -t $SESSION_NAME tmux attach-session -t $SESSION_NAME
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment