diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2021-05-27 20:55:30 +0100 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2021-05-27 20:55:30 +0100 |
| commit | a616477a70fd0837a2bedee5e863c1ae3db7d2f4 (patch) | |
| tree | b9029dbaea134ebb3b5efc693e7bce5af1a9b37b /scripts/php/build_www_site.php | |
| parent | ec74a17954f489ccfc1b66bbea4f22b867fa87ce (diff) | |
Tidy up scripts
Diffstat (limited to 'scripts/php/build_www_site.php')
| -rw-r--r-- | scripts/php/build_www_site.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/php/build_www_site.php b/scripts/php/build_www_site.php new file mode 100644 index 0000000..2defb92 --- /dev/null +++ b/scripts/php/build_www_site.php @@ -0,0 +1,46 @@ +<?php declare(strict_types=1); + +require_once __DIR__.DIRECTORY_SEPARATOR.'functions.php'; + +$hostname = 'davidtsadler.com'; + +$geminiSrc = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'gemini'; + +if (!is_dir($geminiSrc)) { + echo "Unable to locate gemini directory.\n\n"; + exit(1); +} + +if (!is_readable($geminiSrc)) { + echo "Gemini directory is not readable.\n\n"; + exit(1); +} + +$output = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'www'; + +if (!is_dir($output)) { + echo "Unable to locate output directory.\n\n"; + exit(1); +} + +if (!is_writable($output)) { + echo "Output directory is not writable.\n\n"; + exit(1); +} + +$htmlTemplateDiretory = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'html_templates'; + +if (!is_dir($htmlTemplateDiretory)) { + echo "Unable to locate html template directory.\n\n"; + exit(1); +} + +if (!is_readable($htmlTemplateDiretory)) { + echo "HTML template directory is not readable.\n\n"; + exit(1); +} + +$pages = getPages($geminiSrc, $output); + +buildWWWSite($pages, $hostname, $htmlTemplateDiretory, $output); + |
