Skip to content

Commit

Permalink
Make the file system more user friendly (#11)
Browse files Browse the repository at this point in the history
* Make the file system more user friendly

* Use pip package in tests
  • Loading branch information
libre-man committed Nov 18, 2017
1 parent a87cc04 commit d4db8e1
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 173 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ install:
- pip install -U wheel
- pip install coveralls pytest-cov
- pip install codecov
- pip install -r requirements.txt
- pip install .
- which cgfs
- pip install celery[redis]
- git clone https://github.com/CodeGra-de/CodeGra.de.git backend
- pip install -r backend/requirements.txt
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ format:

.PHONY: test
test:
which cgfs
coverage erase
$(PYTEST) test/ -vvvvvvvvv $(TEST_FLAGS)
coverage report -m cgfs.py
coverage report -m codegra_fs/cgfs.py

.PHONY: test_quick
test-quick: TEST_FLAGS += -x
Expand Down
64 changes: 63 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CodeGra.fs
CodeGra.de filesystem
*The [CodeGra.de](https://github.com/CodeGra-de/CodeGra.de) filesystem*

<p align="center">
<a href="https://travis-ci.org/CodeGra-de/CodeGra.fs">
Expand Down Expand Up @@ -31,3 +31,65 @@ CodeGra.de filesystem
alt="Chat as developer on Matrix: #DevCodeGra.de:matrix.org">
</a>
</p>

## Installation
You can install this package using `pip`. At the moment this package is not yet
in the pip repositories, however you can install it directly from git: `pip3
install --user git+https://github.com/CodeGra-de/CodeGra.fs.git`. This installs
to scripts, `cgfs` used to mount the file-system and `cgapi-consumer` used by
editor plugins.

Please note that `pip3` is used, this because CodeGra.fs only with works with
python **3.5** or higher. It depends on:
- [fusepy](https://github.com/terencehonles/fusepy)
- [requests](http://docs.python-requests.org/en/master/)

## Usage
The basic used of the `cgfs` can be viewed by executing `cgfs --help`. The idea
behind `cgfs` is that you mount a CodeGra.de instance on you local computer, in
the mounted folder you can now browse, alter and delete files submitted by
yourself and people you have to grade.

The basic layout of the file-system is `/course/assingment/submission -
submission_time`, so for example `/datastructures/linked-list/Thomas Schaper -
2017-11-14T13:41:26.324712`. All files that a student submitted can be found in
the submission folder.

The file-system also contains a few *special* files, these are files that are
not submitted by a student but can be used to control CodeGra.de. These files
are validated on a close, which fails if the file format is not correct. The
following special files exist:

| Name | Editable<a href="#footnote-1-b"><sup id="footnote-1-a">1</sup></a> | Location | Use | Format |
| ---- | -------- | -------- | --- | ------ |
| `.api.socket` || Root | Location of the api socket | Single line with file location |
| `.cg-mode` || Root | Mode file system | `FIXED` or `NOT_FIXED` |
| `.cg-assignment-id` || Assignment | Id of this assignment | Single line with id |
| `.cg-assignment-settings.ini` || Assignment | Settings for this assignment | Ini file with settings |
| `.cg-edit-rubric.md` || Assignment | Rubric for this assignment, editing changes the rubric | See `.cd-edit-rubric.help` |
| `.cg-edit-rubric.help` || Assignment | Help file for the rubric file | Plain text file |
| `.cg-feedback` || Submission | The general feedback for this submission | Plain text file |
| `.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 |
| `.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. |
| `.cg-submission-id` || Submission | Id of this submission | Single line with id |

<a href="#footnote-1-a"><sup id="footnote-1-b">1</sup></a>: Only if
you have the correct permissions.

<a href="#footnote-2-a"><sup id="footnote-2-b">2</sup></a>: The grade is reset
if a rubric grade is available, otherwise it is deleted.

<a href="#footnote-3-a"><sup id="footnote-3-b">3</sup></a>: Only
markdown checkboxes should be changed.

It can happen that you didn't follow the exact format of the special file and
can't easily recover anymore. This isn't a really big deal, you can write the
string `__RESET__` to any writable special file to reset it to its server state.

CodeGra.fs is best used in combination with an editor plugin, such plugins exist
for [emacs](https://github.com/CodeGra-de/CodeGra.el) and
[atom](https://github.com/CodeGra-de/CodeGra.atom) and more are being created.

## LICENSE
This code is licensed under AGPL-v3, see the license file for the exact
license as this information may be out of date.
3 changes: 2 additions & 1 deletion api_consumer.py → codegra_fs/api_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def recv(s):
message += m
if len(m) < 1024:
break
return message

return message.decode()


def is_file(s, file):
Expand Down
File renamed without changes.
Loading

0 comments on commit d4db8e1

Please sign in to comment.