diff --git a/.gitignore b/.gitignore index 5417622..b4b8061 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -soft/* gitea/* !gitea/gitea/ @@ -6,3 +5,5 @@ gitea/gitea/* !gitea/gitea/templates/ !gitea/gitea/public/ +soft/* +!soft/config/ diff --git a/Makefile b/Makefile index 27c8a06..d3dea85 100644 --- a/Makefile +++ b/Makefile @@ -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 + diff --git a/docker-compose.yml b/docker-compose.yml index 89de4fe..55911fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,7 +44,7 @@ services: restart: unless-stopped container_name: soft-serve volumes: - - ./soft:/soft-serve + - ./soft/data:/soft-serve ports: - 23231:23231 diff --git a/soft-serve.config.json b/soft/config/soft-serve.config.json similarity index 82% rename from soft-serve.config.json rename to soft/config/soft-serve.config.json index ba5ad3f..c1fe283 100644 --- a/soft-serve.config.json +++ b/soft/config/soft-serve.config.json @@ -1,7 +1,7 @@ { "paths": { "src": "./gitea/git/repositories/daylin", - "dest": "./soft/repos" + "dest": "./soft/data/repos" }, "repos": { "src": ["dotfiles", "git-server"], diff --git a/update-soft-serve-repos.py b/soft/config/update-soft-serve-repos.py similarity index 79% rename from update-soft-serve-repos.py rename to soft/config/update-soft-serve-repos.py index 63a4ca1..2624b4c 100755 --- a/update-soft-serve-repos.py +++ b/soft/config/update-soft-serve-repos.py @@ -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"]]: