Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple script to setup individual user/team #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions single_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash
ROOT_DIR="/tmp/team_tmp"
HANDLES_TXT="$ROOT_DIR/handles.txt"
TEAMS_CSV="$ROOT_DIR/teams.csv"
HANDLES_CSV="$ROOT_DIR/handles.csv"

ORG_TEAM="students-2023-1"

if [ $# -ne 2 ]; then
echo "Usage: $0 <hw> <xx-team_name>"
exit 1
fi

rm -rf "$ROOT_DIR"
mkdir -p "$ROOT_DIR"

hw=$1
team_name=$2
boatswain_dir=`pwd`

if [[ ! "$team_name" =~ ^[0-9]+ ]]; then
echo "Team name must start with a number"
exit 1
fi

echo "Enter github usernames line by line, blank line when done: "
while read user; do
if [ -z "$user" ]; then
break
fi
echo "$user" >> "$HANDLES_TXT"
done

echo -n "$team_name," >> $TEAMS_CSV
awk '{print $1}' "$HANDLES_TXT" | tr '\n' ',' >> "$TEAMS_CSV"

# create csv file with format team_name,x,github_username
awk -v team_name="$team_name" '{print team_name ",x," $1}' "$HANDLES_TXT" > "$HANDLES_CSV"

cat "$HANDLES_CSV"
source venv/bin/activate
echo "test"

./add_team_members.py -v cs4118-hw "$ORG_TEAM" "$HANDLES_TXT" member
read -p "Press enter to continue"

./mk_group_repos.py --verbose --create \
cs4118-hw "$hw" "$TEAMS_CSV" none
read -p "Check GitHub to ensure the empty repo was created. Press enter to continue"

git clone [email protected]:cs4118-hw/$hw.git "$ROOT_DIR/$hw"
cd "$ROOT_DIR/$hw"
echo "-----------------"
git ls-files
echo "-----------------"

read -p "Skeleton code files should be present. Press enter to continue"

echo "-----------------"
git status
echo "-----------------"

read -p "There should be nothing to commit. Press enter to continue"

echo "-----------------"
git log
echo "-----------------"
read -p "There should only be the initial commit. Press enter to continue"

git remote add "$team_name" [email protected]:cs4118-hw/"$hw"-"$team_name".git

git remote -v

read -p "You should see two cs4118 remotes. Press enter to continue"

git push "$team_name" master
read -p "Check GitHub to ensure the skel code was pushed. Press enter to continue"

cd "$boatswain_dir"
./mk_group_repos.py --verbose cs4118-hw "$hw" "$TEAMS_CSV" push

rm -rf "$ROOT_DIR"