move soft serve update to sub-directory

This commit is contained in:
Daylin Morgan 2022-08-15 06:01:37 +00:00
parent 7a28214f15
commit dac5ec886f
5 changed files with 18 additions and 9 deletions

3
.gitignore vendored
View file

@ -1,4 +1,3 @@
soft/*
gitea/* gitea/*
!gitea/gitea/ !gitea/gitea/
@ -6,3 +5,5 @@ gitea/gitea/*
!gitea/gitea/templates/ !gitea/gitea/templates/
!gitea/gitea/public/ !gitea/gitea/public/
soft/*
!soft/config/

View file

@ -1,9 +1,13 @@
.PHONY: lint .PHONY: lint
lint: lint:
black *.py black soft/config/*.py
prettier -w ./soft-serve.config.json prettier -w ./soft/config/soft-serve.config.json
.PHONY: update-soft-serve .PHONY: update-soft-serve
update-soft-serve: update-soft-serve: soft-repos
sudo ./update-soft-serve-repos.py
docker compose restart soft-serve docker compose restart soft-serve
.PHONY: soft-repos
soft-repos:
./soft/config/update-soft-serve-repos.py

View file

@ -44,7 +44,7 @@ services:
restart: unless-stopped restart: unless-stopped
container_name: soft-serve container_name: soft-serve
volumes: volumes:
- ./soft:/soft-serve - ./soft/data:/soft-serve
ports: ports:
- 23231:23231 - 23231:23231

View file

@ -1,7 +1,7 @@
{ {
"paths": { "paths": {
"src": "./gitea/git/repositories/daylin", "src": "./gitea/git/repositories/daylin",
"dest": "./soft/repos" "dest": "./soft/data/repos"
}, },
"repos": { "repos": {
"src": ["dotfiles", "git-server"], "src": ["dotfiles", "git-server"],

View file

@ -16,11 +16,15 @@ def get_name(config, repo):
return name, dest return name, dest
def get_repo_path(config, repos):
return Path(__file__).parent.parent.parent / config["paths"][repos]
def main(): def main():
config = get_config() config = get_config()
for repo in Path(config["paths"]["src"]).iterdir(): for repo in get_repo_path(config, "src").iterdir():
name, dest = get_name(config, repo) name, dest = get_name(config, repo)
if name not in config["repos"]["src"]: if name not in config["repos"]["src"]:
@ -32,7 +36,7 @@ def main():
shutil.rmtree(dest) shutil.rmtree(dest)
shutil.copytree(repo, dest) shutil.copytree(repo, dest)
for repo in Path(config["paths"]["dest"]).iterdir(): for repo in get_repo_path(config, "dest").iterdir():
name, dest = get_name(config, repo) name, dest = get_name(config, repo)
if name not in [*config["repos"]["src"], *config["repos"]["dest"]]: if name not in [*config["repos"]["src"], *config["repos"]["dest"]]: