readme.md 2.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
webis
========
[TOC]

authors:
> steve.goering@uni-weimar.de

About
-----

11
"webis" is a command wrapping toolkit
12 13 14 15 16 17 18

Requirements
------------
python3, pep8

Usage
-----
19
For first starts run:
20 21 22 23 24
> $./webis.py -h


Configuration
-------------
25
See: config.json
26 27
```
    {
28
        "commands_directory": "tools/",
29
        "allowed_scripts": ["python", "bash"],
30 31
        "ignored_dirs": ["CVS"],
        ....
32 33 34
    }
```

35
Commands directory (tools)
36 37 38 39 40 41 42 43 44 45 46 47
-------------------------
e.g.:
├── core
│   ├── checker.sh
│   ├── install.sh
│   └── remove.sh
└── test
    ├── a.sh
    ├── b
    ├── t.oy
    └── t.txt

48 49
"core" and "test" are metanames for each toolkit, a call
>$./webis.py core -h
50 51 52 53 54 55 56

will print a short summary of all tools

>$./webis.py core checker

will perform a code style check of the tools directory

57
Adding a new Command
58
-------------------
59 60
First create a new folder in the "commandss_directory" with name FOLDER add all scrips to this folder,
e.g. MYSCRIPT.py and check if
61
>$./webis.py FOLDER MYSCRIPT
62 63 64 65 66
>$./webis.py FOLDER -h
>$./webis.py -h

works.
Add in config.json the general description of the command in the "commands_help" part.
67 68

### Notes for MYSCRIPT
69
Inside a new command directory, every script should have a small description comment, e.g.:
70 71 72 73 74
```
#!/bin/bash
#    NICE DESCRIPTION
ls /
```
75 76 77 78
It is important for the './webis.py NAME -h' call that this comment is the second line of the script, this approach can be seen as a extension of shebang.

### General scripts
All scripts must be code style checked with the "webis code checker" command. For python scripts this checks pep8 code style and for bash it checks the google bash style conventions.
79 80

### Bash scripts
81
Use bashhelper functions (logError, ...) for output (see install for including).
82 83

### Python scripts
84 85 86 87 88 89
Use lib, log, system in "lib" directory for uniform outputs and reducing reinventing the wheel.
Organize imports of each python script in the following way:

1. python standard libraries
2. thirdparty imports
3. own imports
90 91 92 93 94 95 96

Possible problems with new modules
----------------------------------
* using of hard coded paths, see core/install.sh for path handling
* using of local imported files, remember webis will not change to the working directory of the script, a call will start from webis root
* dont create a help.{py,sh} script inside a module