diff options
Diffstat (limited to 'scripts/build.php')
| -rw-r--r-- | scripts/build.php | 96 |
1 files changed, 15 insertions, 81 deletions
diff --git a/scripts/build.php b/scripts/build.php index eecb677..e610298 100644 --- a/scripts/build.php +++ b/scripts/build.php @@ -2,111 +2,45 @@ require_once __DIR__.DIRECTORY_SEPARATOR.'functions.php'; -$hostname = null; -$output = null; +$hostname = 'davidtsadler.com'; -$opts = getopt( - 'h:o:', - [ - 'hostname:', - 'help::', - 'output:', - ] -); +$geminiSrc = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'gemini'; -if ($opts === false) { - usage(); -} - -foreach($opts as $opt => $value) { - if ($value === false) { - continue; - } - - switch ($opt) - { - case 'h': - case 'hostname': - $hostname = $value; - break; - case 'help': - usage(); - break; - case 'o': - case 'output': - $output = $value; - break; - } -} - - -if (!$hostname || !$output) { - usage(); -} - -if (!is_dir($output)) { - echo "Unable to locate specified output directory $output.\n\n"; - exit(1); -} - -if (!is_writable($output)) { - echo "Output directory $output is not writable.\n\n"; - exit(1); -} - -$geminiOutput = "$output/gemini"; - -if (file_exists($geminiOutput)) { - echo "Gemini build directory $geminiOutput already exists.\n\n"; +if (!is_dir($geminiSrc)) { + echo "Unable to locate gemini directory.\n\n"; exit(1); } -$wwwOutput = "$output/www"; - -if (file_exists($wwwOutput)) { - echo "WWW build directory $wwwOutput already exists.\n\n"; +if (!is_readable($geminiSrc)) { + echo "Gemini directory is not readable.\n\n"; exit(1); } -$src = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'; +$output = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'www'; -if (!is_dir($src)) { - echo "Unable to locate src directory $src.\n\n"; +if (!is_dir($output)) { + echo "Unable to locate output directory.\n\n"; exit(1); } -if (!is_readable($src)) { - echo "Src directory $src is not readable.\n\n"; +if (!is_writable($output)) { + echo "Output directory is not writable.\n\n"; exit(1); } $htmlTemplateDiretory = __DIR__.DIRECTORY_SEPARATOR.'../html_templates'; if (!is_dir($htmlTemplateDiretory)) { - echo "Unable to locate html template directory $htmlTemplateDiretory.\n\n"; + echo "Unable to locate html template directory.\n\n"; exit(1); } if (!is_readable($htmlTemplateDiretory)) { - echo "Src directory $htmlTemplateDiretory is not readable.\n\n"; - exit(1); -} - -$assetsDiretory = __DIR__.DIRECTORY_SEPARATOR.'../www_assets'; - -if (!is_dir($assetsDiretory)) { - echo "Unable to locate assets directory $assetsDiretory.\n\n"; + echo "HTML template directory is not readable.\n\n"; exit(1); } -if (!is_readable($assetsDiretory)) { - echo "Src directory $assetsDiretorY is not readable.\n\n"; - exit(1); -} - -$pages = getPages($src, $geminiOutput, $wwwOutput); - -buildGeminiSite($pages); +$pages = getPages($geminiSrc, $output); -buildWWWSite($pages, $hostname, $htmlTemplateDiretory, $assetsDiretory, $wwwOutput); +buildWWWSite($pages, $hostname, $htmlTemplateDiretory); |
