Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/weseek/apache2conf-generator-davsvn
A python script that scan Subversion repositories and generate Apache2 configuration for dav-svn
https://github.com/weseek/apache2conf-generator-davsvn
Last synced: about 1 month ago
JSON representation
A python script that scan Subversion repositories and generate Apache2 configuration for dav-svn
- Host: GitHub
- URL: https://github.com/weseek/apache2conf-generator-davsvn
- Owner: weseek
- License: apache-2.0
- Created: 2015-06-30T13:34:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-30T20:50:04.000Z (over 9 years ago)
- Last Synced: 2024-04-24T11:55:34.610Z (9 months ago)
- Language: Python
- Size: 141 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
apache2conf-generator-davsvn
=============================A python script iterates specified directory recursively,
scan Subversion repositories and generate Apache2 configuration for dav-svn.Requirements
------------* Python 3
Example
-------sample structure of directories:
```
/var/repos [normal dir]
repos1 > [SVN repository]
repos2 > [SVN repository]
notrepos [normal dir or file]
prj1 [normal dir]
prj1-repos1 > [SVN repository]
prj1-repos2 > [SVN repository]
prj2 [normal dir]
prj2-repos > [symlink to somewhere SVN repository]
```### Case1:
With [`templates/noauth.tpl`](https://github.com/weseek/apache2conf-generator-davsvn/blob/master/templates/noauth.tpl):
```
DAV svn
SVNPath $abspath```
following command:
```bash
$ python scan-and-gen.py --tpl templates/noauth.tpl /var/repos
```will output:
```
DAV svn
SVNPath /var/repos/repos1DAV svn
SVNPath /var/repos/repos2DAV svn
SVNPath /var/repos/prj1/prj1-repos1DAV svn
SVNPath /var/repos/prj1/prj1-repos2DAV svn
SVNPath /var/repos/prj2/prj2-repos```
### Case2:
With [`templates/tplmap.json`](https://github.com/weseek/apache2conf-generator-davsvn/blob/master/templates/tplmap.json):
```
{
"*/prj1/*": "templates/empty.tpl",
"*/prj2/*": "templates/noauth.tpl",
"*": "templates/with-htpasswd.tpl"
}
```following command:
```bash
$ python scan-and-gen.py --tplmap templates/tplmap.json /var/repos
```will output:
```
DAV svn
SVNPath /var/repos/repos1
AuthType Basic
AuthName "SVN Authentication"
AuthUserFile /home/user/.htpasswd
Require valid-userDAV svn
SVNPath /var/repos/repos2
AuthType Basic
AuthName "SVN Authentication"
AuthUserFile /home/user/.htpasswd
Require valid-userDAV svn
SVNPath /var/repos/prj2/prj2-repos```
Usage
-------### scan-and-gen.py
```
$ python scan-and-gen.py -h
usage: scan-and-gen.py [-h] [--tpl TEMPLATE_FILE] [--tplmap TEMPLATE_MAP_FILE] REPOS_ROOTThis program scans REPOS_ROOT, picks up Subversion repositories, and outputs
Apache2 configurations for dav-svn to STDOUT.positional arguments:
REPOS_ROOT path to the directory that contains SVN repositoriesoptional arguments:
-h, --help show this help message and exit
--tpl TEMPLATE_FILE path to an Apache2 configuration template file
--tplmap TEMPLATE_MAP_FILE
path to a JSON file that specify template mappings
```* You must specify only either one of `--tpl` and `--tplmap`.
### Template
Following placeholders are available in a template file.
placeholder | description
:-----------|:-----------
abspath | absolute path to the target repository
relpath | relative path to the target repository from REPOS_ROOT
basename | basename of the target repository### Template Mapping
* A JSON file specifing rules.
* key: [fnmatch pattern](https://docs.python.org/3.4/library/fnmatch.html)
* value: path to a template file
* The upper rules are stronger than the lower rules.Contributing
------------1. Fork the repository on Github
1. Write your change
1. Submit a Pull Request using GithubLicense and Authors
-------------------
- Author:: Yuki Takei ()Copyright 2014 WESEEK, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.