Commit 7cf1f479 authored by Henrik Skov Midtiby's avatar Henrik Skov Midtiby

Added some use cases.

parent de5fc6e5
Interactive python interpreter.
$ cat assignment1.csv
repository userid
hw1-adam adam_id
hw1-birger birger_id
# First assignment
$ python
Python 3.x.x ...
>>> import config
>>> import pandas as pd
>>> from gitlab_class_helper import *
>>> start_gitlab_class_helper("source.coderefinery.org", config.public_access_token)
Initialized connection to gitlab instance.
Personal access token works.
>>> create_gitlab_class(
group_name = "test-rmurv2",
id_of_parent_group = x)
Created the "test-rmurv2" group in gitlab.
Full path to the group: xxxxxxxxxx.
Id of the group: 123.
>>> list_of_repo_names = pd.read_csv("assignment1.csv")
>>> create_assignment_repositories(
repositories = list_of_repo_names['repository'],
group_id = 123)
Working in group: 123 - "test-rmurv2".
Created project "hw1-adam" in "test-rmurv2".
Created project "hw1-birger" in "test-rmurv2".
>>> add_students_to_repositories(
repositories = list_of_repo_names['repository'],
user_ids = list_of_repo_names['userid'],
group_id = 123)
Working in group: 123 - "test-rmurv2".
Added "adam_id" to the project "hw1-adam".
Added "birger_id" to the project "hw1-birger".
>>> push_git_repo_to_repositories(
local_path = "hw1",
repositories = list_of_repo_names['repository'],
group = 123)
Working in group: 123 - "test-rmurv2".
Pushed git repo "hw1" to "hw1-adam".
Pushed git repo "hw1" to "hw1-birger".
>>> exit()
# Fetch student answers to the first assignment
$ python
Python 3.x.x ...
>>> import config
>>> import pandas as pd
>>> from gitlab_class_helper import *
>>> start_gitlab_class_helper("source.coderefinery.org", config.public_access_token)
Initialized connection to gitlab instance.
Personal access token works.
>>> enter_gitlab_class(
group_name = "test-rmurv2",
id_of_parent_group = x)
Entered the "test-rmurv2" group in gitlab.
Full path to the group: xxxxxxxxxx.
Id of the group: 123.
>>> list_of_repo_names = pd.read_csv("assignment1.csv")
>>> clone_repositories(
repositories = list_of_repo_names['repositories'],
local_path_to_fetch_to = "assignment1/studentresponses/")
Working in group: 123 - "test-rmurv2".
Cloned the repository "hw1-adam" to "assignment1/studentresponses/hw1-adam".
Cloned the repository "hw1-birger" to "assignment1/studentresponses/hw1-birger".
>>> # Grade assignments / provide feedback.
>>> push_repositories(
repositories = list_of_repo_names['repositories'],
local_path_to_fetch_to = "assignment1/studentresponses/")
Working in group: 123 - "test-rmurv2".
Pushed the repository "assignment1/studentresponses/hw1-adam" to "hw1-adam".
Pushed the repository "assignment1/studentresponses/hw1-birger" to "hw1-birger".
# Create second assignment
$ cat assignment2.csv
repository userid
hw2-group adam_id
hw2-group birger_id
$ python
Python 3.x.x ...
>>> import config
>>> import pandas as pd
>>> from gitlab_class_helper import *
>>> start_gitlab_class_helper("source.coderefinery.org", config.public_access_token)
Initialized connection to gitlab instance.
Personal access token works.
>>> enter_gitlab_class(
group_name = "test-rmurv2",
id_of_parent_group = x)
Entered the "test-rmurv2" group in gitlab.
Full path to the group: xxxxxxxxxx.
Id of the group: 123.
>>> list_of_repo_names = pd.read_csv("assignment2.csv")
>>> create_assignment_repositories(
repositories = list_of_repo_names['repository'],
group_id = 123)
Working in group: 123 - "test-rmurv2".
Created project "hw2-group" in "test-rmurv2".
>>> add_students_to_repositories(
repositories = list_of_repo_names['repository'],
user_ids = list_of_repo_names['userid'],
group_id = 123)
Working in group: 123 - "test-rmurv2".
Added "adam_id" to the project "hw2-group".
Added "birger_id" to the project "hw2-group".
>>> push_git_repo_to_repositories(
local_path = "hw2",
repositories = list_of_repo_names['repository'],
group = 123)
Working in group: 123 - "test-rmurv2".
Pushed git repo "hw2" to "hw2-group".
>>> exit()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment