Burathar
4 years ago
4 changed files with 66 additions and 0 deletions
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
from .project import Project |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
from pathlib import Path |
||||
import yaml |
||||
from flask import app |
||||
from biscd import config |
||||
|
||||
class Project: |
||||
_storage_file = Path(config.config_dir()) / 'projects.yaml' |
||||
|
||||
storage = {} |
||||
|
||||
def __init__(self, name): |
||||
self.name = name |
||||
|
||||
def __repr__(self): |
||||
return f"{self.__class__.__name__}(name={self.name})" |
||||
|
||||
@classmethod |
||||
def get(cls, name): |
||||
project = cls._get_projects_from_file().get(name) |
||||
if project is None: |
||||
return None |
||||
return Project(project.get('name')) |
||||
|
||||
@classmethod |
||||
def list(cls): |
||||
projects = cls._get_projects_from_file() |
||||
project_list = [] |
||||
for project in projects: |
||||
name = [*project][0] |
||||
project_list.append(name) |
||||
return project_list |
||||
|
||||
@classmethod |
||||
def _get_projects_from_file(cls): |
||||
with open(cls._storage_file) as file: |
||||
projects = yaml.load(file, yaml.FullLoader).get('projects') |
||||
return projects |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
flask_development_server: |
||||
# Options: production, development |
||||
flask_env: production |
||||
# Options: 127.0.0.1 , 0.0.0.0 |
||||
server_host: 127.0.0.1 |
||||
port: 5000 |
||||
|
||||
logging: |
||||
log_to_sdout: true |
||||
logfile: info.log |
||||
|
||||
message: Hoi |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
projects: |
||||
- The Hunt: |
||||
url: thehunt |
||||
git_repo: https://git.sciuro.org/Burathar/The-Hunt |
||||
branch: master |
||||
secret: thisissecret |
||||
requirements-file: requirements.txt |
||||
tests: tests.py |
||||
|
||||
- Foo: |
||||
url: bar |
||||
git_repo: https://git.sciuro.org/Burathar/The-Hunt |
||||
branch: master |
||||
secret: thisissecret |
||||
requirements-file: requirements.txt |
||||
tests: tests.py |
Loading…
Reference in new issue