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/
@ -6,3 +5,5 @@ gitea/gitea/*
!gitea/gitea/templates/
!gitea/gitea/public/
soft/*
!soft/config/

View file

@ -1,9 +1,13 @@
.PHONY: lint
lint:
black *.py
prettier -w ./soft-serve.config.json
black soft/config/*.py
prettier -w ./soft/config/soft-serve.config.json
.PHONY: update-soft-serve
update-soft-serve:
sudo ./update-soft-serve-repos.py
update-soft-serve: soft-repos
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
container_name: soft-serve
volumes:
- ./soft:/soft-serve
- ./soft/data:/soft-serve
ports:
- 23231:23231

View file

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

View file

@ -16,11 +16,15 @@ def get_name(config, repo):
return name, dest
def get_repo_path(config, repos):
return Path(__file__).parent.parent.parent / config["paths"][repos]
def main():
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)
if name not in config["repos"]["src"]:
@ -32,7 +36,7 @@ def main():
shutil.rmtree(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)
if name not in [*config["repos"]["src"], *config["repos"]["dest"]]: