Skip to content

Commit d4db8e1

Browse files
committed
Make the file system more user friendly (#11)
* Make the file system more user friendly * Use pip package in tests
1 parent a87cc04 commit d4db8e1

File tree

9 files changed

+251
-173
lines changed

9 files changed

+251
-173
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ install:
3535
- pip install -U wheel
3636
- pip install coveralls pytest-cov
3737
- pip install codecov
38-
- pip install -r requirements.txt
38+
- pip install .
39+
- which cgfs
3940
- pip install celery[redis]
4041
- git clone https://github.com/CodeGra-de/CodeGra.de.git backend
4142
- pip install -r backend/requirements.txt

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ format:
1212

1313
.PHONY: test
1414
test:
15+
which cgfs
1516
coverage erase
1617
$(PYTEST) test/ -vvvvvvvvv $(TEST_FLAGS)
17-
coverage report -m cgfs.py
18+
coverage report -m codegra_fs/cgfs.py
1819

1920
.PHONY: test_quick
2021
test-quick: TEST_FLAGS += -x

README.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# CodeGra.fs
2-
CodeGra.de filesystem
2+
*The [CodeGra.de](https://github.com/CodeGra-de/CodeGra.de) filesystem*
33

44
<p align="center">
55
<a href="https://travis-ci.org/CodeGra-de/CodeGra.fs">
@@ -31,3 +31,65 @@ CodeGra.de filesystem
3131
alt="Chat as developer on Matrix: #DevCodeGra.de:matrix.org">
3232
</a>
3333
</p>
34+
35+
## Installation
36+
You can install this package using `pip`. At the moment this package is not yet
37+
in the pip repositories, however you can install it directly from git: `pip3
38+
install --user git+https://github.com/CodeGra-de/CodeGra.fs.git`. This installs
39+
to scripts, `cgfs` used to mount the file-system and `cgapi-consumer` used by
40+
editor plugins.
41+
42+
Please note that `pip3` is used, this because CodeGra.fs only with works with
43+
python **3.5** or higher. It depends on:
44+
- [fusepy](https://github.com/terencehonles/fusepy)
45+
- [requests](http://docs.python-requests.org/en/master/)
46+
47+
## Usage
48+
The basic used of the `cgfs` can be viewed by executing `cgfs --help`. The idea
49+
behind `cgfs` is that you mount a CodeGra.de instance on you local computer, in
50+
the mounted folder you can now browse, alter and delete files submitted by
51+
yourself and people you have to grade.
52+
53+
The basic layout of the file-system is `/course/assingment/submission -
54+
submission_time`, so for example `/datastructures/linked-list/Thomas Schaper -
55+
2017-11-14T13:41:26.324712`. All files that a student submitted can be found in
56+
the submission folder.
57+
58+
The file-system also contains a few *special* files, these are files that are
59+
not submitted by a student but can be used to control CodeGra.de. These files
60+
are validated on a close, which fails if the file format is not correct. The
61+
following special files exist:
62+
63+
| Name | Editable<a href="#footnote-1-b"><sup id="footnote-1-a">1</sup></a> | Location | Use | Format |
64+
| ---- | -------- | -------- | --- | ------ |
65+
| `.api.socket` || Root | Location of the api socket | Single line with file location |
66+
| `.cg-mode` || Root | Mode file system | `FIXED` or `NOT_FIXED` |
67+
| `.cg-assignment-id` || Assignment | Id of this assignment | Single line with id |
68+
| `.cg-assignment-settings.ini` || Assignment | Settings for this assignment | Ini file with settings |
69+
| `.cg-edit-rubric.md` || Assignment | Rubric for this assignment, editing changes the rubric | See `.cd-edit-rubric.help` |
70+
| `.cg-edit-rubric.help` || Assignment | Help file for the rubric file | Plain text file |
71+
| `.cg-feedback` || Submission | The general feedback for this submission | Plain text file |
72+
| `.cg-grade` || Submission | The grade for this submission | Single float or empty to delete or reset<a href="#footnote-2-b"><sup id="footnote-2-a">2</sup></a> the grade |
73+
| `.cg-rubric.md` | ✓<a href="#footnote-3-b"><sup id="footnote-3-a">3</sup></a> | Submission | The rubric for this submission | Markdown file where a ticked box means the item is selected. |
74+
| `.cg-submission-id` || Submission | Id of this submission | Single line with id |
75+
76+
<a href="#footnote-1-a"><sup id="footnote-1-b">1</sup></a>: Only if
77+
you have the correct permissions.
78+
79+
<a href="#footnote-2-a"><sup id="footnote-2-b">2</sup></a>: The grade is reset
80+
if a rubric grade is available, otherwise it is deleted.
81+
82+
<a href="#footnote-3-a"><sup id="footnote-3-b">3</sup></a>: Only
83+
markdown checkboxes should be changed.
84+
85+
It can happen that you didn't follow the exact format of the special file and
86+
can't easily recover anymore. This isn't a really big deal, you can write the
87+
string `__RESET__` to any writable special file to reset it to its server state.
88+
89+
CodeGra.fs is best used in combination with an editor plugin, such plugins exist
90+
for [emacs](https://github.com/CodeGra-de/CodeGra.el) and
91+
[atom](https://github.com/CodeGra-de/CodeGra.atom) and more are being created.
92+
93+
## LICENSE
94+
This code is licensed under AGPL-v3, see the license file for the exact
95+
license as this information may be out of date.

api_consumer.py renamed to codegra_fs/api_consumer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def recv(s):
2828
message += m
2929
if len(m) < 1024:
3030
break
31-
return message
31+
32+
return message.decode()
3233

3334

3435
def is_file(s, file):
File renamed without changes.

0 commit comments

Comments
 (0)