From 3fd77b21691ac228328c01f5d4689e0b35aebd48 Mon Sep 17 00:00:00 2001 From: Jeremy Carin Date: Fri, 27 Jan 2023 23:31:33 -0500 Subject: [PATCH 1/2] setup single user or team script --- single_setup.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 single_setup.sh diff --git a/single_setup.sh b/single_setup.sh new file mode 100755 index 0000000..95e84ea --- /dev/null +++ b/single_setup.sh @@ -0,0 +1,64 @@ +#!/bin/bash +ROOT_DIR="~/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 " + exit 1 +fi + +rm -rf "$ROOT_DIR" +mkdir -p "$ROOT_DIR" + +hw=$1 +team_name=$2 + +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" + +git clone git@github.com:cs4118-hw/$hw.git "$ROOT_DIR/$hw" +read -p "Press enter to continue" + +./mk_group_repos.py --verbose --create \ + cs4118-hw "$hw" "$TEAMS_CSV" none +read -p "Press enter to continue" + +git remote add "$team_name" git@github.com: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 "Press enter to continue" + +./mk_group_repos.py --verbose cs4118-hw "$hw" "$TEAMS_CSV" push + +rm -rf "$ROOT_DIR" \ No newline at end of file From 3aa52b4f73403c01e46ac8594bba8240df4e8325 Mon Sep 17 00:00:00 2001 From: Jeremy Carin Date: Fri, 27 Jan 2023 23:41:50 -0500 Subject: [PATCH 2/2] make things a little prettier and push the right repo lol --- single_setup.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/single_setup.sh b/single_setup.sh index 95e84ea..e76fade 100755 --- a/single_setup.sh +++ b/single_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -ROOT_DIR="~/team_tmp" +ROOT_DIR="/tmp/team_tmp" HANDLES_TXT="$ROOT_DIR/handles.txt" TEAMS_CSV="$ROOT_DIR/teams.csv" HANDLES_CSV="$ROOT_DIR/handles.csv" @@ -16,6 +16,7 @@ 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" @@ -43,12 +44,28 @@ echo "test" ./add_team_members.py -v cs4118-hw "$ORG_TEAM" "$HANDLES_TXT" member read -p "Press enter to continue" -git clone git@github.com:cs4118-hw/$hw.git "$ROOT_DIR/$hw" -read -p "Press enter to continue" - ./mk_group_repos.py --verbose --create \ cs4118-hw "$hw" "$TEAMS_CSV" none -read -p "Press enter to continue" +read -p "Check GitHub to ensure the empty repo was created. Press enter to continue" + +git clone git@github.com: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" git@github.com:cs4118-hw/"$hw"-"$team_name".git @@ -57,8 +74,9 @@ git remote -v read -p "You should see two cs4118 remotes. Press enter to continue" git push "$team_name" master -read -p "Press enter to continue" +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" \ No newline at end of file