From e1f4dad2f029c7c705fe5983ca51b434014ab4d3 Mon Sep 17 00:00:00 2001 From: Peter Dahlberg Date: Sat, 11 Jun 2016 22:04:27 +0200 Subject: [PATCH] document config file so far --- deploy_config.py | 26 ++++++++++++++++++++++---- pelican_deploy/deploy.py | 6 +++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/deploy_config.py b/deploy_config.py index 561b246..8837a90 100644 --- a/deploy_config.py +++ b/deploy_config.py @@ -3,16 +3,34 @@ import os if __name__ == "__main__": raise SystemExit("Not meant to be run directly!") -# make sure git does not block giving pw prompts +# make sure git does not block giving pw prompts, git 2.3+ only os.environ["GIT_TERMINAL_PROMPT"] = "0" RUNNERS = { + # name of the runner, avoid spaces and other obscure cahracters "website_master": { + + # directory where building takes place, will be created if not there + # multiple runners may point to the same one "working_directory": "/tmp/test", - "clone_url": "https://github.com/catdog2/sandbox.git", + + # upstream url of the repository which contains the website + # use https://git::@github.com... to avoid pw prompts and instead fail + # (e.g. if github gives errornously 401 temporarily, git would block) + # os.environ["GIT_TERMINAL_PROMPT"] = "0" does the same but git 2.3+only + "clone_url": "https://git::@github.com/IEEE-SB-Passau/pelican-ieee-passau.git", + + # branch which will be built "git_branch": "master", + + # the final target, usually the wwwroot "target_directory": "/tmp/wwwout", - "pelican_command": 'echo $PELICAN_SITEURL', - "pelican_env": {"PELICAN_SITEURL": "//apu:800"} + + # command which builds the website + # important: specify {output} as output path of the generator + "build_command": 'tox -e pelican --output "{output}"', + + # will be added to env when running build_command + "build_env": {"PELICAN_SITEURL": "//apu:800"} } } diff --git a/pelican_deploy/deploy.py b/pelican_deploy/deploy.py index f307475..a069856 100644 --- a/pelican_deploy/deploy.py +++ b/pelican_deploy/deploy.py @@ -32,10 +32,10 @@ class DeploymentRunner: self.target_directory = runner_config["target_directory"] self.build_repo_path = self.working_directory / BUILD_REPO_DIR.format( name=name) - self.pelican_command = runner_config["pelican_command"].format( + self.build_command = runner_config["build_command"].format( output=OUTPUT_DIR.format(name=name)) self._build_proc_env = dict(os.environ, - **runner_config.get("pelican_env", {})) + **runner_config.get("build_env", {})) self._executor = ThreadPoolExecutor(max_workers=1) self._futures = set() @@ -116,7 +116,7 @@ class DeploymentRunner: # start the build if we should not abort if not self._abort: - args = shlex.split(self.pelican_command) + args = shlex.split(self.build_command) self._build_proc = Popen(args, cwd=str(self.build_repo_path), env=self._build_proc_env)