Added README.md

parent 257fd79e
## Redirector
Installation:
`$ python3 setup.py install`
Usage:
`$ redirector <.yaml file> <.map file>` - generate .conf and .map files for redirects for nginx
`$ redirector-watch <file-to-watch>` - set inotify watchdog for this file and renew .map and .conf files for this project when file content is changed
## Structure
#### Redirector:
`dev/redirector.py:` **Redirector** - main class with single function - **generate(**_yaml_file, map_file_**)**, that generates _.conf_ and _.map_ files in _MAPS_DIR_ and _CONFIG_DIR_ directories, specified in `dev/const.py`
`dev/generators.py:` **Generator** - class, that uses **MapGenerator** and **ConfigGenerator** for creating _.map_ and _.conf_ files.
File `dev/parser.py` consists of: **MapLineParser** and **ConfigReader**.
**MapLineParser.parse_line** reads a line from _.yaml_ file and returns a list of arguments with _return_code_ that specifies line type.
**ConfigReader.parse_map** reads _.map_ file and returns list of default redirects and _dict_ with error_code as _key_ and list of redirects with this specific code as _value_.
**ConfigReader.parse_yaml** reads _.yaml_ file and return list of tuples (<_path to .map_file_>, <_project_name_>)
<br>
####RedirectorWatch
**RedirectorWatch** - main class with main function **watch(**_yaml_file_**)** that sets ThreadedNotifier for _.yaml_ file that looks for changes, and starts `Redirector.generate()` any time file is changed.
\ No newline at end of file
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