1
0
mirror of https://github.com/CMiksche/gitea-auto-update synced 2026-03-11 21:17:22 +01:00

feat: New structure, added CLI, logging and setup

* Changed structure to a Object orientated approach.
* Add CLI with input for the settings file.
* Added logging via file.
* Added setup for publishing in pip.
This commit is contained in:
Christoph Miksche
2019-08-26 21:26:19 +02:00
parent 508b0ceb55
commit d95f1aacb8
15 changed files with 320 additions and 199 deletions

33
update/__init__.py Normal file
View File

@@ -0,0 +1,33 @@
'''
Gitea Auto Updater
Copyright 2018, 2019 The Gitea-Auto-Update Authors
All rights reserved.
License: GNU General Public License
'''
import logging
import configparser
import fire
from update import update
def updater(settings='settings.ini'):
# Config
config = configparser.ConfigParser()
config.read(settings)
# Create a log file
logging.basicConfig(filename=config.get('Gitea', 'logFile'), level=logging.DEBUG)
# Start update
update.Update(config.get('Gitea', 'site'),
config.get('Gitea', 'file'),
config.get('Gitea', 'sourceDir'),
config.get('Gitea', 'apiUrl'),
config.get('Gitea', 'buildFromSource'),
config.get('Gitea', 'tmpDir'),
config.get('Gitea', 'system'))
def main():
fire.Fire(updater)
if __name__ == '__main__':
main()